Skip to content

Commit f96667e

Browse files
committed
Make to work not on java 1.8
1 parent 3e3e035 commit f96667e

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

core/src/macbury/forge/blocks/BlocksProvider.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.badlogic.gdx.utils.Disposable;
88
import com.badlogic.gdx.utils.GdxRuntimeException;
99
import com.badlogic.gdx.utils.Json;
10-
import com.sun.deploy.util.StringUtils;
1110

1211
import java.io.File;
1312
import java.io.FilenameFilter;
@@ -43,8 +42,7 @@ public boolean accept(File dir, String name) {
4342
for (FileHandle blockFile : blocksFiles) {
4443
Block block = json.fromJson(Block.class, blockFile.readString());
4544
String[] nameParts = blockFile.nameWithoutExtension().split("_");
46-
47-
block.name = StringUtils.join(Arrays.asList(Arrays.copyOfRange(nameParts, 1, nameParts.length)), " ");
45+
block.name = String.join(" ", Arrays.asList(Arrays.copyOfRange(nameParts, 1, nameParts.length)));
4846
block.id = Byte.valueOf(nameParts[0]);
4947
if (this.blocks[block.id] != null) {
5048
throw new GdxRuntimeException("Block with id "+block.id+" already added!");

core/src/macbury/forge/terrain/TerrainEngine.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package macbury.forge.terrain;
22

33
import com.badlogic.gdx.Gdx;
4+
import com.badlogic.gdx.math.Matrix4;
45
import com.badlogic.gdx.math.Vector3;
56
import com.badlogic.gdx.math.collision.BoundingBox;
67
import com.badlogic.gdx.utils.Array;
@@ -36,6 +37,7 @@ public class TerrainEngine implements Disposable, ActionTimer.TimerListener, Bas
3637
public final Array<Chunk> chunks;
3738
public final Array<VoxelFaceRenderable> visibleFaces;
3839
public final Array<OctreeObject> tempObjects;
40+
public final Matrix4 tempMat = new Matrix4();
3941
public final Vector3 tempA = new Vector3();
4042
public final Vector3 tempC = new Vector3();
4143
public final Vector3 tempD = new Vector3();
@@ -99,14 +101,17 @@ private void occulsion() {
99101
frustrumOctreeQuery.setFrustum(camera.normalOrDebugFrustrum());
100102
octree.retrieve(tempObjects, frustrumOctreeQuery);
101103

104+
tempC.set(camera.normalOrDebugPosition());
105+
102106
while(tempObjects.size > 0) {
103107
Chunk visibleChunk = (Chunk) tempObjects.pop();
104108
if (visibleChunk.renderables.size > 0) {
105109
visibleChunks.add(visibleChunk);
106110
for (int i = 0; i < visibleChunk.renderables.size; i++) {
107111
VoxelFaceRenderable renderable = visibleChunk.renderables.get(i);
108112
//http://www.gamasutra.com/view/feature/131773/a_compact_method_for_backface_.php?print=1
109-
if (camera.boundsInFrustum(renderable.boundingBox) && tempA.set(camera.normalOrDebugPosition()).sub(visibleChunk.worldPosition).dot(renderable.direction) >= 0f) {
113+
//tempA.set(renderable.boundingBox.getCenter());
114+
if (camera.boundsInFrustum(renderable.boundingBox) /*&& tempA.sub(tempC).scl(camera.direction).nor().dot(renderable.direction) >= 0f*/) {
110115
visibleFaces.add(renderable);
111116
}
112117
}

editor/src/META-INF/MANIFEST.MF

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
Manifest-Version: 1.0
2+
Classpath: com.sun.net
3+
Class-Path: com.sun.net
24
Main-Class: macbury.forge.editor.DesktopLauncher
35

editor/src/macbury/forge/editor/windows/MainWindow.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
import java.awt.*;
1919
import java.awt.event.FocusEvent;
2020
import java.awt.event.FocusListener;
21+
import java.awt.event.WindowEvent;
22+
import java.awt.event.WindowFocusListener;
2123

22-
public class MainWindow extends JFrame implements ForgEBootListener, FocusListener {
24+
public class MainWindow extends JFrame implements ForgEBootListener, FocusListener, WindowFocusListener {
2325
private static final String WINDOW_MAIN_NAME = "ForgE";
2426
private final BlocksController blocksController;
2527
private final DirectoryWatcher directoryWatcher;
@@ -53,6 +55,7 @@ public class MainWindow extends JFrame implements ForgEBootListener, FocusListen
5355
public JSplitPane mainSplitPane;
5456
private JPanel panelPrimaryBlock;
5557
private JPanel panelSecondaryBlock;
58+
private boolean bruteFocus;
5659

5760
public MainWindow() {
5861
super();
@@ -64,8 +67,8 @@ public MainWindow() {
6467
setSize(1360, 760);
6568
setExtendedState(JFrame.MAXIMIZED_BOTH);
6669
setDefaultCloseOperation(EXIT_ON_CLOSE);
67-
setTitle(null);
6870

71+
setTitle(null);
6972
setVisible(true);
7073

7174
this.inputProcessor = new GdxSwingInputProcessor();
@@ -102,6 +105,7 @@ public MainWindow() {
102105

103106
mapSettingsPanel.add(inspectorSheetPanel);
104107
openGlContainer.add(openGLCanvas.getCanvas(), BorderLayout.CENTER);
108+
105109
projectController.setStatusLabel(statusFpsLabel, statusMemoryLabel, statusRenderablesLabel, mapCursorPositionLabel, statusTriangleCountLabel);
106110

107111
projectController.addOnMapChangeListener(mainMenu);
@@ -110,11 +114,13 @@ public MainWindow() {
110114
projectController.addOnMapChangeListener(blocksController);
111115

112116
invalidate();
117+
addWindowFocusListener(this);
113118
}
114119

115120
@Override
116121
public void afterEngineCreate(ForgE engine) {
117122
Gdx.graphics.setVSync(true);
123+
mainSplitPane.setVisible(false);
118124
ForgE.input.addProcessor(inputProcessor);
119125
projectController.setMainWindow(this);
120126
directoryWatcher.start();
@@ -149,7 +155,21 @@ public void focusGained(FocusEvent e) {
149155

150156
@Override
151157
public void focusLost(FocusEvent e) {
152-
mainContentPane.grabFocus();
158+
if (bruteFocus) {
159+
mainContentPane.grabFocus();
160+
}
161+
153162
//mainContentPane.setFocusable(true);
154163
}
164+
165+
@Override
166+
public void windowGainedFocus(WindowEvent e) {
167+
bruteFocus = true;
168+
//mainContentPane.grabFocus();
169+
}
170+
171+
@Override
172+
public void windowLostFocus(WindowEvent e) {
173+
bruteFocus = false;
174+
}
155175
}

0 commit comments

Comments
 (0)