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

📄 gamecanvas.java

📁 里面是个完整的项目 解压后放到wtk的apps文件夹下就可以运行了
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
					graphics.setFont(Font.getFont(64, 0, 8));
					graphics.drawString("PRINCE OF PERSIA", 64, 9, 17);
					graphics.drawString("GAME PAUSED", 64, 30, 17);
					graphics.drawString("LEVEL TIME", 64, 55, 17);
					graphics.drawString("TOTAL TIME", 64, 95, 17);
					graphics.setFont(Font.getFont(64, 0, 8));
					int k1 = (int) nextRecordId / 1000;
					graphics.drawString(k1 / 60 + ":" + (k1 % 60) / 10 + k1 % 60 % 10, 64, 70, 17);
					k1 = (int) openRecordStore / 1000;
					graphics.drawString(k1 / 60 + ":" + (k1 % 60) / 10 + k1 % 60 % 10, 64, 110, 17);
				}
				break;
		}
		long end = System.currentTimeMillis();
		timeUsed = end - start;
		if (timeUsed != 0)
			graphics.drawString(""+1000/(timeUsed),20,20,Graphics.LEFT|Graphics.TOP);
	}

	private final void showMenuCommand() {
		skip = 0;
		GAME_STATE = 3;
		removeCommand(currentCommand);
		addCommand(commandMENU);
		currentCommand = commandMENU;
		playSound(7);
	}

	private final void startLoading() {
		switch (loadingProgress++) {
			default:
				break;
			case 0: // '\0'
				Z = false;
				C = false;
				B = false;
				D = false;
				S = false;
				JJJJ = false;
				E = false;
				break;
			case 1: // '\001'
				init2(3073);
				init2(3072);
				init2(3075);
				init2(3074);
				readImages();
				break;
			case 2: // '\002'
				buffer_224x96 = Image.createImage(224, 96);
				buffer_236x5 = Image.createImage(236, 5);
				J.buffer_144x144 = Image.createImage(144, 144);
				J.buffer_144x144_graphics = J.buffer_144x144.getGraphics();
				J.buffer_128x5 = Image.createImage(128, 5);
				J.buffer_128x5_graphics = J.buffer_128x5.getGraphics();
				break;
			case 3: // '\003'
				Graphics g1 = buffer_224x96.getGraphics();
				//Graphics _tmp = g;
				//Graphics _tmp1 = g;
				g1.drawImage(getImage(41), 0, 0, 0x10 | 4);
				//Graphics _tmp2 = g;
				//Graphics _tmp3 = g;
				g1.drawImage(getImage(40), 112, 0, 0x10 | 4);
				init4(3073);
				init4(3072);
				g1 = buffer_236x5.getGraphics();
				//Graphics _tmp4 = g;
				//Graphics _tmp5 = g;
				g1.drawImage(getImage(43), 0, 0, 0x10 | 4);
				g1.drawImage(getImage(42), 118, 0, 0x10 | 4);
				init4(3075);
				init4(3074);
				break;
			case 4: // '\004'
				init2(1030);
				init2(1024);
				init2(1027);
				init2(1033);
				init2(1034);
				init2(1029);
				init2(1026);
				init2(1025);
				init2(1031);
				init2(1028);
				init2(1032);
				readImages();
				break;
			case 5: // '\005'
				imageW = getImage(11);
				break;
			case 6: // '\006'
				init2(2071);
				init2(2062);
				init2(2073);
				init2(2070);
				init2(2075);
				init2(2057);
				init2(2055);
				init2(2060);
				init2(2056);
				init2(2054);
				init2(2049);
				init2(2059);
				init2(2069);
				init2(2050);
				init2(2068);
				init2(2064);
				init2(2072);
				init2(2066);
				init2(2074);
				init2(2061);
				init2(2058);
				init2(2067);
				init2(2053);
				init2(2052);
				init2(2048);
				init2(2065);
				init2(2063);
				init2(2051);
				readImages();
				break;
			case 7: // '\007'
				try {
					is = c.getClass().getResourceAsStream("/d");
					K = new Base[4];
					K[0] = new Base();
					K[0].eE();
					K[1] = new Base();
					K[1].eE();
					K[2] = new Base();
					K[2].eE();
					K[3] = new Base();
					K[3].eE();
					K[0].constants[0].I[0] = 10321;
					K[1].constants[0].I[0] = 16146;
					K[2].constants[0].I[0] = 11442;
					K[3].constants[0].I[0] = 11554;
					K[0].C(0);
					K[1].C(0);
					K[2].C(0);
					K[3].C(0);
					L = new Base();
					L.eE();
					L.C(0);
					M = new Children7(true);
					N = new Children1(true);
					O = new Children3(true);
					P = new Children5(true);
					R = new Children4(true);
					Q = new Children2(true);
					f = new Children6();
					Q.constants[11] = f.constants[12];
					U = new byte[336];
					readbytes(U);
					V = new byte[2688];
					readbytes(V);
					is.close();
				} catch (Exception exception) {
				}
				break;
			case 8: // '\b'
				try {
					//loadAllSound();
					is = c.getClass().getResourceAsStream("/l");
					enumerateRecords = readbyte();
					b = new int[enumerateRecords];
					for (int i1 = 0; i1 < enumerateRecords; i1++)
						b[i1] = is.read() * 256 + is.read();
					is.close();
				} catch (Exception exception1) {
				}
				break;
			case 9: // '\t'
				readRMS();
				j = true;
				loadingFinishTime = System.currentTimeMillis();
				GAME_STATE = 2;
				break;
		}
	}

	private final void drawImage() {
		drawRect = skip == 0;
		//Graphics _tmp = g;
		//Graphics _tmp1 = g;
		g.drawImage(getImage(4), 0, 0, 0x10 | 4);
		switch (skip) {
			case 0: // '\0'
				//Graphics _tmp2 = g;
				//Graphics _tmp3 = g;
				g.drawImage(getImage(1), 5, 3, 0x10 | 4);
				break;
			case 1: // '\001'
				//Graphics _tmp4 = g;
				//Graphics _tmp5 = g;
				g.drawImage(getImage(6), 24, 15, 0x10 | 4);
				//Graphics _tmp6 = g;
				//Graphics _tmp7 = g;
				g.drawImage(getImage(5), 36, 15, 0x10 | 4);
				break;
			case 2: // '\002'
				//Graphics _tmp8 = g;
				//Graphics _tmp9 = g;
				g.drawImage(getImage(6), 24, 15, 0x10 | 4);
				//Graphics _tmp10 = g;
				//Graphics _tmp11 = g;
				g.drawImage(getImage(8), 40, 15, 0x10 | 4);
				break;
			case 3: // '\003'
				//Graphics _tmp12 = g;
				//Graphics _tmp13 = g;
				g.drawImage(getImage(9), 23, 15, 0x10 | 4);
				break;
		}
	}

	private final void drawLine() {
		d = null;
		writeRMS(false);
		d = new J();
		d.I(fillRect);
		playSound(6);
		GAME_STATE = 15;
	}

	static final void C() {
		d.S = d.JJ;
		d.E = d.A;
		if (j) {
			int i1 = f.T;
			int j1 = f.U - 13;
			if ((i1 -= 64) < 0)
				i1 = 0;
			if (i1 > d.G)
				i1 = d.G;
			if ((j1 -= 63) <= 0)
				j1 = 0;
			else if (j1 >= d.H)
				j1 = d.H;
			d.JJ = i1;
			d.A = j1;
		}
	}

	private final void readRMS() {
		try {
			recordStore = RecordStore.openRecordStore("prince_721011", true);
			RecordEnumeration recordenumeration = recordStore.enumerateRecords(null, null, false);
			if (recordenumeration.hasNextElement()) {
				int recordId = recordenumeration.nextRecordId();
				record = recordStore.getRecord(recordId);
				getClass = record[0];
				enableSound = record[1] == 1;
				for (int j1 = 0; j1 < 7; j1++)
					someTimeinMs[j1] = (record[2 + j1 * 2] & 0xff) * 60000 + (record[2 + j1 * 2 + 1] & 0xff) * 1000;
				anotherTimeinMS = record[16] * 60000 + record[17] * 1000;
				enableTips = record[18] == 1;
				recordenumeration.destroy();
				recordStore.closeRecordStore();
			} else {
				writeRMS(false);
			}
		} catch (Exception exception) {
			writeRMS(false);
		}
	}

	private static final void writeRMS(boolean flag) {
		getClass = fillRect;
		if (flag) {
			getClass++;
			if (getClass == enumerateRecords)
				getClass = 0;
		}
		record[0] = (byte) getClass;
		record[1] = (byte) (enableSound ? 1 : 0);
		for (int i = 0; i < 7; i++) {
			record[2 + i * 2] = (byte) (int) (someTimeinMs[i] / 1000L / 60L);
			record[2 + i * 2 + 1] = (byte) (int) ((someTimeinMs[i] / 1000L) % 60L);
		}
		record[16] = (byte) (int) (anotherTimeinMS / 1000L / 60L);
		record[17] = (byte) (int) ((anotherTimeinMS / 1000L) % 60L);
		record[18] = (byte) (enableTips ? 1 : 0);
		try {
			recordStore = RecordStore.openRecordStore("prince_721011", true);
			RecordEnumeration recordenumeration = recordStore.enumerateRecords(null, null, false);
			if (recordenumeration.hasNextElement()) {
				int recordId = recordenumeration.nextRecordId();
				recordStore.setRecord(recordId, record, 0, record.length);
			} else {
				recordStore.addRecord(record, 0, record.length);
			}
			recordenumeration.destroy();
			recordStore.closeRecordStore();
		} catch (Exception exception) {
		}
	}

	static final byte readbyte() {
		try {
			return (byte) is.read();
		} catch (Exception exception) {
			return 0;
		}
	}

	static final short D() {
		int i1 = 0;
		int j1 = 0;
		try {
			i1 = is.read();
			j1 = is.read();
		} catch (Exception exception) {
			return 0;
		}
		return (short) ((j1 << 8) + i1);
	}

	static final void readbytes(byte abyte0[]) {
		try {
			is.read(abyte0);
		} catch (Exception exception) {
		}
	}

	private final void showStory() {
		fillRect = 0;
		paintStoryString("THE SULTAN'S DAUGHTERS\\HAVE BEEN KIDNAPPED BY\\THE EVIL VIZIER. HE\\THREATENS TO KILL THE\\BEAUTIFUL WOMENS IF THE\\SULTAN DOESN'T GIVE UP\\HIS RULE. TORN BETWEEN\\LOVE AND HIS DUTY TO\\PERSIA, THE SULTAN TURNS\\TO YOU AS HIS\\FINAL HOPE.", 25, 95);
		anotherTimeinMS = 0L;
		skip = 3;
		GAME_STATE = 6;
	}

	public final void showSelectCommand(int i1) {
		
		if (i1 < 0 || i1 > 2)
			return;
		
		mainMenu = true;
		commandType = (byte) i1;
		selectedId = 0;
		
		removeCommand(currentCommand);
		addCommand(commandSELECT);
		currentCommand = commandSELECT;
		
		if (enableSound) {
			q[0][2] = 3;
			q[1][3] = 3;
		} else {
			q[0][2] = 2;
			q[1][3] = 2;
		}
		if (enableTips) {
			q[0][6] = 11;
			q[1][6] = 11;
		} else {
			q[0][6] = 12;
			q[1][6] = 12;
		}
	}

	private static final void paintStoryString(String s1, int i1, int j1) {
		realize = i1 - 1;
		setClip = j1;
		storyString = s1;
		setFont = setColor = 0;
	}

	private final void getFont() {
		int y = setClip;
		int j1 = 0;
		int k1 = setColor;
		int j2;
		
		for (j2 = k1; j2 < storyString.length() && storyString.charAt(j2) != '\\'; j2++);
		
		int i2 = j2 - k1;
		int l1;
		for (l1 = setColor; l1 < storyString.length(); l1++) {
			if (storyString.charAt(l1) == '\\') {
				y += 6;
				k1 = l1 + 1;
				j1++;
				int k2;
				for (k2 = k1; k2 < storyString.length() && storyString.charAt(k2) != '\\'; k2++);
				i2 = k2 - k1;
				continue;
			}
			if (j1 == 3)
				break;
			int l2 = (storyString.charAt(l1) - 32) * 4;
			int i3 = (78 - i2 * 4) / 2;
			g.setClip(realize + i3 + (l1 - k1) * 4, y, 4, 5);
			g.drawImage(buffer_236x5, (realize + i3 + (l1 - k1) * 4) - l2, y, 20);
		}
		setFont = l1;
	}

	private final boolean getGraphics() {
		setColor = setFont;
		return setColor < storyString.length();
	}

	private final void paintHint(String hint, int i1, int j1, boolean flag) {
		if (flag)
			i1 -= hint.length() << 1;
		int k1 = 0;
		for (int i = 0; i < hint.length(); i++)
			if (hint.charAt(i) == '\\') {
				j1 += 6;
				k1 = i + 1;
			} else {
				int i2 = hint.charAt(i) - 32 << 2;
				g.setClip(i1 + (i - k1 << 2), j1, 4, 5);
				g.drawImage(buffer_236x5, (i1 + (i - k1 << 2)) - i2, j1, 20);
			}
	}
	


}

⌨️ 快捷键说明

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