Skip to content

Instantly share code, notes, and snippets.

<?php
class View
{
private $data = [];
public function __construct($renderer, $template)
{
$this->renderer = $renderer;
$this->template = $template;
}
<?php
namespace Component
{
/**
* Class Middleware
* @package Component
*/
class Middleware
{
@G4MR
G4MR / nim-tooltip.nim
Last active October 30, 2023 07:00
nim windows tool tip
import windows, typeinfo, os
var wc : Widechar = 32515;
var h : HINST
var nid : NOTIFYICONDATA = NOTIFYICONDATA()
var szip : array[0..63, char]
var info : array[0..255, char]
var infoTitle : array[0..63, char]
var title = "My Title"
for x in 0..title.len:
@G4MR
G4MR / sound.nim
Created May 2, 2015 20:30
enjoy2d sdl_mixer chunk wrapper
import sdl2, sdl2.mixer, sdl2.audio
### ------------------ ###
### enjoy2d ###
### ------------------ ###
### SDL2_Mixer Wrapper ###
### ------------------ ###
type Sound* = ref object of RootObj
play : bool
@G4MR
G4MR / gist:be15c27ac1afed4dcf3e
Last active August 29, 2015 14:20
Audio test code for SDL2_Mixer in nim
#test audio
var sound : Mix_ChunkPtr
var channel : cint
var audio_rate : cint
var audio_format : uint16
var audio_buffers : cint = 4096
var audio_channels : cint = 2
if Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) != 0:
@G4MR
G4MR / gist:c115f758eee4b2c84c6d
Last active August 29, 2015 14:18
Enjoy2d Example
include lib
# new image object
var img : Image
# font object (UTF8 support)
var myfont = initFont(
"UTF8 Test ǽ Ǽ ǻ Ǿ", # Default Text (which can be changed)
20, # Font Size
"OpenSans.ttf", # Font
include lib
var app = initApp("Example", 800, 600)
var img = Image()
#img.close()
var myfont = initFont(
"UTF8 Test ǽ Ǽ ǻ Ǿ",
20,
import sdl2, sdl2.ttf, sdl2.gfx
type
EAppMain* = ref object of RootObj
fps: int
width: int
height: int
title: string
running: bool
window*: WindowPtr
import sdl2, sdl2.image as img
import helpers
import typetraits
type Image* = ref object
rw*: RWopsPtr
format: string
loaded: bool
surface: SurfacePtr
import sdl2, sdl2.image as img
import helpers
import typetraits
type Image* = ref object
rw*: RWopsPtr
format: string
loaded: bool
surface: SurfacePtr