Skip to content

Instantly share code, notes, and snippets.

SDLCond: cover from StructSDLCond* {
new: extern(SDL_CreateCond) static func -> This
wait: extern(SDL_CondWait) func (mutex: SDLMutex) -> Int
waitTimeout: extern(SDL_CondWaitTimeout) func (mutex: SDLMutex, ms: UInt32) -> Int
signal: extern(SDL_CondSignal) func -> Int
broadcast: extern(SDL_CondBroadcast) func -> Int
destroy: extern(SDL_DestroyCond) func
}
if [ $UID = 0 ]; then
PS1="\e[0;31m\w \[\033[01;34m\]#\e[m "
else
PS1="\[\033[01;32m\]\w \[\033[01;34m\]$\e[m "
fi
use sdl, gl
import sdl, gl
main: func {
"Starting The Powder Toy\n" println()
sdlInit(SDLInitFlags everything)
sdlSetVideoMode(640, 480, 32, (SDLVideoFlags opengl))
sdlWMSetCaption("The Powder Toy", null)
sdlGLSetAttribute(SDLSurfaceFlags doubleBuffer, 1)
event: SDLEvent
match (event key keysym unicode) {
case 'q' =>
"q" print()
case 'Q' =>
"Q" print()
}
match (event key keysym unicode) {
case 'q' =>
"q" print()
case 'Q' =>
"Q" print()
}
UnionSDLEvent: cover from SDL_Event {
type: extern UInt8
active: extern SDLActiveEvent
key: extern SDLKeyboardEvent
motion: extern SDLMouseMotionEvent
button: extern SDLMouseButtonEvent
jaxis: extern SDLJoyAxisEvent
jball: extern SDLJoyBallEvent
jhat: extern SDLJoyHatEvent
jbutton: extern SDLJoyButtonEvent
while(sdlPollEvent(event&)) {
match event key keysym unicode {
case 'q' =>
"q" print()
case 'Q' =>
"Q" print()
}
}
setColor: func (destColor, srcColor: Int[]) {
dest[0] = src[0]
dest[1] = src[1]
dest[3] = src[3]
}
<<<<<<< HEAD
/* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O*/
/* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2*/
/* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X */
/* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l */
/* NONE */ {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,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}, /* None */
/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0}, /* Dust */
/* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
/* ./powder source file, generated with rock, the ooc compiler written in ooc */
#include <././powder.h>
#include <sdk/lang/IO.h>
#include <sdk/lang/Iterators.h>
#include <sdk/lang/System.h>
#include <sdk/lang/String.h>
#include <sdk/lang/types.h>
#include <sdk/lang/Exception.h>
#include <sdk/lang/Numbers.h>