ref: 4ae4cb2ec7d3fecf526b29d98eeb55d374a99dda
dir: /test.c/
#include <u.h> #include <libc.h> #include <draw.h> #include <event.h> #include <keyboard.h> #include <cursor.h> #include "dormer.h" /* TODO: transform sprites, * play audio, * timer (?), * animate sprites * set cursor * change text */ Cursor reading = { {-1, -1}, {0x0, 0x80, 0xff, 0x80, 0xff, 0x00, 0xfe, 0x00, 0xff, 0x00, 0xff, 0x80, 0xff, 0xc0, 0xef, 0xe0, 0xc7, 0xf0, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0xc0, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, }, {0x00, 0x00, 0x7f, 0x00, 0x7e, 0x00, 0x7c, 0x00, 0x7e, 0x00, 0x7f, 0x00, 0x6f, 0x80, 0x74, 0xc0, 0x03, 0xe0, 0x01, 0xf0, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x01, 0xb6, 0x01, 0xb6, 0x90, 0x00, } }; int tile = 1; void main() { winit(); Canvas *c = canvas(3, 2, DBlue); Sprite *black = mksprite(c, "res/anim.im", 9); Sprite *white = mksprite(c, "res/glenda4.im", 3); Sprite *space = mksprite(c, "res/flower.im", 1); mvsprite(black, 100, 100, tile); mvsprite(white, 500, 500, 2); mvsprite(space, 400, 100, 1); 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); esetcursor(&reading); 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'){ if(tile >= 9) tile = 1; mvsprite(black, 100, 100, ++tile); print("screen->r.min: (%d,%d)\n", screen->r.min.x, screen->r.min.y); present(); } break; } } }