Skip to content

Instantly share code, notes, and snippets.

View JettMonstersGoBoom's full-sized avatar
💭
I may be slow to respond.

Jett JettMonstersGoBoom

💭
I may be slow to respond.
View GitHub Profile
//
// drop in to sdl3_template for a fixed framebuffer experience
//
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_stdinc.h>
#include <math.h>
// "game" size
#define APP_WIDTH 384
@JettMonstersGoBoom
JettMonstersGoBoom / double_linked_list.h
Last active November 28, 2023 02:08
double_linked_list.h
typedef struct _list_t_
{
struct _list_t_ *prev,*next;
} _list_t_;
#define list_add(list, obj) ({ ((_list_t_ *)obj)->next = list; ((_list_t_ *)obj)->prev = NULL; if (list != NULL) list->prev = obj;list = (_list_t_ *)obj;})
#define list_del(list, obj) ({ if (((_list_t_ *)obj)->next) ((_list_t_ *)obj)->next->prev = ((_list_t_ *)obj)->prev; if (((_list_t_ *)obj)->prev) ((_list_t_ *)obj)->prev->next = ((_list_t_ *)obj)->next; else list = ((_list_t_ *)obj)->next;})
#define list_for(Y,X) for (_list_t_ *Y=X;Y!=NULL;Y=Y->next)
@JettMonstersGoBoom
JettMonstersGoBoom / raylib_to_str.h
Last active October 28, 2023 14:31
Experiment with Generic and converting some Raylib Types to and from strings.
#include "raylib.h"
// printf("%s\n",toString((Vector3}(1,2,3));
// {1.0000,2.000,3.000} is printed
// toString can be used with any of the variable types below
#define toString(X) _Generic((X), \
Vector2 : TextFormat("{%f,%f}",X.x,X.y), \
Vector3 : TextFormat("{%f,%f,%f}",X.x,X.y,X.z), \
Vector4 : TextFormat("{%f,%f,%f,%f}",X.x,X.y,X.z,X.w), \
Rectangle : TextFormat("{%f,%f,%f,%f}",X.x,X.y,X.width,X.height), \
Color : TextFormat("{0x%02X,0x%02X,0x%02X,0x%02X}",X.r,X.g,X.b,X.a), \
@JettMonstersGoBoom
JettMonstersGoBoom / raygui_menubar.h
Last active August 2, 2024 00:58
menu bar hack for raygui.
// note W is width of button, not bar
// note H is height of button AND bar
typedef struct
{
const char *string;
int uID;
void *data;
} MenuBarEntry;
// build with
// millfork -t c64 state.mfk
// an example of using a state machine type interface in Millfork
// each entity has a STATE.
// each state contains
// an entry action: performed when entering the state, and
// an exit action: performed when exiting the state, and
// an updata action: performed once per frame while the state is active
// here you can change state by simply setting ``next_state = target_state.pointer``
import os, sys, platform, string, getopt
import numpy as np
from scipy import ndimage
import matplotlib.pyplot as plt
from PIL import Image, ImageSequence, ImageDraw
# yes hardcoded filenames. whatevs :P
# load image
sourceimage = Image.open("test2.png")
pal = sourceimage.getpalette()
// compile with OSCAR64
//
// oscar64.exe -tm=nes -n boot.c -O2 -o=bin\boot.nes
// https://github.com/drmortalwombat/oscar64
#include <nes/nes.h>
#include <nes/neslib.h>
extern char PAL_BUF[32];
@JettMonstersGoBoom
JettMonstersGoBoom / textures_bpplimit_dither
Last active March 23, 2023 01:27
triangle rasterizer with psx style dither and bpp per gun.
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
#include "tigr.h"
#include "vec2.h"
// extension of this code
// https://github.com/gustavopezzi/triangle-rasterizer-float
// TILED plugin
// NES experiment, loading .CHR files and being able to edit the four palettes and update the tileset dynamically.
// 1st play with the new JS api for Tiled
var NESToolState = {
dialogOpen: false,
chosenAction: null,
chosenIndex: null,
image: null,
tileset: null,
@JettMonstersGoBoom
JettMonstersGoBoom / NCM16x8.cs
Last active December 28, 2022 19:44
NCM plugin code for Mega65 NCM
using System;
using System.Drawing;
using CharactorLib.Common;
using CharactorLib.Format;
namespace ncm_16x8
{
public class ncm_16x8 : FormatBase
{
public ncm_16x8()