Lunapaint new

by m0ns00n on February 8th, 2010
No notes
Syntax: C
Show lines - Hide lines - Show in textbox - Download
/* (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;
}
 

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS