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

📄 gamecanvas.java

📁 J2ME的游戏原代码!希望能帮助有需要帮助的师兄弟们!
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * other than authentication failure.
     */
    private final int HTTP_FAILED_TITLE_STR = 65;

    /**
     * Index for the second part of the message displayed
     * when the high scores upload fails due to a reson
     * other than authentication failure.
     */
    private final int HTTP_FAILED_STR_2 = 66;

    /**
     * Index for the third part of the message displayed
     * when the high scores upload fails due to a reson
     * other than authentication failure.
     */
    private final int HTTP_FAILED_STR_3 = 67;

    /**
     * Index for the title of the screen displayed
     * when the high scores upload fails
     * due to authentication failure.
     */
    private final int HTTP_AUTHENTICATION_ERROR_TITLE_STR = 68;

    /**
     * Index for the first part of the message displayed
     * when the high scores upload fails
     * due to authentication failure.
     */
    private final int HTTP_AUTHENTICATION_ERROR_STR_1 = 69;

    /**
     * Index for the second part of the message displayed
     * when the high scores upload fails
     * due to authentication failure.
     */
    private final int HTTP_AUTHENTICATION_ERROR_STR_2 = 70;

    /**
     * Index for the third part of the message displayed
     * when the high scores upload fails
     * due to authentication failure.
     */
    private final int HTTP_AUTHENTICATION_ERROR_STR_3 = 71;

    /**
     * Index for the label of the "Cancel" command.
     * This index is public because it is accessed by the ProgressForm object.
     */
    public final int CANCEL_STR = 72;

    /**
     * Index for the title of the form that indicates to the user that the
     * upload of their highscores is in progress.
     * This index is public because it is accessed by the ProgressForm object.
     */
    public final int HIGHSCORES_UPLOAD_PROGRESS_TITLE_STR = 73;

    /**
     * Index for the string displayed to the user to indicate the upload of
     * highscores is in progress.
     * This index is public because it is accessed by the ProgressForm object.
     */
    public final int HIGHSCORES_UPLOAD_PROGRESS_STR = 74;

    /**
     * Index for the title of the form that indicates to the user that the
     * highscore upload was cancelled by the user.
     */
    private final int HTTP_UPLOAD_CANCELLED_TITLE_STR = 75;

    /**
     * Index for the message displayed when the highscores upload is
     * cancelled by the user.
     */
    private final int HTTP_UPLOAD_CANCELLED_STR = 76;

    /**
     * Index for the third part of the message displayed
     * when the highscores get uploaded successfully.
     */
    private final int HTTP_SUCCESS_STR_4 = 77;


    /**
     * To make the splash animation and the highscore screen dynamically
     * adaptable to any screen size, the coordinates used for the same are
     * provided for an arbitrarily standardized screen size of 128 x 128.
     * The number 128 is chosen since it can be expressed as a power of 2.
     * When converting the relative coordinate to the absolute one for
     * the screen size of the actual device, this enables division by 128 to
     * be replaced by a bit-shifting operation. The number 128 was chosen
     * over other powers of 2 (64, 256 etc) as it is the nearest number to
     * 100, and provides a rough estimate of the relative position of
     * the given coordinate on the screen.
     */
    // 128 = 2 ^ 7
    private final int TWOS_EXPONENT_FOR_STANDARD_SCREEN_DIMENSION = 7;

    /**
     * Half of the standard screen dimension.
     * While converting the relative coordinate to the absolute one,
     * this number is added to the dividend before the division operation,
     * to convert the (default) integer truncation operation into an
     * rounding-off operation.
     */
    private final int HALF_OF_STANDARD_SCREEN_DIMENSION = 64;

    /**
     * The data about each character's location and movement
     * in the splash animation. Each row in this two-dimensional array
     * corresponds to a character. The first row corresponds to Erix,
     * and the next four rows correespond to the four enemies.
     * The meanings of the columns are:
     * Col 0: Current X coordinate
     * Col 1: Current Y coordinate
     * Col 2: X increment
     * Col 3: Y increment
     * Col 4: Final X coordinate
     * Col 5: Final Y coordinate
     * Col 6: The type (1-4) of the enemy, or 0 if Erix.
     */
    // Coordinates expressed as pseudo-percentage (unit per 128, not per 100)
    // of the screen width and height
    private int m_arrSplashCharacters[][] = {
											{0, 0,  0, -2,  98, 96, 0},
											{0, 0, -2, +2,  20, 55, 1},
											{0, 0, +1,  0,  48, 55, 2},
											{0, 0, +2, -2,  77, 55, 3},
											{0, 0, +2, +2, 105, 55, 4}
										};


    /**
     * The iteration number of the animation loop at which phase 1 of the splash screen animation ends.
     */
    private final int SPLASH_PHASE1_END = 45;

    /**
     * The iteration number of the animation loop at which phase 2 of the splash screen animation ends.
     */
    private final int SPLASH_PHASE2_END = 90;

    /**
     * The iteration number of the animation loop at which phase 3 of the splash screen animation ends.
     */
    private final int SPLASH_PHASE3_END = 165;

    /**
     * The iteration number of the animation loop at which phase 4 of the splash screen animation ends.
     */
    private final int SPLASH_PHASE4_END = 225;

    /**
     * Contains the coordinates of the top-left and
     * bottom-right vertices of all clip rectangles used
     * during phase 4 of the splash animation.
     * The values are based on a standard screen size of 128 x 128,
     * and are scaled to the actual screen size, before use.
     */
	private int m_arrSplashRectangles[][] = {
											{9,24,20,95}, // "E"
											{21,24,32,35},
											{21,55,26,66},
											{21,84,32,95},
											{37,24,48,95}, // "R"
											{49,24,56,35},
											{56,24,61,60},
											{62,27,65,58},
											{49,55,56,66},
											{54,66,61,95},
											{62,68,65,95},
											{70,24,81,95}, // "I"
											{88,24,99,55}, // "X"
											{105,24,116,55},
											{88,64,99,95},
											{105,64,116,95},
											{96,51,108,71}
										};


    /**
     * The current number of iterations elapsed in the animation loop.
     */
    private int m_nSplashAnimationLoopsElapsed;

    /**
     * The current phase of the splash animation
     */
    private int nSplashAnimationPhase = 1;

    /**
     * The number of iterations skipped at the current position
     * of the character, during the splash animation.
     */
    private int m_nSplashMovementSkipCounter;

    /**
     * The number of iterations to skip per movement of the characters,
     * during the splash animation.
     */
    private final int SPLASH_ITERATIONS_SKIP = 2; // Move every 3-th iteration.

    /**
     * X coordinate of the previous-to-previous vertex processed
     * during phase 3 of the splash animation.
     */
    private int m_nXZero;

    /**
     * Y coordinate of the previous-to-previous vertex processed
     * during phase 3 of the splash animation.
     */
    private int m_nYZero;

    /**
     * X coordinate of the previous vertex processed
     * during phase 3 of the splash animation.
     */
    private int m_nXOne;

    /**
     * Y coordinate of the previous vertex processed
     * during phase 3 of the splash animation.
     */
    private int m_nYOne;

    /**
     * X coordinate of the current vertex being processed
     * during phase 3 of the splash animation.
     */
    private int m_nXTwo;

    /**
     * Y coordinate of the current vertex being processed
     * during phase 3 of the splash animation.
     */
    private int m_nYTwo;

    /**
     * The serial number of the current shape being drawn
     * in phase 3 of the splash animation.
     */
    private int m_nCurrentShape;

    /**
     * The total number of vertices available to draw lines between,
     * during phase 3 of the splash animation.
     */
    private int m_nNumVertices;

    /**
     * The current vertex number being used,
     * during phase 3 of the splash animation.
     */
    private int m_nCurrentVertex;

     /**
      * Vertices used in phase 3 of the splash animation.
      * The values are based on a standard screen size of 128 x 128,
      * and are scaled to the actual screen size while drawing.
      */
    private short m_arrSplashAnimVertices[][][] = {
                                    				{           // Lower and middle-right part of "E"
                                    					{8,96},
                                    					{32,96},
                                    					{32,83},
                                    					{21,83},
                                    					{21,66},
                                    					{26,66},
                                    					{26,54}
                                    				},

                                    				{           // Inner rectangle of "R"
                                    					{49,54},
                                    					{49,36},
                                    					{56,36},
                                    					{56,54},
                                    					{49,54}
                                    				},

                                    				{           // Right part of upper curve of "R"
                                    					{37,24},
                                    					{62,24},
                                    					{62,26},
                                    					{66,26},
                                    					{66,59}
                                    				},

                                    				{           // Upper half of "X"
                                    					{88,56},
                                    					{88,24},
                                    					{100,24},
                                    					{100,51},
                                    					{104,51},
                                    					{104,24},
                                    					{117,24},
                                    					{117,56},
                                    					{109,56}
                                    				},

                                        			{            // The indentation between the upper and lower right parts fo "R".
                                    	       			{66,59},
                                    		      		{62,59},
                                    			     	{62,61},
                                    				    {56,61},
                                    				    {56,66},
                                    				    {62,66},
                                    				    {62,68},
                                    				    {66,68}
                                    			},
                                    			{                // Lower and Left edges of "I"
                                    	   	          	{82,96},
                                            	       	{69,96},
                                    				    {69,24}
                                    			},
                                    			{                // Lower left boundary of "X"
                                    				    {88,96},
                                    				    {88,64},
                                    				    {96,64},
                                    				    {96,56},
                                    				    {88,56}
                                    			},
                                    			{                // Top and Right edges of "I"
                                    				    {69,24},
                                    				    {82,24},
                                    				    {82,96}
                                    			},

                                    			{                // The left and lower-right vertical bars of "R"
                                    				    {66,68},
                                    				    {66,96},
                                    				    {53,96},
                                    				    {53,67},
                                    				    {49,67},
                                    				    {49,96},
                                    				    {37,96},
                                    				    {37,24}
                                    			},

                                    			{                // Left and upper-right part of "E"
                                    				    {26,54},
                                    				    {21,54},
                                    				    {21,36},
                                    				    {32,36},
                                    				    {32,24},
                                    				    {8,24},
                                    				    {8,96}
                                    			},
                                    			{                // Lower Right boundaries of "X"
                                    				    {109,56},
                                    				    {109,64},
                                    				    {117,64},
                                    				    {117,96},
                                    				    {104,96},
                                    				    {104,71},
                                    				    {100,71},
                                    				    {100,96},
                                    				    {88,96}
                                    			}
                                                };



    /**
     * The color of all but the current line being drawn
     * during phase 3 of the splash animation.
     */
    private final int SPLASH_PHASE3_OLDLINE_COLOR = 0xDE49FF;

    /**
     * The color of the current line being drawn
     * during phase 3 of the splash animation.
     */
    private final int SPLASH_PHASE3_NEWLINE_COLOR = 0xFF0000;

    /**
     * The total width of the screen available to the application.
     */
    public int m_nScreenWidth;

    /**
     * The total height of the screen available to the application.
     */
    public int m_nScreenHeight;

    /**
     * The X coordinate of a point to be transformed for display.
     */

⌨️ 快捷键说明

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