示例#1
0
void input_menu(void)
{
	NOPH_List_t input_menu_list;
        NOPH_Display_t display = NOPH_Display_getDisplay(NOPH_MIDlet_get());
        NOPH_Displayable_t cur = NOPH_Display_getCurrent(display);
        NOPH_CommandMgr_t cm = NOPH_CommandMgr_getInstance();
        mm_args_t args;
        int i;
        const char *list[] = { "F1", "F3", "F5", "F7",
                               "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
                               "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
                               "N", "O", "P", "Q", "R", "S", "T", "U", "V", "X", "Y", "Z" };

        input_menu_list = NOPH_List_new("Choose option", NOPH_Choice_IMPLICIT);
        NOPH_Display_setCurrent(display, input_menu_list);

        for (i = 0; i < sizeof(list) / sizeof(const char *); i++)
                NOPH_List_append(input_menu_list, list[i], 0);


        /* Setup the callback args */
        args.selected = 0;
        args.menu_list = input_menu_list;
        NOPH_CommandMgr_setList(cm, input_menu_list, input_menu_callback, &args);

        while(args.selected == 0)
        {
                NOPH_Thread_sleep(250);
        }

        NOPH_Display_setCurrent(display, cur);
        NOPH_delete(input_menu_list);
}
示例#2
0
char *cibyl_select_game(char *base_dir)
{
        NOPH_Display_t display = NOPH_Display_getDisplay(NOPH_MIDlet_get());
        NOPH_Displayable_t cur = NOPH_Display_getCurrent(display);
        NOPH_CommandMgr_t cm = NOPH_CommandMgr_getInstance();
        char **p;

        all_games = read_directory(get_current_directory());
        if (!all_games)
                return NULL;

        game_list = NOPH_List_new("Select game", NOPH_Choice_IMPLICIT);

        for (p = all_games; *p; p++)
        {
                NOPH_List_append(game_list, *p, 0);
        }
        NOPH_Display_setCurrent(display, game_list);

        printf("Setting list\n");

        NOPH_CommandMgr_setList(cm, game_list, select_game_callback, NULL);

        while(selected_game == NULL)
        {
                NOPH_Thread_sleep(250);
        }
        free(all_games);

        NOPH_Display_setCurrent(display, cur);
        NOPH_delete(game_list);
        game_list = 0;

        return get_game_directory(selected_game);
}
示例#3
0
const char *cibyl_select_fs_root(void)
{
	NOPH_Display_t display = NOPH_Display_getDisplay(NOPH_MIDlet_get());
	NOPH_Displayable_t cur = NOPH_Display_getCurrent(display);
	NOPH_CommandMgr_t cm = NOPH_CommandMgr_getInstance();
	NOPH_Enumeration_t en = NOPH_FileSystemRegistry_listRoots();
	FILE *conf;
	int i = 0;

	fs_root = NULL;

	fs_list = NOPH_List_new("Select fs root", NOPH_Choice_IMPLICIT);

	while (NOPH_Enumeration_hasMoreElements(en))
	{
		NOPH_Object_t o = NOPH_Enumeration_nextElement(en);

		NOPH_String_toCharPtr(o, roots[i], 40);
		NOPH_List_append(fs_list, roots[i], 0);
		NOPH_delete(o);
		i++;
	}
	NOPH_delete(en);
	NOPH_Display_setCurrent(display, fs_list);
	NOPH_CommandMgr_setList(cm, fs_list, select_fs_callback, NULL);

	while(fs_root == NULL)
	{
		NOPH_Thread_sleep(250);
	}
#if 0
	conf = fopen("recordstore://sarien-conf:1", "w");
	if (conf)
	{
		char buf[40];

		strncpy(buf, fs_root, 40);
		fwrite(buf, 1, 40, conf);
		fclose(conf);
	}
#endif
	NOPH_Display_setCurrent(display, cur);
	NOPH_delete(fs_list);

        return fs_root;
}
示例#4
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
}
示例#5
0
void cibyl_main_menu(void)
{
	NOPH_List_t main_menu_list;
        NOPH_Display_t display = NOPH_Display_getDisplay(NOPH_MIDlet_get());
        NOPH_Displayable_t cur = NOPH_Display_getCurrent(display);
        NOPH_CommandMgr_t cm = NOPH_CommandMgr_getInstance();
        mm_args_t args;
        char buf[80];

        main_menu_list = NOPH_List_new("Choose option", NOPH_Choice_IMPLICIT);

        snprintf(buf, 80, "Swap joysticks (now port %d)", ThePrefs.JoystickSwap ? 1 : 2);
        NOPH_List_append(main_menu_list, buf, 0);
        NOPH_List_append(main_menu_list, "Bind space to GAME_B", 0);
        NOPH_List_append(main_menu_list, "Bind RunStop to GAME_B", 0);
        NOPH_List_append(main_menu_list, "Bind Return to GAME_B", 0);
        NOPH_List_append(main_menu_list, "Bind other to GAME_B", 0);
        NOPH_List_append(main_menu_list, "Load from disk", 0);
        NOPH_List_append(main_menu_list, "Load from tape", 0);
        NOPH_Display_setCurrent(display, main_menu_list);

        /* Setup the callback args */
        args.selected = 0;
        args.menu_list = main_menu_list;
        NOPH_CommandMgr_setList(cm, main_menu_list, main_menu_callback, &args);

        while(args.selected == 0)
        {
                NOPH_Thread_sleep(250);
        }

	if (args.selected == 2)
		input_menu();

        NOPH_Display_setCurrent(display, cur);
        NOPH_delete(main_menu_list);
}
示例#6
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;
}