Skip to content

Commit 0305a90

Browse files
committed
Updated project
* Fixed thread lock bug * Added deploy command for generating releases * Made maven generate executable jar files * Fixed palette not using the correct location on screen
1 parent b923940 commit 0305a90

6 files changed

Lines changed: 54 additions & 11 deletions

File tree

deploy.cmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:: Temporary fix for creating release zip file
2+
for /f "tokens=* usebackq" %%x in (`dir target /b ^| findstr [0-9]\.jar`) do set "filename=%%x"
3+
set "releasefolder=%filename:~0,-4% Release"
4+
mkdir "target/%releasefolder%"
5+
copy "LICENSE" "target/%releasefolder%/LICENSE"
6+
copy "README.md" "target/%releasefolder%/README.md"
7+
echo java -jar %filename% > "target/%releasefolder%/run.cmd"
8+
cd target
9+
copy "%filename%" "%releasefolder%/%filename%"
10+
cd ..
11+
exit /b

pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,39 @@
1212
<release>15</release>
1313
</configuration>
1414
</plugin>
15+
<plugin>
16+
<artifactId>maven-jar-plugin</artifactId>
17+
<configuration>
18+
<archive>
19+
<manifest>
20+
<addClasspath>true</addClasspath>
21+
<mainClass>com.bobrust.main.Main</mainClass>
22+
</manifest>
23+
</archive>
24+
</configuration>
25+
</plugin>
26+
<plugin>
27+
<artifactId>maven-assembly-plugin</artifactId>
28+
<configuration>
29+
<archive>
30+
<manifest>
31+
<mainClass>com.bobrust.main.Main</mainClass>
32+
</manifest>
33+
</archive>
34+
<descriptorRefs>
35+
<descriptorRef>jar-with-dependencies</descriptorRef>
36+
</descriptorRefs>
37+
</configuration>
38+
<executions>
39+
<execution>
40+
<id>make-assembly</id>
41+
<phase>package</phase>
42+
<goals>
43+
<goal>single</goal>
44+
</goals>
45+
</execution>
46+
</executions>
47+
</plugin>
1548
</plugins>
1649
</build>
1750

src/main/java/com/bobrust/gui/BobRustDrawDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private boolean findColorPalette() {
237237
// 150x264
238238
overlay.colorRegion.setLocation(screen.width - 150, red_middle.y - 163 + 132 + 100);
239239

240-
if(rustPalette.analyse(dialog, screenshot, new Point(screen.width - 150, red_middle.y - 163))) {
240+
if(rustPalette.analyse(dialog, screenshot, screen.getLocation(), new Point(screen.x + screen.width - 150, screen.y + red_middle.y - 163))) {
241241
// Found the palette.
242242
LogUtils.info("Found the color palette (%d, %d)", red_middle.x, red_middle.y);
243243
overlay.repaint();

src/main/java/com/bobrust/gui/BobRustOverlay.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -690,13 +690,14 @@ public void setRemainingTime(int index, int maxShapes, long timeLeft) {
690690

691691
private void updateButtons() {
692692
boolean defaultAction = action == OverlayType.NONE;
693+
boolean isPaused = gui.borstGenerator.isRunning() && gui.borstGenerator.isPaused();
693694

694695
// You should only be able to pick monitor the screen is enabled.
695-
btnSelectMonitor.setEnabled(defaultAction || gui.borstGenerator.isRunning() && gui.borstGenerator.isPaused());
696+
btnSelectMonitor.setEnabled(defaultAction || isPaused);
696697
regionsPanelTest.setVisible(isFullscreen);
697698
painterPanel.setVisible(isFullscreen);
698699

699-
btnHideRegions.setEnabled(defaultAction || gui.borstGenerator.isPaused() && gui.borstGenerator.isRunning());
700+
btnHideRegions.setEnabled(defaultAction || isPaused);
700701
boolean defaultRegion = !btnHideRegions.isSelected() && defaultAction;
701702
btnSelectCanvasRegion.setEnabled(defaultRegion || action == OverlayType.SELECT_CANVAS_REGION);
702703
btnSelectImageRegion.setEnabled(defaultRegion && image != null || action == OverlayType.SELECT_IMAGE_REGION);
@@ -705,8 +706,8 @@ private void updateButtons() {
705706
btnOpenImage.setEnabled(defaultAction);
706707
btnStartGenerate.setEnabled(isFullscreen && defaultAction && image != null && !gui.borstGenerator.isRunning());
707708
btnPauseGenerate.setEnabled(isFullscreen && gui.borstGenerator.isRunning());
708-
btnResetGenerate.setEnabled(gui.borstGenerator.isPaused() && gui.borstGenerator.isRunning());
709-
btnDrawImage.setEnabled(gui.borstGenerator.isPaused() && gui.borstGenerator.isRunning());
709+
btnResetGenerate.setEnabled(isPaused);
710+
btnDrawImage.setEnabled(isPaused);
710711
}
711712

712713
private void changeFullscreen(ActionEvent event) {
@@ -749,7 +750,7 @@ public void onBorstCallback(BorstData data) {
749750
repaint();
750751

751752
if(data.isDone()) {
752-
setPauseGeneration(false);
753+
btnPauseGenerate.setText("Pause Generate");
753754
}
754755
}
755756

src/main/java/com/bobrust/gui/BobRustShapeRender.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import com.bobrust.generator.Circle;
1414
import com.bobrust.generator.Model;
1515

16-
// TODO: Sometimes generates the wrong cache.. Try fix this!
1716
public class BobRustShapeRender {
1817
/**
1918
* Each element in this list is 'cacheInterval' shapes apart

src/main/java/com/bobrust/robot/BobRustPalette.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ public BobRustPalette() {
2424
colorMap = new HashMap<>();
2525
}
2626

27-
public synchronized boolean analyse(JDialog dialog, BufferedImage bi, Point panel_offset) {
28-
panel_offset = new Point(panel_offset.x, panel_offset.y - 152);
29-
this.panel_offset = panel_offset;
27+
public synchronized boolean analyse(JDialog dialog, BufferedImage bi, Point screenLocation, Point screenOffset) {
28+
this.panel_offset = new Point(screenOffset.x, screenOffset.y - 152);
3029
this.colorMap.clear();
3130

32-
Rectangle rect = new Rectangle(panel_offset.x, panel_offset.y, 150, 525);
31+
Rectangle rect = new Rectangle(panel_offset.x - screenLocation.x, panel_offset.y - screenLocation.y, 150, 525);
3332
BufferedImage image;
3433
try {
3534
image = bi.getSubimage(rect.x, rect.y, rect.width, rect.height);

0 commit comments

Comments
 (0)