Skip to content

Instantly share code, notes, and snippets.

View attic-stuff's full-sized avatar
🎃
not eating canned air

attic-stuff attic-stuff

🎃
not eating canned air
View GitHub Profile
@attic-stuff
attic-stuff / generic_value_noise.glsl
Created April 3, 2026 20:17
generic value noise shader for gamemaker; apply to a white noise sprite or surface
/* VERTEX SHADER */
attribute vec3 in_Position;
attribute vec4 in_Colour;
attribute vec2 in_Texcoord;
varying vec2 texture_coordinate;
void main() {
vec4 vertex_model_position = vec4(in_Position, 1.0);
texture_coordinate = in_Texcoord;
@attic-stuff
attic-stuff / yy_parse.gml
Created April 1, 2026 15:20
convert's a yy asset file into a struct
/**
* parses a yy file into a struct
* @param {string} yy_file_path the full path to the yy file that has to be parsed
* @return {struct}
*/
function yy_parse(yy_file_path) {
if (yy_file_path != "") {
var yy_text_file = file_text_open_read(yy_file_path);
var json_string = "";
@attic-stuff
attic-stuff / compressed_tile_data_to_tilemap.gml
Created April 1, 2026 02:42
converts compressed tile data from a yy file into a runtime tilemap
/**
* converts compressed tile data from a room yy file into a runtime tilemap
* @param {array<real>} compressed_tile_data the "TileCompressedData" from the yy file
* @param {string} tilemap_name the string name of the tilemap layer to populate
* @param {real} tilemap_columns the number of columns in the tilemap being populated
*/
function compressed_tile_data_to_tilemap(compressed_tile_data, tilemap_name, tilemap_columns) {
var tilemap_layer = layer_tilemap_get_id(tilemap_name);
var tile_index = 0;
@attic-stuff
attic-stuff / sprite_get_index_from_frame.gml
Created October 31, 2025 18:20
takes a sprite frame, from stretched frames, and returns the image index for it
/*
* takes a sprite frame, from stretched frames, and returns the image index for it
* @param {Asset.GMSprite} sprite the sprite we're looking up
* @param {Real} frame the frame to check
* @return {Real}
*/
function sprite_get_index_from_frame(sprite, frame) {
var all_frames_information = sprite_get_info(sprite).frame_info;
@attic-stuff
attic-stuff / jasc_pal_library.gml
Last active July 29, 2025 17:19
small libary for reading/writing jasc-pal palette files
/**
* creates a struct object for managing a JASC-PAL color palette
* @param {Real} dot_pal_file the path to the .pal file
*/
function jasc_pal_pallette(dot_pal_file) constructor {
/**
* parses the .pal file
* @param {string} dot_pal_file the path toe the .pal file
*/
@attic-stuff
attic-stuff / chromatic_aberration.glsl
Created July 24, 2025 13:29
chromatic aberration shader
//this is the vertex shader
attribute vec3 in_Position;
attribute vec4 in_Colour;
attribute vec2 in_Texture_Coordinate;
varying vec2 vertex_texture_coordinate;
void main() {
vec4 vertex_model_position = vec4(in_Position, 1.0);
@attic-stuff
attic-stuff / room_region_to_scissor_region.gml
Created July 2, 2025 16:08
converts a region in the room to a gpu scissor region
/**
* converts a room region to a gpu scissor region
* @param {real} x the x position of the region origin
* @param {real} y the y position of the region origin
* @param {real} width the width of the region
* @param {real} height the height of the region
* @return {struct}
*/
function room_region_to_scissor_region(x, y, width, height) {
@attic-stuff
attic-stuff / noise_remap.gml
Last active May 10, 2025 17:22
remaps a noise texture to be cooler and better
/**
* remaps the values on a noise texture to fall between two new values
* @param {asset.GMSprite} noise_sprite the sprite that needs to be remapped
* @param {real} new_minimum the new minimum noise value
* @param {real} new_maximum the new maximum noise value
*/
function noise_remap(noise_sprite, new_minimum, new_maximum) {
var width = sprite_get_width(noise_sprite);
var height = sprite_get_height(noise_sprite);
@attic-stuff
attic-stuff / sprite_create_data_uri.gml
Last active August 24, 2025 16:25
creates a data uri from a sprite, assuming four channels of eight bit color
/**
* creates a data uri out of a sprite
* assumes rgba, 8bit
* @param {Asset.GMSprite} sprite_asset which sprite to convert to url
* @param {Real} [frame_number] which frame is being converted
* @return {String}
*/
function sprite_create_data_url(sprite_asset, frame_number = 0) {
static buffer_write_u32_backwards = function(buffer, value) {
@attic-stuff
attic-stuff / copy_game_path.gml
Created January 17, 2025 18:23
copies the path of the runner and game wad to the clipboard to use when u wanna open a second version of the game
function copy_game_path() {
clipboard_set_text($"{parameter_string(0)} -game {parameter_string(2)}");
}