This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GL_NV_platform_binary | |
| GL_OES_rgb8_rgba8 | |
| GL_OES_EGL_sync | |
| GL_OES_fbo_render_mipmap | |
| GL_NV_depth_nonlinear | |
| GL_NV_draw_path | |
| GL_NV_texture_npot_2D_mipmap | |
| GL_OES_EGL_image | |
| GL_OES_EGL_image_external | |
| GL_OES_vertex_half_float |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <GLXW/glxw.h> | |
| #include <SDL2/SDL.h> | |
| class DisplaySystem { | |
| public: | |
| DisplaySystem() { | |
| window = SDL_CreateWindow( | |
| "thingy", | |
| SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, | |
| 1280, 720, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -c config_file | |
| -defaultkeys | |
| -log (enable logging to a file) | |
| -fs (fullscreen) | |
| -fw (fullscreen windowed) | |
| -res blahxblah (set screen resolution) | |
| -sc 1.0 (screen scale) | |
| -ignorefocus (take input in the background) | |
| -vjoyfix (always poll joystick pov hats? I don't know the context of this. irc says ps3 controllers) | |
| -noonlineconfirm (disable confirm message when picking character online) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* USAGE: | |
| * Timer foo; // Start the timer | |
| * const TimeData &time = foo.touch(); // Update and return TimeData (delta being the time since last touch) | |
| * const TimeData &time_peek = foo.peek(); // returns current TimeData only updating the current time (does not reset!) | |
| * SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION | |
| * | |
| * I haven't actually tested peek, but it looks right... */ | |
| #pragma once | |
| #include <SDL.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mod player { | |
| type AdvancerFn = fn(exp: uint) -> uint; | |
| pub struct Stat { | |
| pub skill: String, | |
| pub exp: uint, | |
| pub level: uint, | |
| advancer: AdvancerFn, | |
| } | |
| // insert exp, receive current level |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Apparently, this needs to be *before* I actually import the fucking mod | |
| // wat. | |
| use player::*; | |
| mod player; | |
| fn main() { | |
| let mut stats = vec![ | |
| Stat::new("HP".to_string(), player::default_advancer_fn), | |
| Stat::new("SP".to_string(), player::default_advancer_fn), | |
| Stat::new("ATK".to_string(), player::default_advancer_fn), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct Entity { id: int } | |
| struct World { entities: Vec<Entity> } | |
| impl World { | |
| fn get_entities(&self) -> Vec<Entity> { | |
| return self.entities; // KABOOM | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function gate(axis, num) | |
| local function wrap(x) | |
| return math.fmod(x, math.pi * 2) | |
| end | |
| if math.abs(axis.x) < 0.1 and math.abs(axis.y) < 0.1 then | |
| return num + 1 | |
| end | |
| local angle = math.atan2(axis.y, axis.x) -- in radians |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local glfw = require("glfw3") --Let's say we have a magic GLFW3 binding there! | |
| local openGL = require("opengl") | |
| openGL.loader = glfw.GetProcAddress | |
| openGL:import() | |
| --and somewhere else | |
| local vbo = ffi.new("GLuint[1]") | |
| gl.GenBuffers(1, vbo) | |
| gl.BindBuffer(GL.ARRAY_BUFFER, vbo[0]) | |
| gl.BufferData(GL.ARRAY_BUFFER, ffi.sizeof(vertices), vertices, GL.STATIC_DRAW) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Generate vertices | |
| const int size = 256; | |
| verts.reserve(size*size); | |
| faces.reserve(size*size); | |
| for (int j = 0; j < size; j++) | |
| { | |
| for (int i = 0; i < size; i++) | |
| { |