⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameshell.java

📁 CreatLog luke 俄罗斯方块
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		  GAHighScoreSetScore(Entries, i, 0);		  Entries.Difficult[i] = GAPI_HIGHSCORE_UNINIT_DIFF;		  for (t = 0; t < GAPI_HIGHSCORE_USE_NAME; t++) {		      Entries.Name[i][t] = GAPI_HIGHSCORE_UNSET_CHAR;		  }	      }	  // Now the highscore list is empty again	  Entries.HighscoreListHasEntries = false;    }    /**      * This method setup a highscore list      * This method is usually called after a game have retrieved informtaion from the EEPROM      *      * @param highList The highscore list. C: was GAPI_HighscoreList_t *       * @param highEntry The entries coming from EEPROM. C: was GAPI_HighscoreEntry_t *       */    void GAHighScoreEntryCheck(GAPI_HighscoreList_t HighList, GAPI_HighscoreEntry_t Entries) {	int                    i;	int                    t;	boolean                  UnInit = false;	for (i = 0; i < GAPI_HIGHSCORE_NUMBER_OF_ENTRYS; i++)	    {		if (Entries.Score[i][0] < ' ')		    {			UnInit = true;		    }		if (HighList.DifficultType)		    {			switch (Entries.Difficult[i])			    {			    case GAM_LEVEL_VERYEASY:			    case GAM_LEVEL_EASY:			    case GAM_LEVEL_MEDIUM:			    case GAM_LEVEL_HARD:			    case GAM_LEVEL_VERYHARD:				Entries.Difficult[i] = Entries.Difficult[i];				break;			    default:				UnInit = true;			    }		    }		if ((Entries.Name[i][0] < ' ') || (Entries.Name[i][0] > 'Z'))		    {			UnInit = true;		    }		if (UnInit)		    {			GAHighScoreSetScore(Entries, i, 0);			for (t = 0; t < GAPI_HIGHSCORE_USE_NAME; t++)			    {				Entries.Name[i][t] = GAPI_HIGHSCORE_UNSET_CHAR;			    }			if (HighList.DifficultType)			    {				Entries.Difficult[i] = GAPI_HIGHSCORE_UNINIT_DIFF;			    }			else			    {				Entries.Difficult[i] = GAPI_HIGHSCORE_UNINIT_DIFF;			    }		    }	    }    }    /**      * This method sets the flags for the highscore menu options, which are used to      * determine which options are available, visible, shaded etc.      * If highscore isn't enabled, then all flags will default to zero      * using GAM_HIGHSCORE_NONE and no call to this method will be made.      *      * @param    HighScoreListEntries   Pointer to highscore list entries in memory. was pointer.      * @returns                         The byte containing the flags. was uint8.      */    int GAHighScoreCheckMenues(GAPI_HighscoreEntry_t HighScoreListEntries) {        int Flags = 0;	/*  The flags:	    #define GAM_HIGHSCORE_NONE        0	    #define GAM_HIGHSCORE_VIEW        1	    #define GAM_HIGHSCORE_CLEAR       2	    #define GAM_HIGHSCORE_SEND        4	    #define GAM_HIGHSCORE_LIST_EMPTY  8	    #define GAM_HIGHSCORE_ALL       255	*/	// This flag should always be set if there is a highscore list	Flags |= GAM_HIGHSCORE_VIEW;	// This flag is always set	// NOTE: The menu option is disabled by SET_VISIBLE if sending is not supported by the MS	Flags |= GAM_HIGHSCORE_SEND;	Flags |= GAM_HIGHSCORE_CLEAR;	if (HighScoreListEntries.HighscoreListHasEntries == false) {	    Flags |= GAM_HIGHSCORE_LIST_EMPTY; // If this is set, then the list is empty	}	return Flags;    }    /**      * This method shows a highscore list      *      * @param HighList The highscore list      * @param HighEntry The entries coming from EEPROM.      *      */    void GAHighScoreListShow(GAPI_HighscoreList_t HighList, GAPI_HighscoreEntry_t Entries) {	boolean                  Loop = true;	int                   x;	int                   y;	int                   Cnt = 0;	int                   MenuTextY;	StringBuffer          Str = new StringBuffer(20);	int cfw = GAGetCurrfontWidth();	try {	    hsForegroundImage = Image.createImage("/highscore/Image_8bit_"+Integer.toString(GAPI_HSANIM_FOREGR)+".png");	    hsBackgroundImage = Image.createImage("/highscore/Image_8bit_"+Integer.toString(GAPI_HSANIM_BACKGR)+".png");	}	catch( IOException exc ) {	    exc.printStackTrace();	}	// Send the highscore list	if (GASendHighscore == SendHighScoreList) {	    return;	}	y = 0;	MenuTextY = DISPLAY_HEIGHT - GAGetCurrfontHeight() - 2;	g.setColor(GACOLOR_WHITE);	g.fillRect(0,0,DISPLAY_WIDTH,DISPLAY_HEIGHT);	g.setColor(GACOLOR_BLACK);	// Used to be GAHighSplashAnim	y = GAPI_high_back_height;	HighList.MenuState = DoneHighScoreList;	if (HighList.ShowNrOfEntries > GAPI_HIGHSCORE_NUMBER_OF_ENTRYS)	    {		HighList.ShowNrOfEntries = GAPI_HIGHSCORE_NUMBER_OF_ENTRYS;	    }	Cnt = HighList.CurrentTopLine;	while (Loop)	    {		x = 1;		//		// A fully developt highscore line look like this		//		// 1 SOL NV 000234		//		// Fix entry position		// the '1' above		//		if (HighList.ShowPlace) {		    GAsprintf(Str, "%d ", (Cnt + 1));		}		if (Str.length() > 0) {		    g.drawString(Str.toString(), x, y, ALIGN_TOP_LEFT);		}		x += cfw + 3;		Str.delete(0,Str.length());		//		// the 'SOL' above		//		if (Cnt == HighList.CursorLine) {		    HighList.CursorX = x;		    HighList.CursorY = y;		    HighList.MenuState = InputHighscoreEntry;		}		if (HighList.ShowName) {		    Str.append(Entries.Name[Cnt]);		}		else {		    HighList.MenuState = DoneHighScoreList;		}		if (Str.length() > 0) {		    g.drawString(Str.toString(), x, y, ALIGN_TOP_LEFT);		}		x += (cfw * GAPI_HIGHSCORE_USE_NAME) + 3;		Str.delete(0,Str.length());		if (HighList.DifficultType) {		    //		    //  // the 'NV' above		    //		    switch (Entries.Difficult[Cnt])			{			case GAM_LEVEL_VERYEASY:			    Str.append("VE");			    break;			    			case GAM_LEVEL_EASY:			    Str.append(" E");			    break;			    			case GAM_LEVEL_MEDIUM:			    Str.append(" M");			    break;			    			case GAM_LEVEL_HARD:			    Str.append(" H");			    break;			case GAM_LEVEL_VERYHARD:			    Str.append("VH");			    break;			    			default:			    Str.append(" -");			}		}		else {		    if (Entries.Difficult[Cnt] == GAPI_HIGHSCORE_UNINIT_DIFF) {			Str.append("--");		    }		    else {			GAsprintf(Str, "%02d", Entries.Difficult[Cnt]);		    }		}		if (Str.length() > 0) {		    g.drawString(Str.toString(), x, y, ALIGN_TOP_LEFT);		}		x += (cfw * 2) + 3;		Str.delete(0,Str.length());		//		//  // the '000234' above		//		if (HighList.ShowScore) {		    Str.append(Entries.Score[Cnt]);		}		g.drawString(Str.toString(), x, y, ALIGN_TOP_LEFT);		y += GAGetCurrfontHeight() - 3;		Cnt++;		if ((y > MenuTextY) || (Cnt >= HighList.ShowNrOfEntries)) {		    Loop = false;		}	    }	// highscore background picture tiling...	{	    int                   w;	    int                   h;	    int                   y1;	    Image im = null;	    // No error handling =(	    try {		//System.out.println("/highscore/Image_8bit_"+Integer.toString(HighscoreIconId)+".png");		im = Image.createImage("/highscore/Image_8bit_"+Integer.toString(HighscoreIconId)+".png");		w = im.getWidth();		h = im.getHeight();		y1 = y + 2;		for (x = 0; x < DISPLAY_WIDTH; x += w) {		    for (y = y1; y < DISPLAY_HEIGHT; y += h) {			g.drawImage(im, x, y, ALIGN_TOP_LEFT);		    }		}	    }	    catch( IOException ex ) {		ex.printStackTrace();	    }	}    }    /**      * This method take care of key input and timerevents      *      * @param Event_p Key and timer events.      * @param HighList The highscore list      * @param HighEntry The entries comming from EEPROM.      *      * @return false when the user wants to leave the highscore list      *      */    boolean GAHighScoreMain(GAEvent Event_p, GAPI_HighscoreList_t HighList, GAPI_HighscoreEntry_t Entries) {	boolean Result = true;	int x;	int y;	int cfw = GAGetCurrfontWidth();	int cfh = GAGetCurrfontHeight();	/*	  #ifdef GAPI_HIGHSCORE_USE_MAC	  if (GASendHighscore == SendHighScoreList) // Send the highscore list	  {	  #ifdef _WAP_	  SendHighScoreToSite(HighList, Entries);	  #endif // #ifdef _WAP_	  GASendHighscore = DoneHighScoreList;	  Result = false;	  return Result;	  }	  #endif // #ifdef GAPI_HIGHSCORE_USE_MAC	*/	if (HighList.ShowNrOfEntries > GAPI_HIGHSCORE_NUMBER_OF_ENTRYS)	    HighList.ShowNrOfEntries = GAPI_HIGHSCORE_NUMBER_OF_ENTRYS;	switch (Event_p.type) {	case (GATimerEvent):	    GAHighPerformAnim(HighList);	    if (HighList.MenuState == InputHighscoreEntry) {		HighList.CursorBlinkRate--;		if (HighList.CursorBlinkRate < 0) {		    //		    // Ok, alter the input		    //		    HighList.CursorBlinkRate = GAPI_HIGHSCORE_SHOW_CURSOR_SPEED;		    x = HighList.CursorX + (HighList.CursorPosition * cfw);		    y = HighList.CursorY;		    g.setColor(GACOLOR_WHITE);		    g.fillRect(x, y, cfw, cfh);		    if (HighList.CursorBlink) {			HighList.CursorBlink = false;		    }		    else {			HighList.CursorBlink = true;			g.setColor(GACOLOR_BLACK);			Entries.Name[HighList.CursorLine][HighList.CursorPosition] = HighList.CursorChar;			g.drawString(new Character(Entries.Name[HighList.CursorLine][HighList.CursorPosition]).toString(), x, y, ALIGN_TOP_LEFT);		    }		}	    } // if (HighList.MenuState == InputHighscoreEntry)	    break;	case GAKeyboardEvent:	    if (Event_p.press) {		switch (Event_p.key) {		case GAPI_HIGHSCORE_INPUT_STEP_FORWARD1:		case GAPI_HIGHSCORE_INPUT_STEP_FORWARD2:		    if (HighList.MenuState == InputHighscoreEntry) {			x = HighList.CursorX + (HighList.CursorPosition * cfw);			y = HighList.CursorY;			HighList.CursorChar++;			if (HighList.CursorChar > 'Z')			    HighList.CursorChar = ' ';			if ((HighList.CursorChar > ' ') && (HighList.CursorChar < '0'))			    HighList.CursorChar = '0';			if ((HighList.CursorChar > '9') && (HighList.CursorChar < 'A'))			    HighList.CursorChar = 'A';		    }		    break;		case GAPI_HIGHSCORE_INPUT_STEP_BACKWARD1: // Step backward		case GAPI_HIGHSCORE_INPUT_STEP_BACKWARD2:		    if (HighList.MenuState == InputHighscoreEntry) {			x = HighList.CursorX + (HighList.CursorPosition * cfw);			y = HighList.CursorY;			HighList.CursorChar--;			if (HighList.CursorChar < ' ')			    HighList.CursorChar = 'Z';			if ((HighList.CursorChar < 'A') && (HighList.CursorChar > '9'))			    HighList.CursorChar = '9';			if ((HighList.CursorChar < '0') && (HighList.CursorChar > ' '))			    HighList.CursorChar = ' ';		    }		    break;		case GAPI_HIGHSCORE_INPUT_CLEAR:		    if (HighList.MenuState == InputHighscoreEntry) {			x = HighList.CursorX + (HighList.CursorPosition * cfw);			y = HighList.CursorY;			g.setColor(GACOLOR_BLACK);

⌨️ 快捷键说明

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