PEDITOR CreateEditor( POBJECT po ) { PEDITOR pe; pe = (PEDITOR)Allocate( sizeof( EDITOR ) ); MemSet( pe, 0, sizeof( EDITOR ) ); pe->TView = CreateTransform(); pe->hVideo = OpenDisplaySizedAt( 0, -1, -1, -1, -1 ); //InitVideo( "World Editor" ); SetRedrawHandler( pe->hVideo, (void (CPROC*)(uintptr_t,PRENDERER))EditResizeCallback, (uintptr_t)pe ); SetMouseHandler( pe->hVideo, EditMouseCallback, (uintptr_t)pe ); BindEventToKey( pe->hVideo, KEY_PGUP, 0, PageUpKey, (uintptr_t)pe ); BindEventToKey( pe->hVideo, KEY_PGDN, 0, PageDownKey, (uintptr_t)pe ); // SetCloseHandler( pe->hVideo, EditCloseCallback, (uintptr_t)pe ); // menu for this instance.... #ifdef __WINDOWS__ pe->hMenu = CreatePopup(); //CreatePopupMenu(); AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDPREDEF+0, "Add Square" ); AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDPREDEF+1, "Add Triangle" ); AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDLINE, "Add Line" ); #else pe->hMenu = NULL; #endif SetPoint( vToScreen, VectorConst_Z ); // facing into screen... Invert( vToScreen ); // facing out of screen... pe->pCurrent = po; pe->pCurrentFacet = NULL; //po->objinfo.FacetPool.pFacets + 0; pe->pCurrentLine = NULL; //po->objinfo.LinePool.pLines + 0; ClearTransform( pe->TView ); Translate( pe->TView, 0, 0, (RCOORD)-100.0 ); pe->bLocked = FALSE; EditResizeCallback( (uintptr_t)pe); UpdateDisplay( pe->hVideo ); return pe; }
int InitMachine(void) { int J; /* Initialize variables */ UseZoom = UseZoom<1? 1:UseZoom>5? 5:UseZoom; InMenu = 0; FastForward = 0; OutImage.Data = 0; KeyReady = 0; /* Initialize system resources */ if (!InitQNX(Title,UseZoom*WIDTH,UseZoom*HEIGHT)) return 0; /* Set visual effects */ BPSSetEffects(UseEffects); /* Create main image buffer */ if(!NewImage(&OutImage,WIDTH,HEIGHT)) { TrashQNX(); return(0); } ClearImage(&OutImage,PIXEL(0,0,0)); CropImage(&ScrImage,&OutImage,XOFFSET,YOFFSET,(TI83_FAMILY?5:4)*TIWIDTH,4*TIHEIGHT); /* Initialize video to main image */ SetVideo(&OutImage,0,0,WIDTH,HEIGHT); /* Set colors */ XPal[0] = White = PIXEL(255,255,255); XPal[1] = Black = PIXEL(0,0,0); /* Attach keyboard handler */ SetKeyHandler(HandleKeys); /* Attach mouse handler */ SetMouseHandler(HandleMouse); /* Initialize sound */ InitSound(UseSound,150); SndSwitch=(1<<4)-1; SndVolume=255/4; SetChannels(SndVolume,SndSwitch); /* Initialize sync timer if needed */ if((SyncFreq>0)&&!SetSyncTimer(SyncFreq*UPeriod/100)) SyncFreq=0; deviceinfo_details_t* data; deviceinfo_get_details(&data); const char* os = deviceinfo_details_get_device_os(data); if (strcmp(os, "BlackBerry 10") == 0) { int i = 0; while (TouchMap[i].KeyCode) { TouchMap[i].X = TouchMap[i].X * 1.28; TouchMap[i].W = TouchMap[i].W * 1.28; TouchMap[i].Y = TouchMap[i].Y * 1.25; TouchMap[i].H = TouchMap[i].H * 1.25; i++; } } deviceinfo_free_details(&data); /* Done */ return(1); }
int main( void ) { uint32_t width, height; uint32_t imagecount = 0; uint32_t testimagesatinitialization = 0; Image blank; srand( time( NULL ) ); for(width=0; width< NUM_REELS; width++) { g.uiSpeedCounter[width] = 0; g.uiSpeedStep[width] = 2; g.idx[width]= 0; } g.pdi = GetDisplayInterface(); g.pii = GetImageInterface(); //SetSystemLog( SYSLOG_FILE, stdout ); SetSystemLoggingLevel( 1000 + LOG_NOISE); GetDisplaySize( &width, &height );; g.render = OpenDisplaySizedAt( 0, width, height, 0, 0 ); UpdateDisplay(g.render); g.surface = GetDisplayImage( g.render ); SetMouseHandler( g.render, MouseMethod, 0 ); // blank = LoadImageFile( WIDE("blankimage.jpg")); blank = MakeImageFile(96,96); ClearImageTo( blank, BASE_COLOR_CYAN ); g.playagain=LoadImageFile( WIDE("%images%/playagain.jpg")); g.playing =LoadImageFile( WIDE("%images%/playing.jpg")); g.background = LoadImageFile( WIDE("%images%/background.jpg") ); // g.background = blank; g.strip = LoadImageFile( WIDE("%images%/slot_strip.jpg") ); g.nReels = NUM_REELS; { Image icons[NUM_ICONS]; int n, m; INDEX idx; for( n = 0; n < NUM_ICONS; n++ ) { icons[n] = MakeSubImage( g.strip, 96 * n, 0, 96, 96 ); } n = width = imagecount = height = 0; while(imagecount < NUM_IMAGES ) { idx = rand()%NUM_ICONS; g.images[imagecount] = icons[idx]; if( testimagesatinitialization ) { BlotImage( g.surface, g.images[imagecount], width * 96, height * 96 ); width++; if(!( width % 8 )) { width=0; height++; } } imagecount++; for( m = 0; m < (( rand()%2 ) ); m++) { g.images[imagecount] = blank; if( testimagesatinitialization ) { BlotImage( g.surface, g.images[imagecount], width * 96, height * 96 ); width++; if(!( width % 8 )) { width=0; height++; } } imagecount++; } if( testimagesatinitialization ) { SyncRender( g.render); UpdateDisplay(g.render); } } if( !testimagesatinitialization ) { SyncRender( g.render); UpdateDisplay(g.render); } for( n = 0; n < NUM_BLURS; n++ ) { g.blurs[n] = MakeImageFile( 96, (NUM_PICS) * 96 ); g.dodges[n] = MakeImageFile( 96, (NUM_PICS) * 96 ); for( m = 0; m < NUM_IMAGES; m++ ) { idx = rand()%NUM_IMAGES; g.reel[0][m] = g.images[idx]; } Blur( g.blurs[n], g.reel[0] ); DodgeEx( g.dodges[n], g.reel[0] , 2); } for( n = 0; n < NUM_REELS; n++) { g.subsurface[n] = MakeSubImage( g.surface , REEL_OFSX + REEL_STEPX * n , REEL_OFSY , REEL_WIDTH, (96 * NUM_PICS_IN_WINDOW) ); g.testsurface[n] = MakeSubImage( g.surface, REEL_OFSX + REEL_STEPX * n + 480, REEL_OFSY , REEL_WIDTH, (96 * NUM_PICS) ); } g.statussurface = MakeSubImage( g.surface , 490, 10 , 140, 68 ); g.backgroundsurface = MakeSubImage( g.surface , 0, 0 , 640, 460 ); } g.flags.bBackgroundInitialized = 0; ThreadTo( ReadInput, 0 ); { uint32_t start = GetTickCount(); xlprintf(LOG_NOISE)("Started at %lu" , start); g.ofs = 0; while( 1 ) { if( g.flags.bSpinning ) { DrawSpinningReels(FALSE); } #ifndef __ARM__ // scale to approx unit speeds.. WakeableSleep( 250 ); //WakeableSleep( 33); #endif } } CloseDisplay( g.render ); UnmakeImageFile( g.strip ); return 0; }