Skip to content

Instantly share code, notes, and snippets.

View fkaa's full-sized avatar

Felix Nemo Kaaman fkaa

  • 20:50 (UTC +11:00)
View GitHub Profile
pub trait GameState {
fn init(&mut self);
fn update(&mut self, delta: f32);
}
struct IngameState {
save: SaveDataStruct,
current_map: TodoMap,
entities: Vec<EntityStructOrTrait>
}
/*
* Copyright (c) 2014 Felix Kaaman
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
#include "game.h"
Chunk::Chunk(int x, int y, int z) {
memset(contents, 0, sizeof(contents));
count = 0;
dirty = true;
left = 0;
right = 0;
top = 0;
void try_call_argv(const char* fn, int argc, ...) {
mrb_value argv[argc];
va_list ap;
va_start(ap, argc);
for (i = 0; i < argc; i++) {
argv[i] = va_arg(ap, mrb_value);
}
va_end(ap);
if (fnlookup.count(fn)) {
apply plugin: 'java'
sourceCompatibility = 1.5
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
package cojo.game.tile;
import cojo.game.render.RenderUtils;
public class TileImpl extends Tile {
private String image;
private TiledLayerObject layer;
package cojo.game.render;
import static org.lwjgl.opengl.GL11.*;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;
import cojo.game.CojoGame;
public class RenderUtils {
#include "ruble.h"
Ruble::Ruble(GLFWwindow* wnd) : m_window(wnd) {
glfwMakeContextCurrent(m_window);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 640, 480, 0, -1, 1);
glEnable(GL_BLEND);
$$$***$$$$$~~~~"~~~~$$$$$$$$$$$$$$#####~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~####~~~~$$$$$$$$$$$$$$$~~~~
$$$**$$$$$~~~~~##~~~$$$$$$$$$$$$$$#####~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~####~~~~$$$$$$$$$$$$$$~~~~~
""""*$$$$~~~~~~###$$$$$$$$$$~~~$$######~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~####$~~$$$$$$$$~~~~$$~~~~~~
""""$$$$$~~~~~####$$$$$$$$$~~~~~~######~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**##$~~**$$$$$~~~~~~~~~~~~~~
"""$$$$$~~~~~~####~~~$$$$$$~~~~~~######~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~****~~~~*~~~~~~~~~~~~~~~~~~~
"""$$$$$~~~~~####~~~~~$$$$$~~~~~~#####~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*****~~~~~~~~~~~~~~~~~~~~~~~~
##$$$$$~~~~~~###~~~~~~~$$$$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$$$$**~~~~~~~~~~~~~~~~~~~~~~~~~
###$$$$~~~~~####~~~~~~~~$$$~~~~~~~~~~~~~~~~~$~~~#~~~~~~~~~~~~$~~~~~~$$$$$$~~~~~~~~~~~~~~~~~~~~~~~~~~
####$$~~~~~~~##~~~~~~~~~$$$~~~~~~~~~~~~~~~$$$$$$$##~~~~~~~~$$$$$$$$$$$$$$~~~~~~~~~~~~~~~~~~~~~~~~~~~
#####~~~~~~~~~$$~~~~~~~~~$$$~~~~~~~~~~~$$$$$$$$$$$~~~~~~~$$$$$$$$$$$$$$$$~~~~~~~~~~~~~~~~~~~~~~~~~~~
require 'kaffeh'
class SomeGame < Game
def initialize(config)
cfg = Config.new(config)
Window.set_size cfg.get?('width', 320), cfg.get?('height', 240)
Window.set_title cfg.get?('title', 'Kaffeh!')
cfg.save