Skip to content

Instantly share code, notes, and snippets.

@Skaruts
Skaruts / gol.odin
Last active March 15, 2024 04:30
Simple Game of Life written in Odin
package main
import "core:fmt"
import "core:mem"
import rl "vendor:raylib"
Screen :: struct {
img : rl.Image,
@Skaruts
Skaruts / draw_tool_3d_mesh.gd
Last active December 18, 2022 13:37
Tool for drawing 3D lines using actual meshes (Godot 3)
class_name DrawTool3DMesh extends Spatial
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
# DrawTool3DMesh 0.7.3 (Godot 3)
#
# Uses a MultiMeshInstance to draw instances of a cube or cylinder,
# stretched to represent lines, and spheres for 3D points.
# For each line AB, scale an instance of a cube in one axis to equal the
# distance from A to B, and then rotate it accordingly using
# 'transform.looking_at()'.
@Skaruts
Skaruts / file.c
Last active February 6, 2022 17:47
terminal emulator shader (for love2d)
const vec3 WHITE = vec3(1.0);
const vec3 BLACK = vec3(0.0);
uniform vec2 grid_size = vec2(80.0, 50.0); // size of the terminal grid
uniform vec2 tileset_size = vec2(16.0, 16.0); // size of the font image or tileset image
uniform float cw = 20.0; // cell width
uniform float ch = 20.0; // cell height
uniform Image tileset; // the bitmap font image or tileset image
@Skaruts
Skaruts / batch_console.lua
Last active September 16, 2021 06:04
A terminal emulator console in love2d, which renders using spritebatches
-- import() is a custom made relative-require function
local Class = import("lib/middleclass/middleclass", ...)
local ClassProperties = import("lib/middleclass/class_properties", ...)
local BaseConsole = import("console_base", ...)
local palette = import("palette", ...)
local db = import("database", ...)
local ml = import("main_loop", ...)
local vec = import("lib/vec2", ...)
# type
# UI = ref object
include ../prelude
import ../terminal
import ../lib/rexnim
import theme
import tables, sequtils
import strutils
import rlw
import cell
import colors
import tileset
import vector2 # my own Vector struct
import rect
import nimex
import vertex # my own Vertex struct
import raylib/rlgl
# import common
#*******************************************************************************************
#
# raylib [models] example - first person maze
#
# This example has been created using raylib 2.5 (www.raylib.com)
# raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
#
# Copyright (c) 2019 Ramon Santamaria (@raysan5)
#
#*******************************************************************************************/
extends Node
class_name FOV_MRPAS
# TODO: static typing
var _circle_array := [] # to contain a mask to make fov rounded
var last_radius := 0 # to check if circle mask needs to be re-built
var map
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
# Builds grid lines, grid bounds and x,y,z axis lines, using three meshes
#
# Attach this script to a 3D scene like:
# GridManager (Spatial)
# Grid (Spatial)
# Origin (Spatial)
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
extends Spatial
extends KinematicBody
onready var head := $Head
onready var camera := $Head/Camera
onready var weapon := $Weapon
onready var frob_ray := $Head/Camera/FrobRay
onready var coll_stand := $CollisionStand
onready var coll_crouch := $CollisionCrouch