Skip to content

Instantly share code, notes, and snippets.

View TuckerBMorgan's full-sized avatar
🎯
Focusing

marsmute TuckerBMorgan

🎯
Focusing
  • Riot Games
  • San Francisco, California
View GitHub Profile
@TuckerBMorgan
TuckerBMorgan / main.rs
Created March 20, 2023 00:49
Macro to replace
#[macro_export]
macro_rules! animation_state_for_character_state_libarry_macro {
( $( $character_state:ident, $crouched:ident, $standing:ident, $jumping:ident),* ) => {
let mut animation_for_character_state_library = HashMap::new();
$(
animation_for_character_state_library.insert(CharacterState::$character_state, AnimationStateForCharacterState::new(AnimationState::$crouched,AnimationState::$standing,AnimationState::$jumping));
)*
}
}
@TuckerBMorgan
TuckerBMorgan / terrain_vertex.glsl
Created October 4, 2022 21:03
My Terrain shader
precision highp float;
precision highp int;
layout(location = 0) in vec3 a_pos;
layout(location = 1) in vec2 uv;
layout(location = 2) in vec3 col;
out vec3 v_col;
out float v_toSunDot;
@TuckerBMorgan
TuckerBMorgan / trait_issue.rs
Created April 2, 2022 20:05
Component object safe error
use cgmath::*;
use crate::*;
use std::fmt::Debug;
use serde::{Serialize, Deserialize};
#[derive(Hash, Eq, PartialEq, Copy, Clone, Serialize, Deserialize, Debug)]
#[repr(u64)]
pub enum ComponentType {
TransformComponent = 1,//The first one needs to be 1
}
@TuckerBMorgan
TuckerBMorgan / Working.rs
Last active March 25, 2022 22:51
Working on stuff
pub const INPUT_WINDOW_MESSAGE : usize = PLAYER_MESSAGE_TYPE_BASE + 1;
#[derive(Encode, Decode, PartialEq, Debug)]
#[repr(C)]
pub struct InputWindowMessage {
pub message_type: usize,
pub input_messages: Vec<u8>
}
impl InputWindowMessage {
use sdl2::render::{WindowCanvas, BlendMode};
use sdl2::pixels::Color;
use sdl2::rect::{Point, Rect};
pub trait FauxGFX {
fn draw_quadrants(&mut self, p: Point, dp: Point, f: i32) -> Result<(), String>;
fn pixel_rgba_weight(&mut self, p: Point, color: Color, weight: i32) -> Result<(), String>;
fn pixel_rgba(&mut self, p: Point, color: Color) -> Result<(), String>;
fn pixel(&mut self, p: Point) -> Result<(), String>;
fn vline(&mut self, x: i32, y1: i32, y2: i32) -> Result<(), String>;
use std::io;
use std::usize;
use std::collections::HashMap;
use storm::input::message::*;
use storm::cgmath::Vector2;
use storm::render::message::*;
use tactics::Controller;
void branch_instructions(long opcode) {
//almost branch instructions follow the same format
//condition test
//and branch to vvvvvvvv if pass test
//for BR just always branch
//so this just preforms the correct test for each
//branch test
//and then either drops to the branch if needs to,
//or does not
@TuckerBMorgan
TuckerBMorgan / boilerplate.rs
Created August 3, 2017 20:45
a macro using the interpolate_idents macro to create boiler plate getters and setters for a struct
#[macro_export]
macro_rules! struct_builder {
(
$(
$struct_id:ident; public - [$($var:ident : $var_type:ty), *]; private - [$($pri_var:ident : $pri_var_type:ty), *];
),*
) => (
$(
pub struct $struct_id {
$(