int main(void) { /* Initialize and clear the display */ gfxInit(); gdispClear(White); /* Create the 3D window */ { GWindowInit wi; gwinClearInit(&wi); wi.show = TRUE; wi.x = (gdispGetWidth()-GL3D_WINDOW_SIZE)/2; wi.y = (gdispGetHeight()-GL3D_WINDOW_SIZE)/2; wi.width = GL3D_WINDOW_SIZE; wi.height = GL3D_WINDOW_SIZE; gh = gwinGL3DCreate(0, &wi); } /* Init the 3D stuff */ setup(); init(); while(TRUE) { // rate control gfxSleepMilliseconds(FRAME_DELAY); // move and redraw spin(); } }
int main(void) { // Initialize ChibiOS halInit(); chSysInit(); // Initialize uGFX gfxInit(); // Initialize our own stuff startupInit(); // Get the command prompt (via USB) up and running cmdCreate(); // Get the SD-Card stuff done sdcardInit(); while (true) { cmdManage(); if(SDU1.config->usbp->state == USB_ACTIVE){ gwinShow(ghImageUSB); } else { gwinHide(ghImageUSB); } // Until the statusbar widget is ready... gwinSetVisible(ghImageSDC, sdcardReady()); sdCardEvent(); chThdSleepMilliseconds(500); } }
int main(void) { coord_t swidth, sheight; gfxInit(); // Initialize the display // Get the display dimensions swidth = gdispGetWidth(); sheight = gdispGetHeight(); // Set up IO for our image #if USE_MEMORY_FILE gdispImageSetMemoryReader(&myImage, test_pal8); #else gdispImageSetSimulFileReader(&myImage, "test-pal8.bmp"); #endif gdispImageOpen(&myImage); gdispImageDraw(&myImage, 0, 0, swidth, sheight, 0, 0); gdispImageClose(&myImage); while(1) { gfxSleepMilliseconds(1000); } return 0; }
void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); // For now, use 8-bit rendering but default 24-bit framebuffer mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } // reset video modes gfxExit(); // disable console Done_ConsoleWin(); gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false); I_ClearFrameBuffer(GFX_TOP, GFX_LEFT); I_ClearFrameBuffer(GFX_TOP, GFX_RIGHT); I_ClearFrameBuffer(GFX_BOTTOM, 0); V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
int appInit(int argc, char **argv) { const char *opt; _flubAppCtx.launchedFromConsole = _appLaunchedFromConsole(); if((opt = strrchr(argv[0], PLATFORM_PATH_SEP)) != NULL) { _flubAppCtx.progName = opt; } else { _flubAppCtx.progName = argv[0]; } if((!logInit()) || (!cmdlineInit(argc, argv)) || (!flubSDLInit()) || (!flubPhysfsInit(argv[0])) || (!flubCfgInit()) || (!videoInit()) || (!texmgrInit()) || (!flubFontInit()) || (!gfxInit()) || (!audioInit()) || (!inputInit()) || (!consoleInit()) || (!flubGuiThemeInit()) ) { return 0; } return 1; }
/* * Application entry point. */ int main(void) { /* * System initializations. * - HAL initialization, this also initializes the configured device drivers * and performs the board-specific initializations. * - Kernel initialization, the main() function becomes a thread and the * RTOS is active. */ halInit(); chSysInit(); gfxInit(); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); /* * Normal main() thread activity, in this demo it does nothing. */ while (TRUE) { chThdSleepMilliseconds(500); } }
int main(void) { coord_t width, height, r1, r2, cx, cy; uint8_t sectors; // Initialize and clear the display gfxInit(); // Get the screen size width = gdispGetWidth(); height = gdispGetHeight(); // Initialize some variables r1 = width > height ? height/3 : width/3; r2 = r1*3/4; cx = width/2; cy = height/2; sectors = 1; while(1) { // Draw the arc sectors gdispClear(White); gdispDrawArcSectors(cx, cy, r1, sectors, Blue); gdispFillArcSectors(cx, cy, r2, sectors, Red); // Increase the sectors counter sectors++; // Waste some time gfxSleepMilliseconds(250); } }
int main(void) { uint8_t charmap[8]; gfxInit(); /* set cursor position and draw single characters */ tdispSetCursor(4, 0); tdispDrawChar('H'); tdispDrawChar('D'); tdispDrawChar('4'); tdispDrawChar('4'); tdispDrawChar('7'); tdispDrawChar('8'); tdispDrawChar('0'); /* draw a string to a given location */ tdispDrawStringLocation(0, 1, "chibios-gfx.com"); /* create and display a custom made character */ charmap[0] = 0b00000; charmap[1] = 0b00100; charmap[2] = 0b00010; charmap[3] = 0b11111; charmap[4] = 0b00010; charmap[5] = 0b00100; charmap[6] = 0b00000; charmap[7] = 0b00000; tdispCreateChar(0, charmap); tdispHome(); tdispDrawChar(0); while(TRUE) { gfxSleepMilliseconds(250); } }
static msg_t Thread2(void *arg) { (void)arg; chRegSetThreadName("lcd"); /* Reset */ gfxInit(); gdispClear(Black); //uint16_t width = gdispGetWidth(); //uint16_t height = gdispGetHeight(); ftfont_t ubuntu = gftOpenFont("Ubuntu Mono"); if (ubuntu == NULL) fprintf(stderr, "Failed to find font\n"); const char *msg = "ChibiOS/GFX with FreeType"; unsigned char s = 8; while (TRUE) { if (s > 30) s = 8; gdispClear(Black); gftSetFontSize(ubuntu, 16); gftDrawString(100, 100, msg, ubuntu, White); gftSetFontSize(ubuntu, 30); gftDrawString(100, 200, msg, ubuntu, White); chThdSleepMilliseconds(1000); s+=4; } }
int main(void) { GEvent* pe; // Initialize the display gfxInit(); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("*")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); // create the widget createWidgets(); // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); } return 0; }
void GameInterior::onAddToScene() { Parent::onAddToScene(); // create the interior // TODO: create a resource cache for difs DIF::DIF dif; std::string path = mInteriorFile.c_str(); std::string directory = IO::getPath(path); std::ifstream file(path, std::ios::binary); if (!dif.read(file)) { IO::printf("DIF file could not be read!\n"); return; } // load interior mInterior = dif.interior[0]; generateMaterials(directory); // make mesh generateMesh(); // cleanup file.close(); // init graphics gfxInit(); }
int main(void) { uint8_t i; font_t font1, font2; /* initialize and clear the display */ gfxInit(); /* Set some fonts */ font1 = gdispOpenFont("UI2"); font2 = gdispOpenFont("DejaVu Sans 12"); gwinSetDefaultFont(font1); /* create the three console windows */ { GWindowInit wi; wi.show = TRUE; wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2; GW1 = gwinConsoleCreate(NULL, &wi); wi.y = gdispGetHeight()/2; wi.width = gdispGetWidth()/2; wi.height = gdispGetHeight(); GW2 = gwinConsoleCreate(NULL, &wi); wi.x = gdispGetWidth()/2; wi.height = gdispGetHeight(); GW3 = gwinConsoleCreate(NULL, &wi); } /* Use a special font for GW1 */ gwinSetFont(GW1, font2); /* Set the fore- and background colors for each console */ gwinSetColor(GW1, Green); gwinSetBgColor(GW1, Black); gwinSetColor(GW2, White); gwinSetBgColor(GW2, Blue); gwinSetColor(GW3, Black); gwinSetBgColor(GW3, Red); /* clear all console windows - to set background */ gwinClear(GW1); gwinClear(GW2); gwinClear(GW3); /* Output some data on the first console */ for(i = 0; i < 10; i++) { gwinPrintf(GW1, "Hello uGFX!\r\n"); } /* Output some data on the second console */ for(i = 0; i < 16; i++) { gwinPrintf(GW2, "Message Nr.: %d\r\n", i+1); } /* Output some data on the third console */ for(i = 0; i < 18; i++) { gwinPrintf(GW3, "Message Nr.: %d\r\n", i+1); } while(TRUE) { gfxSleepMilliseconds(500); } }
int main(void) { // uint16_t i; // one wire initialization static OneWireDriver owDrv; static const OneWireConfig owCfg = { .dqPort = GPIOB, .dqPad = 10, .dqAlternate = 7, .uartd = &UARTD3 }; static OneWireRomAddress romAddr[8]; static bool_t searched = FALSE; static bool_t initialized = FALSE; // Initialize the uGFX and the underlying system gfxInit(); // Lock screen uint8_t secret_sequence[UNLOCKER_COLS * UNLOCKER_ROWS]; displayUnlockerSetup(secret_sequence); displayUnlocker(secret_sequence); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(Black); // Create the widget createWidgets(); // Print to the console gwinPrintf(ghConsole, "Witamy w konsoli!\r\n\n"); gwinPrintf(ghConsole, "Odczyt temp z czujnikow DS18B20.\r\n"); //initialize ds18b20 if (initialized == FALSE) { oneWireInit(&owDrv, &owCfg); initialized = TRUE; } if (searched == FALSE) { oneWireSearchRom (&owDrv, FALSE, romAddr, ARRAY_LEN(romAddr)); searched = TRUE; } while (1) { oneWireSearchRom (&owDrv, FALSE, romAddr, ARRAY_LEN(romAddr)); for (uint8_t i=0; i< ARRAY_LEN(romAddr); i++) { if (romAddr[i].addr[0] == 0x28) { ds1820BInit (&owDrv, &(romAddr[i]), 10); const float temp =ds1820BGetTemp (&owDrv, &(romAddr[i])); gwinPrintf(ghConsole, "czujnik %d temp =%.2f\r\n", i, temp); } } gfxSleepMilliseconds(800); } return 0; }
STATIC mp_obj_t mod_citrus_gfx_init(mp_obj_t top_format, mp_obj_t bottom_format, mp_obj_t vram_buffers) { INIT_ONCE(_mod_citrus_gfx_is_init); int top = _mod_citrus_gsp_get_framebuffer_format(top_format); int bot = _mod_citrus_gsp_get_framebuffer_format(bottom_format); gfxInit(top, bot, mp_obj_is_true(vram_buffers)); return mp_const_none; }
static bool tcInit(void) { SDL_Init(0); if (setup.Debug >= ERR_DEBUG) { pcErrOpen(ERR_OUTPUT_TO_DISK, "debug.txt"); } else { pcErrOpen(ERR_NO_OUTPUT, NULL); } InitAudio(); StdBuffer1 = TCAllocMem(STD_BUFFER1_SIZE, true); StdBuffer0 = TCAllocMem(STD_BUFFER0_SIZE, true); if (!StdBuffer0 || !StdBuffer1) { return false; } if (setup.CDAudio) { if ((CDRomInstalled = CDROM_Install())) { CDROM_WaitForMedia(); return false; } } gfxInit(); SDL_WM_SetCaption("Der Clou!", NULL); sndInit(); if (!(GamePlayMode & GP_NO_SAMPLES)) sndInitFX(); ShowIntro(); /* Start game. */ inpOpenAllInputDevs(); txtInit(AutoDetectLanguage()); AutoDetectVersion(); InitAnimHandler(); dbInit(); plInit(); gfxCollToMem(128, &StdRP0InMem); /* cache Menu in StdRP0InMem */ gfxCollToMem(129, &StdRP1InMem); /* cache Bubbles in StdRP1InMem */ CurrentBackground = BGD_LONDON; return true; }
int main(void) { gfxInit(); benchmark(); while(TRUE) { gfxSleepMilliseconds(500); } return 0; }
int main(void) { GEvent* pe; // Initialize the display gfxInit(); // Attach the mouse input gwinAttachMouse(0); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("*")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); // create the widget _createWidgets(); // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); switch(pe->type) { case GEVENT_GWIN_SLIDER: if (((GEventGWinSlider *)pe)->gwin == ghSliderR || \ ghSliderG || \ ghSliderB ) { _updateColor(); } break; case GEVENT_GWIN_BUTTON: if (((GEventGWinButton *)pe)->gwin == ghButton1) { gwinSliderSetPosition(ghSliderR, rand() % 256); } else if (((GEventGWinButton *)pe)->gwin == ghButton2) { gwinSliderSetPosition(ghSliderG, rand() % 256); } else if (((GEventGWinButton *)pe)->gwin == ghButton3) { gwinSliderSetPosition(ghSliderB, rand() % 256); } _updateColor(); default: break; } } return 0; }
static void frontend_ctr_init(void *data) { #ifndef IS_SALAMANDER (void)data; global_t *global = global_get_ptr(); global->verbosity = true; // gfxInitDefault(); gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false); gfxSet3D(false); consoleInit(GFX_BOTTOM, NULL); #endif }
int ctr_request_update(void) { gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false); gfxSet3D(false); consoleInit(GFX_BOTTOM, NULL); printf("\n\nunsupported version\n\n"); printf("Please update your playload\n"); wait_for_input(); gfxExit(); return 0; }
int main() { srvInit(); aptInit(); hidInit(NULL); irrstInit(NULL); gfxInit(); gfxSet3D(false); srand(svcGetSystemTick()); curQuote=rand()%numQuotes; superStr[0]=0; ftp_init(); int connfd=ftp_getConnection(); APP_STATUS status; while((status=aptGetStatus())!=APP_EXITING) { if(status == APP_RUNNING) { ftp_frame(connfd); drawFrame(); hidScanInput(); if(hidKeysDown()&KEY_B)break; } else if(status == APP_SUSPENDING) { aptReturnToMenu(); } else if(status == APP_SLEEPMODE) { aptWaitStatusEvent(); } gspWaitForEvent(GSPEVENT_VBlank0, false); } ftp_exit(); gfxExit(); irrstExit(); hidExit(); aptExit(); srvExit(); return 0; }
int main() { //Grab the status of the app (running, suspending, sleeping, exiting) APP_STATUS status; //Initialize 3ds services srvInit(); fsInit(); aptInit(); gfxInit(); hidInit(NULL); //Setup event handler to listen for changes in status aptSetupEventHandler(); while ((status = aptGetStatus()) != APP_EXITING) { if (status == APP_RUNNING) { //If the app is currently in the forground running, execute the program. program(); } else if (status == APP_SUSPENDING) { //If the app is currently suspended in the background, return to the home menu. aptReturnToMenu(); } else if (status == APP_SLEEPMODE) { //If the app is currently suspended in sleep mode, wait. aptWaitStatusEvent(); } //Wait for GPU gspWaitForVBlank(); } //Close all opened services. hidExit(); gfxExit(); aptExit(); srvExit(); //Kill the process. svcExitProcess(); return 0; }
void engineInit() { int err; err = SDL_Init(SDL_INIT_VIDEO); assert(!err); err = TTF_Init(); assert(!err); engine.window = SDL_CreateWindow("bored", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1024, 768, 0); assert(engine.window); mapInit(); mapSeed(rand()); gfxInit(); guiInit(); }
int main(void) { char* msg = "uGFX"; gfxInit(); /* Create a static thread from the default heap with normal priority. No parameter passed */ thd1 = gfxThreadCreate(NULL, 128, NORMAL_PRIORITY, Thread1_function, 0); /* Create a static thread from the default heap with normal priority. String parameter passed */ thd2 = gfxThreadCreate(NULL, 128, NORMAL_PRIORITY, Thread2_function, (void*)msg); while(TRUE) { gfxSleepMilliseconds(500); } }
int main(void) { font_t font1; // Initialize uGFX and the underlying system gfxInit(); // Get the fonts we want to use font1 = gdispOpenFont("Archangelsk Regular 12"); // Demonstrate our other fonts gdispDrawString(10, 10, "привет мир", font1, Yellow); // Wait forever while(TRUE) { gfxSleepMilliseconds(500); } }
int main() { Result ret=0; httpcContext context; // Initialize services srvInit(); aptInit(); hidInit(NULL); gfxInit(); //gfxSet3D(true); // uncomment if using stereoscopic 3D httpcInit(); ret = httpcOpenContext(&context, "http://10.0.0.3/httpexample_rawimg.bin", 0);//Change this to your own URL. if(ret==0) { ret=http_download(&context); httpcCloseContext(&context); } // Main loop while (aptMainLoop()) { gspWaitForVBlank(); hidScanInput(); // Your code goes here u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); } // Exit services httpcExit(); gfxExit(); hidExit(); aptExit(); srvExit(); return 0; }
/// \classmethod \constructor(skin_position) /// /// Construct an UGFX object. STATIC mp_obj_t pyb_ugfx_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) { // check arguments mp_arg_check_num(n_args, n_kw, 0, 0, false); // get LCD position //const char *lcd_id = mp_obj_str_get_str(args[0]); // create lcd object pyb_ugfx_obj_t *ugfx = m_new_obj(pyb_ugfx_obj_t); ugfx->base.type = &pyb_ugfx_type; default_font = gdispOpenFont("ui2"); //TODO: allow to be changed //gdispCloseFont(font); gfxInit(); return ugfx; }
int main(void) { // Initialize the display gfxInit(); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("*")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); // Create the widget createWidgets(); while(1) { gfxSleepMilliseconds(1000); } return 0; }
int main (int argc, char **argv) { float time, oldtime; APT_CheckNew3DS(&isN3DS); if(isN3DS) osSetSpeedupEnable(true); gfxInit(GSP_RGB565_OES,GSP_RGB565_OES,false); gfxSetDoubleBuffering(GFX_TOP, false); gfxSetDoubleBuffering(GFX_BOTTOM, false); gfxSet3D(true); consoleInit(GFX_BOTTOM, NULL); #ifdef _3DS_CIA if(chdir("sdmc:/3ds/ctrQuake") != 0) Sys_Error("Could not find folder: sdmc:/3ds/ctrQuake"); #endif static quakeparms_t parms; parms.memsize = 24*1024*1024; parms.membase = malloc (parms.memsize); parms.basedir = "."; COM_InitArgv (argc, argv); parms.argc = com_argc; parms.argv = com_argv; Host_Init (&parms); Sys_Init(); oldtime = Sys_FloatTime() -0.1; while (aptMainLoop()) { time = Sys_FloatTime(); separation_distance = osGet3DSliderState(); Host_Frame (time - oldtime); oldtime = time; } gfxExit(); return 0; }
int main(void) { coord_t width; font_t font1, font2, font3, font4; const char *msg; /* Initialize and clear the display */ gfxInit(); // Get the screen size width = gdispGetWidth(); // Get the fonts we want to use font1 = gdispOpenFont("UI2"); font2 = gdispOpenFont("UI2 Double"); font3 = gdispOpenFont("UI2 Narrow"); font4 = gdispOpenFont("LargeNumbers"); // Display large numbers on the right (measuring the string) msg = "123456"; gdispDrawString(width-gdispGetStringWidth(msg, font4)-3, 3, msg, font4, Green); // Display the font name under it. msg = gdispGetFontName(font4); gdispDrawString(width-gdispGetStringWidth(msg, font1)-3, 20, msg, font1, Green); // Demonstrate our other fonts gdispDrawString(10, 10, "Writing with Font 'UI2'", font1, Yellow); gdispFillString(10, 35, "Writing with Font 'UI2 Double'", font2, Red, White); gdispDrawStringBox(0, 50, width, 40, "Writing with Font 'UI2 Narrow'", font3, Red, justifyCenter); gdispFillStringBox(0, 90, width, 40, "Filled Centered", font3, Pink, Gray, justifyCenter); // Clean up the fonts gdispCloseFont(font1); gdispCloseFont(font2); gdispCloseFont(font3); gdispCloseFont(font4); // Wait forever while(TRUE) { gfxSleepMilliseconds(500); } }
int pascal WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR, int cmdShow) { #else int main(int argc, char* argv[]) { #endif g_game = new CGame(WORLD_GRANULARITY, WORLD_PEAKS, PREY_NUM, PREDATOR_NUM); g_game->m_time->setSpeed(s_speed); glutInit(&argc, argv); gfxInit(); glutDisplayFunc(doDisplay); glutIdleFunc(doLoop); glutMouseFunc(doMouseButtons); glutMotionFunc(doMouseMove); glutPassiveMotionFunc(doMouseMove); glutKeyboardFunc(doKeyboard); glutMainLoop(); delete g_game; // automatically destroys all registered agents }