示例#1
0
文件: aase.c 项目: Fomka/ufo2000
void aase_init(void)
{
  if (bitmap_color_depth(screen) == 8) {
    aase_fg_color = bestfit_color(_current_palette, 0,  0,  0);
    aase_bg_color = bestfit_color(_current_palette, 63, 63, 63);
    aase_mg_color = bestfit_color(_current_palette, 32, 32, 32);
  }
  else {
    aase_fg_color = makecol(0,   0,   0);
    aase_bg_color = makecol(255, 255, 255);
    aase_mg_color = makecol(128, 128, 128);
  }
}
示例#2
0
文件: optmenu.cpp 项目: wziard/miner
void options_menu()
{

   show_mouse(screen);
   DIALOG options_dialog[] =
   {
   /* (dialog proc)     (x)   (y)   (w)   (h)   (fg)  (bg)  (key) (flags)  (d1)  (d2)  (dp) */
      {d_bitmap_proc,     0,   0,SCREEN_W,SCREEN_H,0,255,     0,     0,      0,    0, title_back},
      {d_gamespeed_proc, 20,  10,    0,    0,    0,   0,      0,D_SELECTED,  0,    0, const_cast<char *>("gamespeed")},
      {d_slider_proc,   300,  20,   30,  440,    0, 255,      0,     0,    255,    get_config_int("MINER","BPS", 32) - 32, NULL,  (void *)speedslider_callback},
      {d_mapsize_proc,   20,  60,    0,    0,    0,   0,      0,     0,      0,    0, const_cast<char *>("mapsize")},
      {d_slider_proc,   300,  20,   30,  440,    0, 255,      0,D_HIDDEN,   80,    get_config_int("MINER","MAP_SIZE",20) - 20, NULL,  (void *)mapsizeslider_callback},
      {d_sound_proc,     20, 110,    0,    0,    0,   0,      0,     0,      0,    0, const_cast<char *>("sound")},
      {d_slider_proc,   300,  40,   30,  300,    0, 255,      0,D_HIDDEN,    6,  (int)log2(get_config_int("MINER","NR_OF_VOICES",0) + 1), NULL, (void *)soundslider_callback},
      {d_text_proc,     300,  10,  200,   30,    0, 255,      0,D_HIDDEN,    0,    0, const_cast<char *>("Nr of simultaneous sounds")},
      {d_number_proc,   330,  20,    0,    0,    0,   0,      0,     0,      3,   get_config_int("MINER","BPS", 32), NULL},
      {d_number_proc,   330,  20,    0,    0,    0,   0,      0,D_HIDDEN,    3,   get_config_int("MINER","MAP_SIZE",20) , NULL},
      {d_number_proc,   330,  40,    0,    0,    0,   0,      0,D_HIDDEN,    2,   get_config_int("MINER","NR_OF_VOICES",1), NULL},
      {d_back_proc,      20, 160,    0,    0,    0,   0,      0,     0,      0,    0, const_cast<char *>("exit menu")},
      {NULL,              0,   0,    0,    0,    0,   0,      0,     0,      0,    0,    0, NULL}
   };


   the_options_dialog = options_dialog; // ugly, but I found it easier to initialise the dialog
   // within the function, where all BITMAPS's are loaded etc.
   PALETTE options_palette;

   for (int i=0;i < 256;i++)
   {
      options_palette[i].r = game_palette[i].g;
      options_palette[i].g = game_palette[i].b;
      options_palette[i].b = game_palette[i].r;
   }
   set_dialog_color(options_dialog, bestfit_color(options_palette,0,0,0), bestfit_color(options_palette,63,63,63));


   DIALOG_PLAYER *p = init_dialog(options_dialog, 1);
   
   broadcast_dialog_message(MSG_DRAW, 0);
//   update_dialog(p);
   if (fade_speed)
   {
      fade_from(desktop_palette,options_palette,fade_speed);
   }
   else
   {
      set_palette(options_palette);
   }


   while(update_dialog(p));

   shutdown_dialog(p);

   set_config_int("MINER","BPS", options_dialog[SPEED_SLIDER].d2 + 32);
   set_config_int("MINER","MAP_SIZE", options_dialog[MAPSIZE_SLIDER].d2 + 20);
   set_config_int("MINER","NR_OF_VOICES", (1<<options_dialog[SOUND_SLIDER].d2));
   show_mouse(NULL);

   reinit();
   
   return;
}