Skip to content

Instantly share code, notes, and snippets.

View MarcoLizza's full-sized avatar

Marco Lizza MarcoLizza

View GitHub Profile
@MarcoLizza
MarcoLizza / lua_passing_table_as_reference.c
Last active December 9, 2021 21:44
Pass a table from C to Lua and let the script modify it.
#include <lua/lua.h>
#include <lua/lualib.h>
#include <lua/lauxlib.h>
#include <stdio.h>
static const char *_script =
"function init(t)\n"
" t['width'] = 320\n"
" t['height'] = 240\n"
@MarcoLizza
MarcoLizza / imath-profile.c
Created August 30, 2021 13:32
Integer Math Profiling
#include <stdio.h>
#include <math.h>
#include <time.h>
int ifloor(float x)
{
const int i = (int)x;
return (x < 0.0f && x != i ? i - 1 : i);
}
@MarcoLizza
MarcoLizza / scale_rotate.c
Last active November 2, 2020 14:00
Fast scale-and-rotate blit.
typedef unsigned char Pixel_t;
typedef struct _Point_t {
int x, y;
} Point_t;
typedef struct _Rectangle_t {
int x, y;
int width, height;
} Rectangle_t;
@MarcoLizza
MarcoLizza / functional.lua
Created June 28, 2019 08:40
Functional approach to LUA tables.
--[[
Copyright (c) 2018-2019 by Marco Lizza (marco.lizza@gmail.com)
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
@MarcoLizza
MarcoLizza / main.lua
Created October 8, 2018 14:39
Bézier benchmark for LÖVE
--[[
Copyright (c) 2018 by Marco Lizza (marco.lizza@gmail.com)
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
@MarcoLizza
MarcoLizza / Tile_Based_Games_FAQ.md
Last active May 20, 2023 17:42 — forked from jefftriplett/gist:3384083
Tile-Based Games FAQ version 1.2 by Greg Taylor

Tile-Based Games FAQ version 1.2

by Greg Taylor

File : tilefaq.12 Home site: x2ftp.oulu.fi : pub/msdos/programming/docs Version : 1.2 Released : 4-20-95

Tilefaq 1.2 Copyright 1995 Greg Taylor. All rights reserved. Appendix I Copyright 1995 Chris Palmer. All rights reserved.