restore_menu() { Pull *opull; Flicmenu *omenu; opull = cur_pull; omenu = cur_menu; cur_pull = NULL; cur_menu = NULL; set_top_lines(); cur_pull = opull; cur_menu = omenu; hide_mouse(); if (zoom_flag) { zscale_cursor = 1; draw_on_buffer(); show_mouse(); zbuf_to_screen(); } else { copy_screen(bscreen, pscreen); show_mouse(); } }
void gui_enter() { int x = 1; DIALOG_PLAYER *dp; while (keypressed()) readkey(); while (key[KEY_F11]) rest(100); gui_update(); if (curtube != 3 && !mouse_amx) install_mouse(); set_color_depth(dcol); show_mouse(screen); bemgui[0].x = (windx / 2) - 36; bemgui[0].y = windy - 8; bemgui[0].fg = makecol(255,255,255); dp=init_dialog(bemgui, 0); while (x && !key[KEY_F11] && !key[KEY_ESC]) { x = update_dialog(dp); } shutdown_dialog(dp); show_mouse(NULL); set_color_depth(8); if (curtube != 3 && !mouse_amx) remove_mouse(); while (key[KEY_F11]) rest(100); video_clearscreen(); }
/* let the user input a list of path nodes */ void input_nodes(void) { clear_to_color(screen, makecol(255, 255, 255)); textout_centre_ex(screen, font, "Click the left mouse button to add path " "nodes", SCREEN_W/2, 8, palette_color[255], palette_color[0]); textout_centre_ex(screen, font, "Right mouse button or any key to finish", SCREEN_W/2, 24, palette_color[255], palette_color[0]); node_count = 1; show_mouse(screen); do { poll_mouse(); } while (mouse_b); clear_keybuf(); for (;;) { poll_mouse(); if (mouse_b & 1) { if (node_count < MAX_NODES-1) { nodes[node_count].x = mouse_x; nodes[node_count].y = mouse_y; show_mouse(NULL); draw_node(node_count); show_mouse(screen); node_count++; } do { poll_mouse(); } while (mouse_b & 1); } if ((mouse_b & 2) || (keypressed())) { if (node_count < 3) alert("You must enter at least two nodes", NULL, NULL, "OK", NULL, 13, 0); else break; } } show_mouse(NULL); do { poll_mouse(); } while (mouse_b); clear_keybuf(); }
/* handles double-clicking on a FLIC object in the grabber */ static int view_fli(DATAFILE *dat) { show_mouse(NULL); clear_to_color(screen, gui_mg_color); play_memory_fli(dat->dat, screen, TRUE, fli_stopper); do { } while (mouse_b); clear_keybuf(); set_pallete(datedit_current_palette); show_mouse(screen); return D_REDRAW; }
/* disable_hardware_cursor: * disables the hardware cursor on platforms where this interferes with * mickeys and disables system cursors. */ void disable_hardware_cursor(void) { if ((mouse_driver) && (mouse_driver->enable_hardware_cursor)) { mouse_driver->enable_hardware_cursor(FALSE); allow_system_cursor = FALSE; if (is_same_bitmap(_mouse_screen, screen)) { BITMAP *bmp = _mouse_screen; show_mouse(NULL); show_mouse(bmp); } } }
/* set_mouse_sprite: * Sets the sprite to be used for the mouse pointer. If the sprite is * NULL, restores the default arrow. */ void set_mouse_sprite(struct BITMAP *sprite) { BITMAP *old_mouse_screen = _mouse_screen; int am_using_sys_cursor = use_system_cursor; if (!mouse_driver) return; if (_mouse_screen && !am_using_sys_cursor) show_mouse(NULL); if (sprite) mouse_sprite = sprite; else { if (_mouse_pointer) destroy_bitmap(_mouse_pointer); _mouse_pointer = create_mouse_pointer(mouse_arrow_data); mouse_sprite = _mouse_pointer; } cursors[MOUSE_CURSOR_ALLEGRO] = mouse_sprite; lock_bitmap((struct BITMAP*)mouse_sprite); /* make sure the ms bitmap is big enough */ if ((!ms) || (ms->w < mouse_sprite->w) || (ms->h < mouse_sprite->h) || (bitmap_color_depth(mouse_sprite) != bitmap_color_depth(ms))) { if (ms) { destroy_bitmap(ms); destroy_bitmap(mtemp); } ms = create_bitmap(mouse_sprite->w, mouse_sprite->h); lock_bitmap(ms); mtemp = create_bitmap(mouse_sprite->w*2, mouse_sprite->h*2); lock_bitmap(mtemp); } mouse_x_focus = 1; mouse_y_focus = 1; if (!am_using_sys_cursor) hw_cursor_dirty = TRUE; if (old_mouse_screen && !am_using_sys_cursor) show_mouse(old_mouse_screen); }
/* init: init's the element lists and allegro, returns 0 upon success * and non-zero otherwise */ int init(void) { /* init allegro */ if (allegro_init() != 0) { printf("failed to initialize..."); return 1; } set_color_depth(GFX_DEPTH); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, EDITOR_WIN_W, EDITOR_WIN_H, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Failed to init a gfxmode."); return 1; } set_window_title("GUNPOWDER MapEditor"); install_keyboard(); install_mouse(); show_mouse(screen); vscreen = create_bitmap(EDITOR_WIN_W, EDITOR_WIN_H); if (!vscreen) { close_program = 1; } /* init our lists */ load_tiles(); load_sprites(); return 0; }
static void preview_slide() /***************************************************************************** * Display the cel moving across the screen with current slide settings * until right click or key is hit. ****************************************************************************/ { int i; Rcel *cel = cs.ifi.cel; Boolean abortable = FALSE; hide_mouse(); sl_ox = cel->x; sl_oy = cel->y; for (;;) { for (i=0; i<cs.slide_frames; i++) { slide_seek(i,&abortable); check_input(ANY_INPUT); if(JSTHIT(KEYHIT|MBRIGHT)) goto OUT; wait_a_jiffy(1); } } OUT: cel->x = sl_ox; cel->y = sl_oy; conv_see_cel(cel); show_mouse(); }
static Errcode get_cut(Pixel offc, Pixel onhi, Pixel onlo) /* returns Err_abort if right click or key hit returns ZOOM_WNDOID if in zoom * window FLI_WNDOID if in fli window leaves values in icb as of last click * and iostate set to window click was in */ { Wiostate ios; Cutdata cd; int ret; if(NULL == (cd.hline = pj_malloc(vb.pencel->width + vb.pencel->height))) return(Err_no_memory); save_wiostate(&ios); cd.vline = cd.hline + vb.pencel->width; cd.wndoid = -1; cd.doneonce = 0; cd.oncol = onhi; cd.offcol = offc; vinit_marqihdr(&cd.mh,1,1); ret = anim_wait_input(KEYHIT|MBRIGHT|MBPEN,KEYHIT|MBRIGHT|MBPEN|MMOVE, cd.mh.waitcount,anim_cut,&cd); cleanup_toptext(); restore_cut(&cd); pj_free(cd.hline); if(ret < 0) rest_wiostate(&ios); else show_mouse(); return(ret); }
void update() { int x, y, z; current_view = (current_view == left_view) ? right_view : left_view; // draw complete background rectfill(current_view, 0, 0, 639, 479, BACKGROUND_COLOR); draw_sprite(current_view, new_game, NEW_GAME_BUTTON_X1, BUTTON_YOFF); draw_sprite(current_view, undo, UNDO_BUTTON_X1, BUTTON_YOFF); draw_sprite(current_view, help, HELP_BUTTON_X1, BUTTON_YOFF); draw_sprite(current_view, quit, QUIT_BUTTON_X1, BUTTON_YOFF); if(editing) { textprintf(current_view, font, 200, 2, SELECTED, "Editing: '%s' (%s)", layout_title, get_filename(editing)); textprintf(current_view, font, 200, 12, SELECTED, "%3i pieces left", n_pieces_left); } for(z = 0; z < 3; z++) for(y = 0; y < 9; y++) for(x = 0; x < 16; x++) if(board[x][y][z].value < EMPTY || editing) drawPiece(current_view, &board[x][y][z]); scroll_screen((current_view == left_view) ? 0 : SCREEN_WIDTH, 0); show_mouse(current_view); }
int main() { allegro_init(); install_mouse(); install_keyboard(); set_color_depth(16); set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0); buffer = create_bitmap( 640, 480); show_mouse(buffer); while(!key[KEY_ESC]) { shape_menu(); get_mouse_info(); circle_fill(); if(cursor_x<=110&&cursor_y<=40) { circle_empty(); } else if(cursor_x<=110&&cursor_y>=60||cursor_y<=120) { circle_fill(); } } return 0; }
void check_time(struct pathtype *path) { timecount++; if (timecount<50) return; timecount=0; oldtime=newtime; if ((newtime=time(NULL)-starttime)>oldtime) { if (mainmover=='b') blacks+=(newtime-oldtime); else whites+=(newtime-oldtime); if (options.analysis) { if (mousex>175 && mousey>120) hide_mouse(); if (mainmover=='b') { shownumber(game.blacks[game.movenum]+blacks, 260, 184); } else { shownumber(game.whites[game.movenum]+whites, 188, 184); } if (mousex>175 && mousey>120) show_mouse(); showpath(195,path); } oldtime=newtime; if (options.playstyle==CHAMPIONSHIP || options.playstyle==FIXEDTIME) { nomore=(newtime>maxtime); if (options.analysis) show_time_bar((int)newtime, (int)maxtime, (mainmover=='b')); } } }
void yes_no_box::show(char a[]) { save_video(x1,y1,x2,y2); setfillstyle(SOLID_FILL,LIGHTGRAY); hide_mouse(); bar(x1,y1,x2,y2); setfillstyle(SOLID_FILL,BLUE); bar(x1,y1,x2,y1+25); setcolor(BLACK); rectangle(x1,y1,x2,y2); line(x1,y1+25,x2,y1+25); setcolor(WHITE); outtextxy(x1+5,y1+10,a); int x=(x1+x2)/2; int y=(y1+y2)/2+50; setcolor(WHITE); line(x-100,y-10,x-60,y-10); line(x-100,y-10,x-100,y+10); setcolor(BLACK); line(x-100,y+10,x-60,y+10); line(x-60,y-10,x-60,y+10); outtextxy(x-90,y,"Yes"); setcolor(WHITE); line(x+60,y-10,x+100,y-10); line(x+60,y-10,x+60,y+10); setcolor(BLACK); line(x+60,y+10,x+100,y+10); line(x+100,y-10,x+100,y+10); outtextxy(x+70,y,"No"); show_mouse(); }
void error_box::show(char e[]) { int x=x1+25,y=y1+60; save_video(x1,y1,x2,y2); hide_mouse(); setfillstyle(SOLID_FILL,LIGHTGRAY); bar(x1,y1,x2,y2); setcolor(BLACK); rectangle(x1,y1,x2,y2); setfillstyle(SOLID_FILL,BLUE); bar(x1,y1,x2,y1+20); rectangle(x1,y1,x2,y1+20); setcolor(WHITE); outtextxy(x1+20,y1+5,"Error !"); setcolor(RED); circle(x,y,20); setfillstyle(SOLID_FILL,RED); floodfill(x,y,RED); setcolor(WHITE); line(x-5,y-5,x+5,y+5); line(x-5,y+5,x+5,y-5); setcolor(BLACK); outtextxy(x1+70,y1+40,e); setcolor(WHITE); line(x1+100,y2-40,x1+140,y2-40); line(x1+100,y2-40,x1+100,y2-20); setcolor(BLACK); line(x1+100,y2-20,x1+140,y2-20); line(x1+140,y2-40,x1+140,y2-20); outtextxy(x1+110,y2-30,"OK"); show_mouse(); }
void pur() { char ch; clrscr(); design(); show_mouse(); gotoxy(20,23); printf("Press Enter to go to MAIN MENU ..........."); textcolor(GREEN); gotoxy(25,4); cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 VIEW OF PURCHASES \xB2\xDB\xDB\xDB\xDB\xDB"); textcolor(RED); gotoxy(4,7); cprintf("PRODUCT ID. NAME. UNIT PRICE. QUANTITY. TOTAL COST"); gotoxy(4,9); printf("========================================================================"); ptr=fopen("shop.dat","rb"); while((fread(&temp,sizeof(temp),1,ptr))==1) { printf("\n \xBA %s\t\t",temp.id); printf(" %s",temp.desc); printf("\t\t$%.2f",temp.unit); printf("\t\t%d",temp.quantity); printf("\t\t $%.2f",temp.cost); } getche(); }
CAllegroDisplay::CAllegroDisplay(int width,int height,int color_depth,char *error_file) { /* Init the error log handler */ error_log = fopen(error_file,"at"); if (error_file == NULL) { error_log = stdout; PrintError("Error opening error_log file!!!\n"); } /* Init allegro graphic library */ allegro_init(); install_timer(); install_keyboard(); install_mouse(); alfont_init(); show_mouse(NULL); /* Try to init display resolution */ set_color_depth(color_depth); if (set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,width,height,0,0)) fatalError(allegro_error); set_display_switch_mode(SWITCH_PAUSE); srandom(time(0)); }
void run_game(){ /* THE GAME RUNS WITHIN THIS TRUE WHILE LOOP */ while (!0) { while(speed_limit > 0) { speed_limit --; /*============================================*/ draw_court(); // GAME STEP 1 show_mouse(court); set_mouse_range(0,0,court->w,court->h); check_keyboard_entry(); // GAME STEP 2 control_bats(); // GAME STEP 3 check_collision(); // GAME STEP 4 update_cock_position(); // GAME STEP 5 draw_bats_and_cock(); // GAME STEP 6 draw_speed_meter(); // GAME STEP 7 display_game_status(); // GAME STEP 8 draw_buffer(); // GAME STEP 9 /*============================================*/ } // Speed limiting loop ends } deinitialize_game(); }
BOOL display::SetDisplayMode(WORD _mode, WORD _width, WORD _height, BYTE _bpp) { int error = 0; set_color_depth(_bpp); if((error = set_gfx_mode(_mode, _width, _height, 0, 0)) != 0) { LogError("Error setting graphics resolution."); LogError("Allegro returned this error message: %s", allegro_error); return false; } this->back = Surface(new surface(_width, _height, _bpp)); this->_screen = Surface(new surface(::screen)); acquire_screen(); show_mouse(::screen); acquire_screen(); this->mode = _mode; this->width = _width; this->height = _height; this->bpp = _bpp; LogMessage("Screen resolution succesfully changed."); return true; }
Alleg4Display::Alleg4Display(int width, int height, int scale) : m_surface(NULL) , m_scale(0) , m_nativeCursor(kNoCursor) , m_restoredWidth(0) , m_restoredHeight(0) { unique_display = this; if (install_mouse() < 0) throw DisplayCreationException(allegro_error); if (install_keyboard() < 0) throw DisplayCreationException(allegro_error); #ifdef FULLSCREEN_PLATFORM set_color_depth(16); // TODO Try all color depths for fullscreen platforms #else set_color_depth(desktop_color_depth()); #endif if (set_gfx_mode( #ifdef FULLSCREEN_PLATFORM GFX_AUTODETECT_FULLSCREEN, #else GFX_AUTODETECT_WINDOWED, #endif width, height, 0, 0) < 0) throw DisplayCreationException(allegro_error); show_mouse(NULL); setScale(scale); #if _WIN32 subclass_hwnd((HWND)nativeHandle()); #endif }
void Game::Update() { int m_frame = 0; while(!m_done) { while(g_ticks == 0) { rest(1); } while(g_ticks > 0) { m_oldticks = g_ticks; //Updates section m_frame++; if(key[KEY_ESC]) { m_done = true; } m_player->HandleCursorLocation(); //End of Updates clear_to_color(m_buffer, makecol(50,50,50)); g_ticks--; if(m_oldticks <= g_ticks) {break;} } //Render Section textprintf_ex(m_buffer, font, 10, 10, makecol(255, 255, 255), -1, "Current Frame: %i", m_frame); m_enemy->Render(m_buffer); //End of Rendering show_mouse(screen); blit(m_buffer, screen, 0, 0, 0, 0, m_screenX, m_screenY); } }
main() { int probleme; DataDecrypt(); if ( DataCheck() != 0 ) DataClear(); linea_init(); hide_mouse(); probleme = InitTank(); if ( !probleme ) { InitSys(); _InitSys(); InitRand((int)*_Hz200 & 0x7FFF); ShowLogo(); MnRoot(); _TermSys(); TermSys(); } TermTank(probleme); show_mouse(0); return (0); }
bool VideoDriver_Allegro::ClaimMousePointer() { select_mouse_cursor(MOUSE_CURSOR_NONE); show_mouse(NULL); disable_hardware_cursor(); return true; }
bool Graphic::init() { set_color_depth(m_depth); // profondeur des couleurs 8, 16, 24 ou 32 set_uformat(U_ASCII); // pour gérer les accents allegro_init(); if (install_mouse() == -1) { std::cerr << ("Failed to install mouse") << std::endl; return false; } if (install_keyboard() != 0) { std::cerr << ("Failed to install keyboard") << std::endl; return false; } if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, m_resX, m_resY, 0, 0) != 0) { std::cerr << ("Failed to enter in graphic mode") << std::endl; return false; } set_keyboard_rate(500, 100); show_mouse(screen); return this->_imageLoadSprites(); }
int acknowledge_resize(void) { ASSERT(system_driver); ASSERT(gfx_driver); TRACE(PREFIX_I "acknowledge_resize init.\n"); if (gfx_driver->acknowledge_resize) { BITMAP *new_screen; /* Hide the mouse from current "screen" */ if (_mouse_installed) show_mouse(NULL); new_screen = gfx_driver->acknowledge_resize(); if (!new_screen) { TRACE(PREFIX_I "acknowledge_resize failed.\n"); return -1; } TRACE(PREFIX_I "acknowledge_resize succeeded.\n"); screen = new_screen; if (_al_linker_mouse) _al_linker_mouse->set_mouse_etc(); return 0; } return 0; }
void jmouse_set_cursor(CursorType type) { if (mouse_cursor_type == type) return; Theme* theme = CurrentTheme::get(); mouse_cursor_type = type; if (type == kNoCursor) { show_mouse(NULL); set_mouse_cursor(NULL); } else { show_mouse(NULL); set_mouse_cursor(theme->getCursor(type)); } dirty_display_flag = true; }
int yes_no_box::check() { int x=(x1+x2)/2; int y=(y1+y2)/2+50; get_button_press(0); if(mclick==1) { hide_mouse(); if(mx>=x-100 && mx<=x-60 && my>=y-10 && my<=y+10) { setcolor(BLACK); line(x-100,y-10,x-60,y-10); line(x-100,y-10,x-100,y+10); setcolor(WHITE); line(x-100,y+10,x-60,y+10); line(x-60,y-10,x-60,y+10); delay(100); setfillstyle(SOLID_FILL,WHITE); bar(x1,y1,x2,y2); restore_video(x1,y1,1); show_mouse(); return 1; } else if(mx>=x+60 && mx<=x+100 && my>=y-10 && my<=y+10) { setcolor(BLACK); line(x+60,y-10,x+100,y-10); line(x+60,y-10,x+60,y+10); setcolor(WHITE); line(x+60,y+10,x+100,y+10); line(x+100,y-10,x+100,y+10); delay(100); setfillstyle(SOLID_FILL,WHITE); bar(x1,y1,x2,y2); restore_video(x1,y1,1); show_mouse(); return 0; } } show_mouse(); return -1; }
set_for_jim() { WORD dummy; WORD i; Setpallete(sys_cmap); /* and now set flicker colors */ ghide_mouse(); jim_rez(); vs_clip(handle, 1, screen_bounds); show_mouse(); install_critical(); }
void Level_Select::Render() { //This draws the base background and then draws the levels the player has access to, based off their overall level blit(m_background, m_buffer, 0, 0, 0, 0, m_buffer->w, m_buffer->h); if(0 < m_playerLevel) { stretch_blit(m_level1BG, m_buffer, 0, 0, m_level1BG->w, m_level1BG->h, 75, 235, 250, 250); } if(1 < m_playerLevel) { stretch_blit(m_level2BG, m_buffer, 0, 0, m_level2BG->w, m_level2BG->h, 385, 235, 250, 250); } if(2 < m_playerLevel) { stretch_blit(m_level3BG, m_buffer, 0, 0, m_level3BG->w, m_level3BG->h, 695, 235, 250, 250); } if(3 < m_playerLevel) { stretch_blit(m_level4BG, m_buffer, 0, 0, m_level4BG->w, m_level4BG->h, 75, 550, 250, 250); } if(4 < m_playerLevel) { stretch_blit(m_level5BG, m_buffer, 0, 0, m_level5BG->w, m_level5BG->h, 385, 550, 250, 250); } if(4 < m_playerLevel) { stretch_blit(m_level6BG, m_buffer, 0, 0, m_level6BG->w, m_level6BG->h, 690, 550, 250, 250); } //The buffer is now blitted on to the screen show_mouse(NULL); blit(m_buffer, screen, 0, 0, 0, 0, m_buffer->w, m_buffer->h); show_mouse(screen); }
int main(int argc, char **argv) { allegro_init(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, SCRW, SCRH, 0, 0); install_keyboard(); install_mouse(); install_timer(); LOCK_VARIABLE(timer); LOCK_FUNCTION(timerupdate); install_int_ex(timerupdate, BPS_TO_TIMER(TIMER_BPS)); srand((unsigned)time(NULL)); set_window_title("Skat"); LOCK_FUNCTION(close_handler); set_close_button_callback(close_handler); cards = load_bitmap("images/cards.tga", NULL); game.p[0] = &human; game.p[1] = &cpu1; game.p[2] = &cpu2; human.choose_card = human_choose_card; cpu1.choose_card = cpu_choose_card; cpu2.choose_card = cpu_choose_card; human.choose_game = human_choose_game; cpu1.choose_game = cpu_choose_game; cpu2.choose_game = cpu_choose_game; human.reizen = human_reizen; cpu1.reizen = cpu_reizen; cpu2.reizen = cpu_reizen; human.schieben = human_schieben; cpu1.schieben = cpu_schieben; cpu2.schieben = cpu_schieben; human.kontra = human_kontra; cpu1.kontra = cpu_kontra; cpu2.kontra = cpu_kontra; human.name = "Stefan"; cpu1.name = "Robert"; cpu2.name = "Thomas"; human.rtext = cpu1.rtext = cpu2.rtext = NULL; human.total_points = 0; cpu1.total_points = 0; cpu2.total_points = 0; enable_hardware_cursor(); show_mouse(screen); buffered_do_dialog(main_dlg, -1); destroy_bitmap(cards); }
void a_wireframe_tween(Tween_state *tween, int frames, int speed, Pixel dit_color, Pixel dash_color, Boolean closed, int play_mode) /* Go do a wire-frame simulation of what tween move will look like so user can get a sense of what the timing will be before he goes to the pixel perfect (and slow) preview or even (gasp) to render it. */ { int i; long clock; int scale; Marqihdr mh; Errcode err = Success; Tw_tlist tlist; Short_xyz *points; int point_count; if (frames < 0) return; if ((err = ts_to_tw_list(tween, closed, &tlist)) < Success) goto OUTBUF; cinit_marqihdr(&mh,dit_color,dash_color,TRUE); hide_mouse(); clock = pj_clock_1000(); do { for (i=0; i<frames; i++) { scale = calc_time_scale(i, frames); calc_tween_points(&tlist, closed, scale, &points, &point_count); msome_vector((void *)points,point_count,mh.pdot,&mh, !closed, sizeof(Short_xyz)); err = poll_abort(); clock += speed; do wait_sync(); while (clock > pj_clock_1000()); if (clock < pj_clock_1000()) clock = pj_clock_1000(); msome_vector((void *)points, point_count,undo_marqidot,&mh, !closed, sizeof(Short_xyz)); if(err < Success) /* abort */ goto OUTLOOP; } } while (play_mode == TWEEN_LOOP); OUTLOOP: show_mouse(); OUTBUF: trash_tw_list(&tlist); softerr(err, NULL); }