Skip to content

Instantly share code, notes, and snippets.

View radgeRayden's full-sized avatar
🤔

Westerbly Snaydley radgeRayden

🤔
View GitHub Profile
@radgeRayden
radgeRayden / main.c
Last active May 9, 2020 02:50
triangle example with fullscreen
#ifndef WGPU_H
#define WGPU_H
#include "wgpu.h"
#endif
#include "framework.h"
#include <stdio.h>
#include <stdlib.h>
#define WGPU_TARGET_MACOS 1
@radgeRayden
radgeRayden / gl.sc
Last active October 1, 2020 02:32
sdl gl
# import C functions and sanitize the scope
vvv bind glad
do
let glad =
include
options
.. "-I" module-dir "/glad/include"
"glad/src/glad.c"
do
using glad.extern
let number-regexp =
do
hex-digit := "[0-9a-fA-F]"
bin-digit := "[01]"
oct-digit := "[0-7]"
fn re-or (...)
let result =
.. "("
va-lifold ""
inline (index _. value computed-result)
using import enum
@@ memo
inline member-typeof (T member)
let result =
static-if ((T < Struct) or (T < CStruct))
field-count := (countof T)
let result =
va-lfold none
inline (_ignore value computed-result)
@radgeRayden
radgeRayden / color-test.sc
Last active September 19, 2020 13:43
Color test for scopes styles
fn test-color (style-kind)
let style-code = (default-styler style-kind "")
let styled-name = (default-styler style-kind (style-kind as string))
let color-code =
do
let code = (lslice style-code ((countof style-code) - (countof "\x1b[0m")))
match code
case "\x1b\[30m"
0
case "\x1b[31m"
@radgeRayden
radgeRayden / fnt2scopes.lua
Created October 16, 2019 00:49
FNT -> Scopes S Expressions converter
local filename = arg[1]
local output =
[[
using import struct
struct FNTCharInfo plain
id : i32
x : i32
y : i32
width : i32
height : i32
@radgeRayden
radgeRayden / main.lua
Last active May 13, 2022 00:36
minesweeper
local field = {}
local field_width = 10
local field_height = 10
local field_position_x = 100
local field_position_y = 100
local n_mines = 15
local size_square = 30
local start_time = 0
local play_time = 0
local is_game_over = false
@radgeRayden
radgeRayden / video.sc
Last active August 5, 2019 19:08
sokol_gfx scopes example: drawing palletized images to a texture then updating a gpu buffer
#
in: console VRAM
320x240 palletized pixel data
16-color (subject to change) pallete in RGB 24-bit format
using import glsl
using import glm
#shader constants
let +palette-width+ = 4
@radgeRayden
radgeRayden / main.sc
Last active May 20, 2019 18:18
sokol triangle example in scopes
include
(import sokol)
""""#define SOKOL_NO_ENTRY
#define SOKOL_IMPL
#define SOKOL_GLCORE33
#include "include/sokol/sokol_app.h"
#include "include/sokol/sokol_gfx.h"
include
(import C)
#!/usr/bin/lua
expr = io.read()
--tokenize
tokens = {}
local current_number = nil