Пример #1
0
void roadmap_main_add_menu_item (RoadMapMenu menu,
                                 const char *label,
                                 const char *tip,
                                 RoadMapCallback callback) {
#ifdef RIMAPI
   if (label != NULL)
   {
	   NOPH_FreemapMainScreen_addMenuItem(RimScreen, label, 1, 1, (int)(void *)menu_wrapper, (int)(void *)callback,0);
   }
   else
   {
	   NOPH_FreemapMainScreen_addMenuItemSeparator(RimScreen, 1);
   }

#else
   NOPH_CommandMgr_t cm = NOPH_CommandMgr_getInstance();
   NOPH_CommandMgr_addCommand(cm, label, (void *)callback);
#endif
}
Пример #2
0
static int cibyl_init_vidmode ()
{
  NOPH_CommandMgr_t cmd_mgr = NOPH_CommandMgr_getInstance();
  int i;

  screen = calloc(GFX_WIDTH*GFX_HEIGHT * 4, sizeof(int));
  NOPH_Canvas_registerKeyPressedCallback(keyPressed);
  NOPH_Canvas_registerKeyReleasedCallback(keyReleased);

  canvas = NOPH_GameCanvas_get();
  graphics = NOPH_GameCanvas_getGraphics(canvas);

  screen_width = NOPH_Canvas_getWidth(canvas);
  screen_height = NOPH_Canvas_getHeight(canvas);

  if (screen_width > 176 && screen_height > 210)
    cibyl_set_screen_size(STRETCHED_VERTICALLY);
  else if (screen_width >= GFX_WIDTH * 2)
    cibyl_set_screen_size(DOUBLE_SIZE);
  else
    cibyl_set_screen_size(NORMAL);

  NOPH_Graphics_setColor_int(graphics, 0xff666666);
  NOPH_Graphics_fillRect(graphics, 0, 0, screen_width, screen_height);
  NOPH_Graphics_setColor_int(graphics, 0);
  NOPH_GameCanvas_flushGraphics_rect(canvas, 0, 0, screen_width, screen_height);
  font = NOPH_Graphics_getFont(graphics);

  for ( i = 0; i < 16; i++ )
    {
      int r = palette[ i * 3 ];
      int g = palette[ i * 3 + 1];
      int b = palette[ i * 3 + 2];

      rgb_palette[i+16] = (0xff << 24) | (r << 16) | (g << 8) | b;
      rgb_palette[i] = (0xff << 24) | ((r*4) << 16) | ((g*4) << 8) | (b*4);
    }

  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Esc", key_callback, (void*)KEY_ESCAPE);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "About", about_callback, NULL);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Sound on/off", bind_key_callback, (void*)3);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Clear FS root", cibyl_clear_fs_root, NULL);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Toggle display size", toggle_display_size_callback, NULL);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Switch s9/num/Fn", bind_key_callback, (void*)2);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Unbind 1", bind_key_callback, (void*)0);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind Alt-X -> 1", bind_key_callback, (void*)(scancode_table['X'-'A'] << 8));
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f1 -> 1", bind_key_callback, (void*)0x3b00);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f2 -> 1", bind_key_callback, (void*)0x3c00);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f3 -> 1", bind_key_callback, (void*)0x3d00);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f4 -> 1", bind_key_callback, (void*)0x3e00);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f5 -> 1", bind_key_callback, (void*)0x3f00);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f6 -> 1", bind_key_callback, (void*)0x4000);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f7 -> 1", bind_key_callback, (void*)0x4100);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f8 -> 1", bind_key_callback, (void*)0x4200);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f9 -> 1", bind_key_callback, (void*)0x4300);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind f10 -> 1", bind_key_callback, (void*)0x4400);
  NOPH_CommandMgr_addCommand(cmd_mgr, NOPH_Command_ITEM, "Bind 31 -> 1", bind_key_callback, (void*)1);

  s9_input_init(&sarien_s9);

  return 0;
}