Skip to content

Instantly share code, notes, and snippets.

View radgeRayden's full-sized avatar
🤔

Westerbly Snaydley radgeRayden

🤔
View GitHub Profile
FORMATO BMP - MSPaint
HEADER
======
- 42 4D - B M (bitmap?) (2 bytes)
- 8 bytes reservados para o tamanho do arquivo (bytes na ordem inversa. Ex: '36 bb 17 00 00 00 00 00' torna-se '17 bb 36' = 1555254 bytes) [1]
- 4 bytes informando em que ponto a imagem em si começará a ser descrita. Ex: para bmp 24bits, '36 00 00 00' -> 36 = 54 bytes.
- 4 bytes '28 00 00 00' que não sei o que significa, mas deve ser um delimitador.
- 4 bytes para informar a largura da imagem. O formato é o mesmo do tamanho. Ex: '1c 02 00 00' torna-se '02 1c' = 540 pixels.
@radgeRayden
radgeRayden / debugoverlay.lua
Last active September 10, 2015 01:59
snake prototype
overlay = {}
local fps = 0
function overlay.draw()
love.graphics.print('FPS: ' .. fps, 25, 25)
end
function overlay.update(dt)
fps = 1 / dt - (1 / dt % 1)
--[[
Copyright (c) 2015, Westerbly (radgeRayden) Snaydley
This is licensed under the MIT license (http://opensource.org/licenses/MIT).
Time of creation: June 30th, 2015 12:32 GMT
Description:
Helper script for handling of Vector2 type objects.
Version: 1.01
--]]
local vector2 = {}
@radgeRayden
radgeRayden / main.lua
Created January 10, 2019 23:21
output of fennel --compile pong.fnl
local speed, ball_speed = 10, 200
local state = {dx = 2, dy = 1, left = 10, right = 10, x = 100, y = 100}
local w, h = love.window.getMode()
local keys = {a = {"left", -1}, down = {"right", 1}, up = {"right", -1}, z = {"left", 1}}
local function on_paddle_3f()
return (((state.x < 20) and (state.left < state.y) and (state.y < (state.left + 100))) or (((w - 20) < state.x) and (state.right < state.y) and (state.y < (state.right + 100))))
end
love.update = function(dt)
state.x = (state.x + (state.dx * dt * ball_speed))
state.y = (state.y + (state.dy * dt * ball_speed))
@radgeRayden
radgeRayden / game.fnl
Created January 11, 2019 07:32
fennel love.run
(fn love.run []
(if love.load
(love.load (love.arg.parseGameArguments arg) arg))
(if love.timer
(love.timer.step))
(var dt 0)
(fn []
(when love.event
(love.event.pump)
(each [name a b c d e f (love.event.poll)]
@radgeRayden
radgeRayden / gist:d6fac2d1abb81d176b60160990020f9c
Created January 23, 2019 07:23
data dump from vertex data
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0ÇA\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0\0B\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0@B\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0ÇB\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0áB\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0└B\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0ÓB\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0\0C\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0\16C\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0 C\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0000C\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0@C\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0PC\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0`C\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0pC\0\0\0\0\0\0\0?\0\0\0\0\1\1\1\1\0\0\0\0\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0ÇA\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0\0B\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0@B\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0ÇB\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0áB\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0└B\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0ÓB\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0\0C\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0\16C\0\0ÇA\0\0\0?\0\0\0\0\1\1\1\1\0\0 C\0\0ÇA\0\0\0?\0\0\0\0
@radgeRayden
radgeRayden / reload_xephyr.fish
Created February 15, 2019 21:09
script to reload awesomeWM inside xephyr without "touching" the window
#!/bin/fish
#wmctrl returns a list of windows with their ids as hexadecimal.
set -l XEPHYR_WINDOW_ID (wmctrl -l | grep "Xephyr on :1.0" | grep -Eo "0x[0-9a-f]+")
set -l CURRENT_WINDOW_ID (xdotool getactivewindow)
xdotool windowfocus $XEPHYR_WINDOW_ID;
sleep 0.25s;
xdotool key ctrl+shift key super+ctrl+r key ctrl+shift;
sleep 0.25s;
#!/usr/bin/lua
expr = io.read()
--tokenize
tokens = {}
local current_number = nil
@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)
@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