Lunapaint new
No notes
Syntax:
C
/* (c) 2010 Hogne Titlestad */ #include <stdio.h> #include <math.h> #include "gui/gui.h" #include "gui/screen.h" #include "gui/window.h" int main ( int argc, char *argv[] ) { guiObject *screen; if ( screen = NewScreen ( 800, 600, 32 ) ) { GuiSet ( screen, GUIP_TITLE, ( void *)"New Lunapaint" ); guiObject *window = NewWindow ( ); GuiAdd ( screen, window ); GuiSet ( window, GUIP_POS_LEFT, &( int ){639-200} ); GuiSet ( window, GUIP_POS_TOP, &( int ){10} ); GuiSet ( window, GUIP_VISIBLE, &( uint8_t ){ 1 } ); guiObject *win2 = NewWindow ( ); GuiAdd ( screen, win2 ); GuiSet ( win2, GUIP_POS_TOP, &( int ){ 20 } ); GuiSet ( win2, GUIP_POS_LEFT, &( int ){ 20 } ); GuiSet ( win2, GUIP_VISIBLE, &( uint8_t ){ 1 } ); GuiDoMethod ( screen, GUIM_REFRESH, NULL ); sleep ( 2 ); int i; for ( i = 0; i < 720; i++ ) { GuiSet ( window, GUIP_POS_LEFT, &( int ){sin(i*3.14/180)*90+240} ); GuiSet ( window, GUIP_POS_TOP, &( int ){cos(i*3.14/180)*90+100} ); GuiDoMethod ( screen, GUIM_REFRESH, NULL ); } sleep ( 2 ); // Frees screen and all children GuiFree ( screen ); printf ( "Goodbye\n" ); } return 0; }