game_sub_menu.c

来自「智原mp3 SDK 开发包 与巨力 有mp3 wma ogg decoder」· C语言 代码 · 共 87 行

C
87
字号
/*********************************
 *    mp3_sub_menu.c
 *********************************/

#include <string.h>
#include "api.h"
#include "lcd.h"
#include "common.h"
#include "ap_common.h"
#include "display.h" 
#include "ui_menu.h"
#include "ui_pop_up_list.h"
#include "ui_slider.h"
#include "res.h"
#include "prefer.h"
#include "gameblock.h"


INT16U code main_text[4] ={GAMESTAR,GAMESPED,GAMEREP,GAMEEXIT};


static void speed_slider(void);


static void game_sub_action(UINT8 value)
{
	switch(value)
	{
		case 0:
			playGame = 1;    //start games
			menu_stop = 1;
			screen_map(SCREEN_GAME); 
			break;
		case 1:
			speed_slider();  //for game speed
			playGame = 0; 
			menu_stop = 1;	
			//screen_map(SCREEN_GAME);   		
			break;
		case 2:
			menu_stop = 1;
			playGame = 1; 
			screen_map(SCREEN_GAME);                     //restart games			
			break;
		case 3:
#ifdef dynamic_load
			api_vLoad(Code_USER1,1);
#else
			Print("Load Function\n");
#endif				
			break;
	}	
}


void game_sub_menu(void)
{
	globle_menu.total  = 3;
        globle_menu.title  = main_text;
        globle_menu.active = 0;
        globle_menu.action = game_sub_action; 
	gfx_set_bg(COLOR_WHITE);
	playGame = 0; 
	screen_map(SCREEN_MENU);
}


static void speed_action(UINT8 value)
{    	
	tUserPreference.game_speed = value;
	playGame = 1; 
    	screen_map(SCREEN_GAME);
}    	

static void speed_slider(void)
{    	
    	globle_slider.max = 5;
    	globle_slider.min = 1;
    	globle_slider.step = 1;
    	globle_slider.title=main_text[1];
    	globle_slider.value = tUserPreference.game_speed; //dark mode.
    	globle_slider.action = speed_action;
    	screen_map(SCREEN_SLIDER);
}    	


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?