diff options
author | Charles Lohr <lohr85@gmail.com> | 2016-12-11 00:03:40 -0500 |
---|---|---|
committer | Charles Lohr <lohr85@gmail.com> | 2016-12-11 00:03:40 -0500 |
commit | 44d7e56bf6a419104fee5dd2aedc26e00e543d69 (patch) | |
tree | 91567a4cfced76249981f616cf22781995989c58 /test.c | |
parent | 4d5a42768f142c25c2efa6c6fd54e1f0dc484f70 (diff) | |
download | libsurvive-44d7e56bf6a419104fee5dd2aedc26e00e543d69.tar.gz libsurvive-44d7e56bf6a419104fee5dd2aedc26e00e543d69.tar.bz2 |
* Get config from headset.
* Make pretty display.
* Improve disambiguation.
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 64 |
1 files changed, 64 insertions, 0 deletions
@@ -4,6 +4,10 @@ #include <stdint.h> #include <survive.h> +#include <os_generic.h> +#include <DrawFunctions.h> + + void survivefault( struct SurviveContext * ctx, const char * fault ) { fprintf( stderr, "Error: %s\n", fault ); @@ -15,6 +19,61 @@ void survivenote( struct SurviveContext * ctx, const char * fault ) fprintf( stderr, "Info: %s\n", fault ); } + +void HandleKey( int keycode, int bDown ) +{ +} + +void HandleButton( int x, int y, int button, int bDown ) +{ +} + +void HandleMotion( int x, int y, int mask ) +{ +} + +extern int bufferpts[32*2]; +extern char buffermts[32*128]; +extern int buffertimeto[32]; + +void * GuiThread( void * v ) +{ + short screenx, screeny; + while(1) + { + CNFGHandleInput(); + CNFGClearFrame(); + CNFGColor( 0xFFFFFF ); + CNFGGetDimensions( &screenx, &screeny ); + + int i; + for( i = 0; i < 32; i++ ) + { + if( buffertimeto[i] < 5 ) + { + uint32_t color = i * 3231349; + uint8_t r = color & 0xff; + uint8_t g = (color>>8) & 0xff; + uint8_t b = (color>>16) & 0xff; + r = (r * (5-buffertimeto[i])) / 5 ; + g = (g * (5-buffertimeto[i])) / 5 ; + b = (b * (5-buffertimeto[i])) / 5 ; + CNFGColor( (b<<16) | (g<<8) | r ); + CNFGTackRectangle( bufferpts[i*2+0], bufferpts[i*2+1], bufferpts[i*2+0] + 5, bufferpts[i*2+1] + 5 ); + CNFGPenX = bufferpts[i*2+0]; CNFGPenY = bufferpts[i*2+1]; + CNFGDrawText( buffermts, 2 ); + buffertimeto[i]++; + } + } + + + CNFGSwapBuffers(); + OGUSleep( 10000 ); + } +} + + + int main() { /* int i; @@ -34,6 +93,11 @@ int main() return 0;*/ struct SurviveContext * ctx = survive_init( &survivefault, &survivenote ); + CNFGBGColor = 0x000000; + CNFGDialogColor = 0x444444; + CNFGSetup( "Survive GUI Debug", 640, 480 ); + OGCreateThread( GuiThread, 0 ); + if( !ctx ) { |