Skip to content

Instantly share code, notes, and snippets.

View ViewComponent.php
<?php
class View
{
private $data = [];
public function __construct($renderer, $template)
{
$this->renderer = $renderer;
$this->template = $template;
}
View middleware.php
<?php
namespace Component
{
/**
* Class Middleware
* @package Component
*/
class Middleware
{
@G4MR
G4MR / nim-tooltip.nim
Last active Apr 4, 2019
nim windows tool tip
View nim-tooltip.nim
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
enjoy2d sdl_mixer chunk wrapper
View sound.nim
import sdl2, sdl2.mixer, sdl2.audio
### ------------------ ###
### enjoy2d ###
### ------------------ ###
### SDL2_Mixer Wrapper ###
### ------------------ ###
type Sound* = ref object of RootObj
play : bool
@G4MR
G4MR / gist:be15c27ac1afed4dcf3e
Last active Aug 29, 2015
Audio test code for SDL2_Mixer in nim
View gist:be15c27ac1afed4dcf3e
#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:
View gist:c115f758eee4b2c84c6d
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
View gist:be9951d312bebebc8fbb
include lib
var app = initApp("Example", 800, 600)
var img = Image()
#img.close()
var myfont = initFont(
"UTF8 Test ǽ Ǽ ǻ Ǿ",
20,
View gist:195693539e9ee6bae852
import sdl2, sdl2.ttf, sdl2.gfx
type
EAppMain* = ref object of RootObj
fps: int
width: int
height: int
title: string
running: bool
window*: WindowPtr
View gist:327074ceb2b8c7a04826
import sdl2, sdl2.image as img
import helpers
import typetraits
type Image* = ref object
rw*: RWopsPtr
format: string
loaded: bool
surface: SurfacePtr
View nimlang
import sdl2, sdl2.image as img
import helpers
import typetraits
type Image* = ref object
rw*: RWopsPtr
format: string
loaded: bool
surface: SurfacePtr