void get_ready(void) { menu_init(); #if DEBUG uart_puts_p(PSTR("menu_init() Completed! \n")); #endif LED_on(LED_0); LED_on(LED_1); LED_on(LED_2); LED_on(LED_3); set_screen(SPLASH_SCN); _delay_ms(2000); gps_set_arg(); LED_off(LED_0); LED_off(LED_1); LED_off(LED_2); LED_off(LED_3); set_screen(READY_SCN); menu_start(); }
void LCD_task(void) { if(gps_avlb) { if(gps_msg_ready) { gps_msg_ready++; #if DEBUG print_gps_msg(); #endif //if(1) if(gps_state == 'A') { if(timer1_flag) { timer1_flag++; switch_scn_flag(0); } set_screen(GPS_MAIN_SCN); } else { LED_on(LED_3); set_screen(GPS_UPDATE_SCN); } } } }
void toggle_fullscreen() { BITMAP *bmp = set_screen(is_windowed_mode()); if (bmp->w == virt_screen->w) destroy_bitmap(bmp); else { if (bmp->w > virt_screen->w) { int h = 400; if (in_menu) { blit(virt_screen, screen, 0, 384, 0, 464, 512, 16); h = 384; } blit(virt_screen, bmp, 0, 0, 64, 0, 512, h); curs_x += 8; } else { blit(virt_screen, bmp, 64, 0, 0, 0, 512, 400); curs_x -= 8; } margin_x = getmargin_x(); destroy_bitmap(virt_screen); virt_screen = bmp; } refresh_needed = 1; refreshscreen(); }
void Key_task(void) { key_scan(); if(keycode != KEY_NULL) { if(scn_mode == GPS_MAIN_SCN) { switch(keycode) { case KEY_UP: case KEY_DOWN: switch_scn_flag(0); set_screen(GPS_MAIN_SCN); break; case KEY_LEFT: save_position(); break; case KEY_OK: case KEY_CANCEL: menu_start(); break; default: break; } } } }
nubus_xceed30hr_device::nubus_xceed30hr_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), device_video_interface(mconfig, *this), device_nubus_card_interface(mconfig, *this), m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr) { set_screen(*this, XCEED30HR_SCREEN_NAME); }
void init_env(t_env *e) { e->p.x = -0.5; e->p.y = -0.5; e->p.z = 4.0; set_cam(e); set_screen(e); e->ray.origin = e->cam; }
nubus_procolor816_device::nubus_procolor816_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), device_video_interface(mconfig, *this), device_nubus_card_interface(mconfig, *this), m_vram32(nullptr), m_mode(0), m_vbl_disable(0), m_toggle(0), m_count(0), m_clutoffs(0), m_timer(nullptr), m_assembled_tag(util::string_format("%s:%s", tag, PROCOLOR816_SCREEN_NAME)) { set_screen(m_assembled_tag.c_str()); }
nubus_lview_device::nubus_lview_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), device_video_interface(mconfig, *this), device_nubus_card_interface(mconfig, *this), m_vram32(nullptr), m_vbl_disable(0), m_toggle(0), m_timer(nullptr), m_protstate(0), m_assembled_tag(util::string_format("%s:%s", tag, LVIEW_SCREEN_NAME)) { set_screen(m_assembled_tag.c_str()); }
void textgfx_init() { #ifdef UNIX strcpy(_xwin.application_name, "vitetris"); strcpy(_xwin.application_class, "Vitetris"); #endif if (install_allegro(SYSTEM_AUTODETECT, &errno, NULL) != 0) exit(1); #ifdef UNIX sigaction(SIGINT, NULL, &allegro_sigint_handler); signal(SIGINT, sigint_handler); #endif load_pc8x16_font(); set_window_title(VITETRIS_VER); set_close_button_callback(close_btn); #ifndef UNIX /* Seems to cause seg fault later quite randomly on Linux */ int depth = desktop_color_depth(); if (depth != 0) set_color_depth(depth); #endif virt_screen = set_screen(getopt_int("", "fullscreen")); lang |= LATIN1; if (!font8x16) { font8x16 = font; textgfx_flags |= ASCII; } setattr_normal(); #if WIN32 && !ALLEGRO_USE_CONSOLE if (exists("stdout.tmp")) { FILE *fp; freopen("stdout2.tmp", "w", stdout); fp = fopen("stdout.tmp", "r"); if (fp) { char line[80]; int i; for (i=0; i < 25 && fgets(line, 80, fp); i++) { setcurs(0, i); i += printline(line); } fclose(fp); if (i) { refreshscreen(); if (!strncmp(line, "Press ", 6)) { install_keyboard(); clear_keybuf(); readkey(); remove_keyboard(); } } } freopen("stdout.tmp", "w", stdout); delete_file("stdout2.tmp"); } #endif }
sms_light_phaser_device::sms_light_phaser_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SMS_LIGHT_PHASER, tag, owner, clock), device_video_interface(mconfig, *this), device_sms_control_port_interface(mconfig, *this), m_lphaser_pins(*this, "CTRL_PORT"), m_lphaser_x(*this, "LPHASER_X"), m_lphaser_y(*this, "LPHASER_Y"), m_sensor_last_state(0), m_lphaser_timer(nullptr) { // Workaround for failed validation that occurs when running on a driver // with Sega Scope emulation, which adds 2 screens (left/right lenses). set_screen(*this, ":screen"); }
int shell(int argc, char ** argv) { /* Buffer de almacenamiento de caracteres */ char in_buffer[MAX_CHARS]; set_screen(); clear_screen(); welcome(); while(1) { prompt(); getline(in_buffer,MAX_CHARS); // proceso el comando almacenado en in_buffer bash(in_buffer); } return 1 ; }
void runReplay(char *name) { printf("Loading replay: %s\n", name); Replay replay = loadReplay(name); if (replay.items>0) { //GameInfo info; replayRunning = 1; SCREEN *screen = get_screen(SCREEN_GAME); GameInfo *info = screen->data; info->passage = passages[replay.passage]; info->passageID = replay.passage; info->time = replay.time; set_screen(screen); //setEventHandler(gameEvent, &info); thread = SDL_CreateThread(replay_thread, "replay", (void*)(&replay)); } }
void balance_reset() { set_screen(&screen_start); }
uint8_t init(void) { uint8_t result; uart_init(); #if DEBUG uart_puts_p(PSTR("INIT Started! \n\n")); uart_puts_p(PSTR("uart_init() Completed! \n")); #endif LED_init(); #if DEBUG uart_puts_p(PSTR("LED_init() Completed! \n")); #endif key_init(); #if DEBUG uart_puts_p(PSTR("key_init() Completed! \n")); #endif LCD_Init(); #if DEBUG uart_puts_p(PSTR("LCD_Init() Completed! \n")); #endif set_screen(BOOT_SCN); _delay_ms(100); set_screen(BOOT_SCN); _delay_ms(100); set_screen(BOOT_SCN); _delay_ms(100); set_screen(BOOT_SCN); _delay_ms(100); gps_init(); #if DEBUG uart_puts_p(PSTR("gps_init() Completed! \n")); #endif set_screen(BOOT_SCN); _delay_ms(100); timer0_init(); #if DEBUG uart_puts_p(PSTR("timer0_Init() Completed! \n")); #endif set_screen(BOOT_SCN); _delay_ms(100); timer1_init(); #if DEBUG uart_puts_p(PSTR("timer1_Init() Completed! \n")); #endif set_screen(BOOT_SCN); _delay_ms(100); result = sdreader_init(); if(result) { #if DEBUG uart_puts_p(PSTR("ERROR : sdreader_init()")); uart_putc_hex(result); uart_puts_p(PSTR("\n\r")); #endif return result; } #if DEBUG else uart_puts_p(PSTR("sdreader_init() copmleted! \n\r")); #endif set_screen(BOOT_SCN); _delay_ms(100); sei(); set_screen(BOOT_SCN); _delay_ms(500); return 0; }
int main() { const int field_width = 2; const int field_height = 2; const int win_width = 500; const int win_height = 500; bots bots(field_width, field_height); bots.generate(2, 2); bot_client ia(bots); /* initialize SDL */ SDL_Init(SDL_INIT_VIDEO); /* Quit SDL properly on exit */ atexit(SDL_Quit); /* set the title bar */ SDL_WM_SetCaption("bots", "bots"); SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); /* create window */ set_screen(win_width, win_height, field_width, field_height); glShadeModel( GL_SMOOTH ); SDL_Event event; bool gameover = false; Uint32 previous_time = SDL_GetTicks(); int acc_time = 0; /* message pump */ while (!gameover) { /* look for an event */ if (SDL_PollEvent(&event)) { /* an event was found */ switch (event.type) { /* close button clicked */ case SDL_QUIT: gameover = true; break; /* handle the keyboard */ case SDL_KEYDOWN: switch (event.key.keysym.sym) { case SDLK_ESCAPE: case SDLK_q: gameover = true; break; } break; // resizing case SDL_VIDEORESIZE: set_screen(event.resize.w, event.resize.h, field_width, field_height); break; } } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); Uint32 current_time = SDL_GetTicks(); Uint32 delta = current_time - previous_time; previous_time = current_time; acc_time += delta; // one step each n milliseconds if (acc_time > 150) { ia.perform(5); bots.step(); //bots.clean(); acc_time = 0; } bots.for_each_bot([&bots] (const bot & the_bot) { auto t = the_bot.get_team() + 1; glColor3f(t * 0.1, t * 0.3, t * 0.5); const bot::position & pos = the_bot.get_position(); // WARNING deprecated OpenGL! glLoadIdentity(); glTranslatef(pos.first, pos.second, 0); glBegin(GL_QUADS); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glEnd(); } ); SDL_GL_SwapBuffers(); gameover = gameover || bots.game_over(); } if(bots.game_over()) { if(bots.bot_count().size() != 1) { std::cout << "it's a tie!" << std::endl; } else { for(auto kv : bots.bot_count()) { std::cout << kv.first << " wins!" << std::endl; } } } /* cleanup SDL */ SDL_Quit(); return 0; }
static void cmd_execute_real(int c, int caller, char *name, int type) { cmd_stack_push(); s->caller = caller; parse_cmd(name, -1); cmd_t *cmd = NULL; int cmds = 0; while ((cmd = cmd_find(cmd, c, type, qfalse)) != NULL) { cmds++; int start = c; int end = c; qboolean switch_screen = qfalse; int old_type = type; if (cmd_type_compatible(cmd->type, type)) type = cmd->type; if ((type == CT_BROADCAST || type == CT_CVAR) && c < 0) { start = 0; end = CLIENTS - 1; } else if (type == CT_BROADCAST_ALL) { start = -1; end = CLIENTS - 1; } else if (type == CT_FIND_FREE && c < 0) { int i; qboolean found = qfalse; for (i = 0; i < CLIENTS && !found; i++) { if (!client_active(i)) { start = i; end = i; found = qtrue; switch_screen = qtrue; break; } } if (!found) { ui_output(c, "No free client found.\n"); cmd_stack_pop(); return; } } for (s->client = start; s->client <= end; s->client++) { if (type == CT_SERVER) client_command(s->client, "%s", cmd_args(0)); else cmd->f(); if (switch_screen) set_screen(s->client + 1); } type = old_type; } if (cmds == 0) { if (cmd_type_compatible(type, CT_PUBLIC)) { if (cmd_argv(0)[0]) client_say(c, "Unknown command: \"%s\"", cmd_argv(0)); } else if (!cmd_type_compatible(type, CT_EVENT)) { ui_output(c, "Unknown command: \"%s\"\n", cmd_argv(0)); } cmd_stack_pop(); return; } cmd_stack_pop(); }