From 18 Jan, 2021 0:00 UTC: All services will be temporary unavailable for maintenance
  • R/O
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

無人機動兵器ダンジョン探索ゲーム JAVAベース


Commit MetaInfo

修订版31 (tree)
时间2015-06-26 02:18:11
作者manjihq

Log Message

チップ表示サイズを変更できるようにした

更改概述

差异

--- CarnageHack2/trunk/src/CarnageHack/OkeSoftTracePanel.java (revision 30)
+++ CarnageHack2/trunk/src/CarnageHack/OkeSoftTracePanel.java (revision 31)
@@ -20,9 +20,22 @@
2020 static final Color redFocusChipColor = new Color(255, 0, 0);
2121 static final Color normalCodeColor = new Color(0, 0, 127);
2222 static final Color condCodeColor = new Color(127, 0, 127);
23+ static int viewChipWidth = 16;
24+ static int viewChipHeight = 16;
2325 Oke.ChipTrace traceData[];
2426 OkeSoftData software;
2527
28+ static void setViewChipSize(int w, int h) {
29+ if (w < 8) {
30+ w = 8;
31+ }
32+ if (h < 8) {
33+ h = 8;
34+ }
35+ viewChipWidth = w;
36+ viewChipHeight = h;
37+ }
38+
2639 /**
2740 * コンストラクタ
2841 *
@@ -35,14 +48,14 @@
3548
3649 @Override
3750 public Dimension getPreferredSize() {
38- return new Dimension(OkeSoftData.CHIPMAXX * 10 + 4,
39- OkeSoftData.CHIPMAXY * 10 + 4);
51+ return new Dimension(OkeSoftData.CHIPMAXX * viewChipWidth + 4,
52+ OkeSoftData.CHIPMAXY * viewChipHeight + 4);
4053 }
4154
4255 @Override
4356 public Dimension getMinimumSize() {
44- return new Dimension(OkeSoftData.CHIPMAXX * 10 + 4,
45- OkeSoftData.CHIPMAXY * 10 + 4);
57+ return new Dimension(OkeSoftData.CHIPMAXX * viewChipWidth + 4,
58+ OkeSoftData.CHIPMAXY * viewChipHeight + 4);
4659 }
4760
4861 @Override
@@ -54,8 +67,8 @@
5467 public void paint(Graphics g) {
5568 int x;
5669 int y;
57- int nwidth = OkeSoftData.CHIPMAXX * 10 + 4;
58- int nheight = OkeSoftData.CHIPMAXY * 10 + 4;
70+ int nwidth = OkeSoftData.CHIPMAXX * viewChipWidth + 4;
71+ int nheight = OkeSoftData.CHIPMAXY * viewChipHeight + 4;
5972 Image offscreen = createImage(nwidth, nheight);
6073 Graphics offg = offscreen.getGraphics();
6174 offg.setColor(baseColor);
@@ -63,7 +76,8 @@
6376 offg.setColor(Color.YELLOW);
6477 for (y = 0; y < OkeSoftData.CHIPMAXY; y++) {
6578 for (x = 0; x < OkeSoftData.CHIPMAXX; x++) {
66- offg.drawRect(x * 10 + 2, y * 10 + 2, 10, 10);
79+ offg.drawRect(x * viewChipWidth + 2, y * viewChipHeight + 2,
80+ viewChipWidth, viewChipHeight);
6781 }
6882 }
6983 if (software != null) {
@@ -73,7 +87,9 @@
7387 if (chip.nullchip() == false) {
7488 offg.setColor(software.get(x, y).is_condchip()
7589 ? condCodeColor : normalCodeColor);
76- offg.fillRect(x * 10 + 2 + 1, y * 10 + 2 + 1, 8, 8);
90+ offg.fillRect(x * viewChipWidth + 2 + 1,
91+ y * viewChipHeight + 2 + 1,
92+ viewChipWidth - 2, viewChipHeight - 2);
7793 }
7894 }
7995 }
@@ -84,15 +100,19 @@
84100 for (i = 0; i < nmax; i++) {
85101 offg.setColor(traceData[i].get_branch()
86102 ? redChipColor : greenChipColor);
87- offg.fillRect(traceData[i].get_position_x() * 10 + 2 + 1,
88- traceData[i].get_position_y() * 10 + 2 + 1, 8, 8);
103+ offg.fillRect(
104+ traceData[i].get_position_x() * viewChipWidth + 2 + 1,
105+ traceData[i].get_position_y() * viewChipHeight + 2 + 1,
106+ viewChipWidth - 2, viewChipHeight - 2);
89107 }
90108 if (i > 0) {
91109 //最終チップだけフォーカス表示
92110 offg.setColor(traceData[i].get_branch()
93111 ? redFocusChipColor : greenFocusChipColor);
94- offg.fillRect(traceData[i].get_position_x() * 10 + 2 + 1,
95- traceData[i].get_position_y() * 10 + 2 + 1, 8, 8);
112+ offg.fillRect(
113+ traceData[i].get_position_x() * viewChipWidth + 2 + 1,
114+ traceData[i].get_position_y() * viewChipHeight + 2 + 1,
115+ viewChipWidth - 2, viewChipHeight - 2);
96116 }
97117 }
98118 g.drawImage(offscreen, 0, 0, this);