This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local filename = arg[1] | |
local output = | |
[[ | |
using import struct | |
struct FNTCharInfo plain | |
id : i32 | |
x : i32 | |
y : i32 | |
width : i32 | |
height : i32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef WGPU_H | |
#define WGPU_H | |
#include "wgpu.h" | |
#endif | |
#include "framework.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define WGPU_TARGET_MACOS 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using import glsl | |
using import glm | |
out out-color : vec4 | |
location = 0 | |
inline circle (pos uv radius) | |
let dist-test = | |
smoothstep | |
radius |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spice escape-pattern (str) | |
import UTF-8 | |
using import itertools | |
str as:= string | |
let new-pattern = | |
->> str UTF-8.decoder | |
retain | |
inline (c) | |
switch c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline gamma->linear (...) | |
va-map | |
inline (c) | |
if (c <= 0.04045) | |
c / 12.92 | |
else | |
((c + 0.055) / 1.055) ** 2.4 | |
... | |
inline tile@ (level width height p) |