ref: c293a78c65a8bcadefae4e1f180286f87c69c930
dir: /test.c/
#include <u.h> #include <libc.h> #include <draw.h> #include <event.h> #include <keyboard.h> #include "dormer.h" /* TODO: resize and rotate sprites, * handle rgba, * play audio, * timer (?), * animate sprites */ void main() { int y = 300; winit(); Canvas *c = canvas(3, 2, DBlue); Sprite *black = mksprite(c, "res/glenda4.im"); Sprite *white = mksprite(c, "res/glenda.im"); Sprite *space = mksprite(c, "res/glenda3.im"); mvsprite(black, 100, 100); mvsprite(white, 200, y--); mvsprite(space, 400, 100); mktext(c, "helo rofik", "/lib/font/bit/lucidasans/unicode.7.font", 100, 100, DRed); mktext(c, "second", "/lib/font/bit/lucidasans/unicode.7.font", 0, 0, DTransparent); present(); for(;;){ readev(); switch(dm.ev){ case 0: break; case Emouse: break; case Ekeyboard: if(dm.key == 'q'){ free(c); exits(0); } if(dm.key == 'w'){ mvsprite(white, 200, y--); present(); } break; } } }