|
|
|
@ -25,6 +25,8 @@ import java.awt.event.KeyListener; |
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
import java.awt.RenderingHints; |
|
|
|
|
|
|
|
|
|
import java.awt.Cursor; |
|
|
|
|
|
|
|
|
|
import sig.JavaProjectTemplate; |
|
|
|
|
|
|
|
|
|
public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
@ -61,6 +63,8 @@ public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
|
public static Panel p; |
|
|
|
|
public static JFrame f; |
|
|
|
|
|
|
|
|
|
static Cursor currentCursor = new Cursor(Cursor.DEFAULT_CURSOR); |
|
|
|
|
|
|
|
|
|
public static void InitializeEngine(JavaProjectTemplate instance){ |
|
|
|
|
System.setProperty("sun.java2d.transaccel", "True"); |
|
|
|
|
System.setProperty("sun.java2d.d3d", "True"); |
|
|
|
@ -89,6 +93,8 @@ public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
|
|
|
|
|
|
p.render(); |
|
|
|
|
|
|
|
|
|
gameInstance.initializeGame(); |
|
|
|
|
|
|
|
|
|
long lastGameTime = System.nanoTime(); |
|
|
|
|
long dt = 0; |
|
|
|
|
while (true) { |
|
|
|
@ -238,6 +244,24 @@ public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
|
* pixel is your canvas! |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
public boolean Cursor_IsVisible(){ |
|
|
|
|
return !f.getCursor().getName().equals("INVISIBLE"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Cursor_Hide(){ |
|
|
|
|
f.setCursor(Toolkit.getDefaultToolkit().createCustomCursor(Toolkit.getDefaultToolkit().getImage(""), new java.awt.Point(0,0), "INVISIBLE")); |
|
|
|
|
} |
|
|
|
|
public void Cursor_Show(){ |
|
|
|
|
f.setCursor(currentCursor); |
|
|
|
|
} |
|
|
|
|
public void Cursor_SetCursor(Sprite cursorimg,int x_origin,int y_origin){ |
|
|
|
|
currentCursor=Toolkit.getDefaultToolkit().createCustomCursor(cursorimg.img, new java.awt.Point(x_origin,y_origin), "CUSTOM"); |
|
|
|
|
f.setCursor(currentCursor); |
|
|
|
|
} |
|
|
|
|
public void Cursor_ResetCursor(){ |
|
|
|
|
f.setCursor(Cursor.getDefaultCursor()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public /* abstract */ void render(){ |
|
|
|
|
gameInstance.drawGame(); |
|
|
|
|