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

📄 gamecanvas.java

📁 里面是个完整的项目 解压后放到wtk的apps文件夹下就可以运行了
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
				case 8: // '\b'
					if (!getGraphics() || keyCode == -7 || keyCode == -6 || keyCode == -5) {
						if (GAME_STATE == 8) {
							fillRect++;
							if (fillRect == enumerateRecords) {
								fillRect = 0;
								showMenuCommand();
								return;
							}
						}
						GAME_STATE = 5;
					}
					break;
				case 10: // '\n'
					if (getGraphics == 2) {
						if (!drawString)
							showMenuCommand();
						else
							GAME_STATE = 15;
						return;
					}
					getGraphics++;
					break;
				case 9: // '\t'
					if (getFont == 2) {
						showMenuCommand();
						return;
					}
					getFont++;
					break;
				case 13: // '\r'
					J.timeCounter = System.currentTimeMillis() - nextRecordId;
					GAME_STATE = 4;
					g.setColor(0);
					g.fillRect(0, 0, 128, 10);
					f.F = 0;
					if (f.I != null)
						f.I.H = 0;
					removeCommand(currentCommand);
					addCommand(commandMENU);
					currentCommand = commandMENU;
					return;
				case 12: // '\f'
					if ((fillRect & 1) == 0)
						skip = 1;
					else
						skip = 2;
					paintStoryString(h, 25, 95);
					GAME_STATE = 8;
					break;
			}
		switch (keyCode) {
			case 0: // '\0'
			case 1: // '\001'
			case 2: // '\002'
			case 3: // '\003'
			case 4: // '\004'
			case 5: // '\005'
			case 6: // '\006'
			case 7: // '\007'
			case 8: // '\b'
			case 9: // '\t'
			case 10: // '\n'
			case 11: // '\013'
			case 12: // '\f'
			case 13: // '\r'
			case 14: // '\016'
			case 15: // '\017'
			case 16: // '\020'
			case 17: // '\021'
			case 18: // '\022'
			case 19: // '\023'
			case 20: // '\024'
			case 21: // '\025'
			case 22: // '\026'
			case 23: // '\027'
			case 24: // '\030'
			case 25: // '\031'
			case 26: // '\032'
			case 27: // '\033'
			case 28: // '\034'
			case 29: // '\035'
			case 30: // '\036'
			case 31: // '\037'
			case 32: // ' '
			case 33: // '!'
			case 34: // '"'
			case 35: // '#'
			case 36: // '$'
			case 37: // '%'
			case 38: // '&'
			case 39: // '\''
			case 40: // '('
			case 41: // ')'
			case 42: // '*'
			case 43: // '+'
			case 44: // ','
			case 45: // '-'
			case 46: // '.'
			case 47: // '/'
			default:
				break;
			case -7:
			case -6:
				if (!keyPress)
					break;
				if (GAME_STATE == 3 && stop && drawRect)
					showSelectCommand(0);
				if (GAME_STATE == 4)
					showSelectCommand(1);
				break;
			case 48: // '0'
				JJJJ = keyPress;
				break;
			case 53: // '5'
				S = keyPress;
				break;
			case -5:
			case -1:
			case 49: // '1'
			case 50: // '2'
			case 51: // '3'
				B = keyPress;
				break;
			case -2:
			case 55: // '7'
			case 56: // '8'
			case 57: // '9'
				D = keyPress;
				break;
			case -3:
			case 52: // '4'
				Z = keyPress;
				break;
			case -4:
			case 54: // '6'
				C = keyPress;
				break;
		}
	}
	
	long timeUsed = 0;

	public final void paint(Graphics graphics) {
		long start = System.currentTimeMillis();
		//GameCanvas _tmp = this;
		g = graphics;
		if (mainMenu) {
			if (GAME_STATE != 4 && (no_of_run & 0x20) != 0) {
				drawImage();
				no_of_run = 0;
			}
			
			graphics.setFont(bold_text);
			graphics.setColor(153, 0, 0);
			graphics.drawRect(17, 23, 93, 80);
			graphics.drawRect(18, 24, 93, 80);
			graphics.setColor(255, 255, 153);
			graphics.fillRect(18, 24, 92, 79);
			graphics.setColor(153, 0, 0);
			graphics.drawString("Options", 44, 26, 20);
			graphics.drawLine(17, 37, 110, 37);
			int i1 = selectedId - 2;
			int l1 = selectedId - 1;
			byte byte0 = selectedId;
			int i2 = selectedId + 1;
			int j2 = selectedId + 2;
			if (i1 < 0)
				i1 += r[commandType];
			if (l1 < 0)
				l1 += r[commandType];
			if (i2 >= r[commandType])
				i2 -= r[commandType];
			if (j2 >= r[commandType])
				j2 -= r[commandType];
			graphics.setFont(plain_text);
			graphics.drawString(menuStrings[q[commandType][i1]], 19, 40, 20);
			graphics.drawString(menuStrings[q[commandType][l1]], 19, 53, 20);
			graphics.drawString(menuStrings[q[commandType][i2]], 19, 79, 20);
			graphics.drawString(menuStrings[q[commandType][j2]], 19, 92, 20);
			graphics.setColor(153, 0, 0);
			graphics.fillRect(17, 63, 93, 15);
			graphics.setFont(bold_text);
			graphics.setColor(255, 255, 255);
			graphics.drawString(menuStrings[q[commandType][byte0]], 19, 66, 20);
			return;
		}
		switch (GAME_STATE) {
			case 14: // '\016'
			default:
				break;
			case 0: // '\0'
				drawBackGround(0xffffff);
				graphics.drawImage(imageCompanyLogo, 12, 50, 20);
				imageCompanyLogo = null;
				GAME_STATE = 1;
				break;
			case 1: // '\001'
				startLoading();
				graphics.setColor(0);
				graphics.drawRect(23, 79, 81, 7);
				graphics.setColor(255, 153, 85);
				graphics.fillRect(25, 81, (loadingProgress * 78) / 10, 4);
				break;
			case 2: // '\002'
				if (System.currentTimeMillis() - loadingFinishTime > 2000L) {
					showMenuCommand();
					return;
				}
				drawBackGround(0);
				paintHint("PRINCE OF PERSIA", 36, 8, false);
				paintHint("<> 2003 GAMELOFT S.A.", 26, 17, false);
				paintHint("- UNDER LICENSE BY", 31, 25, false);
				paintHint("UBI SOFT ENTERTAINMENT S.A.", 15, 44, false);
				paintHint("BASED ON JORDAN MECHNER'S", 18, 63, false);
				paintHint("PRINCE OF PERSIA", 36, 71, false);
				paintHint("- <>1989 JORDAN MECHNER -", 19, 78, false);
				paintHint("ALL RIGHTS RESERVED.", 30, 89, false);
				paintHint("PRINCE OF PERSIA IS A", 27, 97, false);
				paintHint("REGISTERED TRADEMARK OF", 23, 105, false);
				paintHint("JORDAN MECHNER.", 39, 113, false);
				graphics.setClip(35, 42, 61, 19);
				stop = false;
				break;
			case 3: // '\003'
				drawImage();
				stop = true;
				break;
			case 15: // '\017'
				graphics.setColor(0);
				graphics.fillRect(0, 0, 128, 10);
				f.F = 0;
				if (s != null)
					s.H = 0;
				else if (f.I != null)
					f.I.H = 0;
				removeCommand(currentCommand);
				addCommand(commandMENU);
				currentCommand = commandMENU;
				GAME_STATE = 4;
				break;
			case 4: // '\004'
				if ((no_of_run & 0x20) != 0) {
					graphics.setColor(0);
					graphics.fillRect(0, 0, 128, 10);
					f.F = 0;
					if (s != null)
						s.H = 0;
					else if (f.I != null)
						f.I.H = 0;
					no_of_run = 0;
				}
				d.I();
				C();
				d.paint();
				f.C();
				d.C();
				if (f.P) {
					if (a < 40)
						a += 8;
					if (a > 40)
						a = 40;
				} else {
					if (a > 0)
						a -= 8;
					if (a < 0)
						a = 0;
				}
				if (a != 0) {
					graphics.setClip(0, 10, 128, 117);
					graphics.setColor(0);
					graphics.fillRect(0, 10, 128, a - 10);
					graphics.fillRect(0, 127 - a, 128, a);
				}
				if (d.W && enableTips) {
					g.setClip(0, 0, 128, 127);
					graphics.setColor(0);
					graphics.fillRect(0, 119, 128, 9);
					g.drawImage(J.buffer_128x5, 0, 121, 20);
				}
				f.sS();
				if (s != null) {
					s.S();
					break;
				}
				if (f.I != null)
					f.I.I(1);
				break;
			case 5: // '\005'
				drawLine();
				break;
			case 6: // '\006'
				drawImage();
				getFont();
				break;
			case 7: // '\007'
				anotherTimeinMS += e;
				GAME_STATE = 12;
				playSound(1);
				break;
			case 8: // '\b'
				drawImage();
				getFont();
				break;
			case 9: // '\t'
				drawImage();
				graphics.setColor(255, 255, 255);
				graphics.setFont(Font.getFont(64, 0, 8));
				switch (getFont) {
					case 0: // '\0'
						graphics.drawString("PRINCE OF PERSIA", 64, 20, 17);
						graphics.drawString("version 1.0.0", 64, 35, 17);
						graphics.drawString("(c) GAMELOFT 2003", 64, 55, 17);
						graphics.drawString("Info and support:", 64, 75, 17);
						graphics.drawString("www.gameloft.com", 64, 90, 17);
						graphics.drawString("support@", 64, 100, 17);
						graphics.drawString("gameloft.com", 64, 110, 17);
						break;
					case 1: // '\001'
						graphics.drawString("PROGRAMMING:", 64, 20, 17);
						graphics.drawString("Alexandre", 64, 30, 17);
						graphics.drawString("Normand", 64, 40, 17);
						graphics.drawString("GRAPHICS:", 64, 55, 17);
						graphics.drawString("Laura Alecu", 64, 65, 17);
						graphics.drawString("SOUND DESIGN:", 64, 80, 17);
						graphics.drawString("Romain Gauthier", 64, 90, 17);
						break;
					case 2: // '\002'
						graphics.drawString("GAME DESIGN:", 64, 20, 17);
						graphics.drawString("Dan Teodorescu", 64, 30, 17);
						graphics.drawString("ART DIRECTOR:", 64, 45, 17);
						graphics.drawString("Arthur Hugot", 64, 55, 17);
						graphics.drawString("TESTING:", 64, 70, 17);
						graphics.drawString("Ricardo Filippi", 64, 80, 17);
						graphics.drawString("PRODUCER:", 64, 95, 17);
						graphics.drawString("Fleur Marty", 64, 105, 17);
						break;
				}
				break;
			case 10: // '\n'
				drawImage();
				graphics.setColor(255, 255, 255);
				graphics.setFont(Font.getFont(64, 0, 8));
				switch (getGraphics) {
					case 0: // '\0'
						paintHint("MOVEMENT:", 64, 23, true);
						paintHint("UP, 1, 2, 3:", 64, 34, true);
						paintHint("JUMP OR CLIMB", 64, 42, true);
						paintHint("DOWN, 8:", 64, 52, true);
						paintHint("GO DOWN,", 64, 60, true);
						paintHint("DRINK POTION", 64, 68, true);
						paintHint("RIGHT, 6:", 64, 78, true);
						paintHint("GO TO RIGHT", 64, 86, true);
						paintHint("LEFT, 4:", 64, 96, true);
						paintHint("GO TO LEFT", 64, 104, true);
						break;
					case 1: // '\001'
						paintHint("COMBAT:", 64, 23, true);
						paintHint("0, SELECT:", 64, 33, true);
						paintHint("DRAW SWORD", 64, 41, true);
						paintHint("5, SELECT:", 64, 52, true);
						paintHint("-IF SWORD IS DRAWN-", 64, 60, true);
						paintHint("ATTACK", 64, 68, true);
						paintHint("UP, 1, 2, 3:", 64, 79, true);
						paintHint("PARRY", 64, 87, true);
						paintHint("0, SELECT:", 64, 98, true);
						paintHint("EXIT COMBAT", 64, 106, true);
						break;
					case 2: // '\002'
						paintHint("COMBO:", 64, 24, true);
						paintHint("BLOCK + ATTACK COMBO:", 64, 37, true);
						paintHint("UP, 1, 2, 3:", 64, 46, true);
						paintHint("+", 64, 55, true);
						paintHint("5", 64, 64, true);
						paintHint("PRESSING ATTACK", 64, 79, true);
						paintHint("IMMEDIATELY AFTER", 64, 88, true);
						paintHint("A PARRY TRIGGERS", 64, 97, true);
						paintHint("A QUICKER ATTACK.", 64, 106, true);
						break;
				}
				break;
			case 11: // '\013'
				f.Z();
				GAME_STATE = 15;
				break;
			case 12: // '\f'
				drawBackGround(0);
				graphics.setColor(255, 255, 0);
				graphics.setFont(Font.getFont(64, 0, 8));
				graphics.drawString("LEVEL TIME", 64, 15, 17);
				graphics.drawString("BEST TIME", 64, 50, 17);
				graphics.drawString("TOTAL TIME", 64, 85, 17);
				graphics.setFont(Font.getFont(64, 0, 8));
				int j1 = (int) e / 1000;
				graphics.drawString(j1 / 60 + ":" + (j1 % 60) / 10 + j1 % 60 % 10, 64, 30, 17);
				if (e < someTimeinMs[fillRect])
					someTimeinMs[fillRect] = e;
				j1 = (int) someTimeinMs[fillRect] / 1000;
				graphics.drawString(j1 / 60 + ":" + (j1 % 60) / 10 + j1 % 60 % 10, 64, 65, 17);
				j1 = (int) anotherTimeinMS / 1000;
				graphics.drawString(j1 / 60 + ":" + (j1 % 60) / 10 + j1 % 60 % 10, 64, 100, 17);
				break;
			case 13: // '\r'
				if (length < 63) {
					if (length == 0) {
						J _tmp1 = d;
						nextRecordId = System.currentTimeMillis() - J.timeCounter;
						openRecordStore = anotherTimeinMS + nextRecordId;
					}
					d.I();
					C();
					d.paint();
					f.C();
					d.C();
					length += 8;
					graphics.setClip(0, 0, 128, 127);
					graphics.setColor(0, 0, 100);
					graphics.fillRect(0, 0, 128, length);
					graphics.fillRect(0, 127 - length, 128, length);
				} else {
					graphics.setColor(0, 0, 100);
					graphics.fillRect(0, 0, 128, 127);
					graphics.setColor(255, 255, 0);

⌨️ 快捷键说明

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