Skip to content

Commit

Permalink
Fixed scaling bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Pegacraft committed Jul 15, 2021
1 parent ae5b9a5 commit eb0ec04
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 517 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/main/java/engine/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.image.BufferStrategy;

/**
Expand Down Expand Up @@ -96,6 +95,9 @@ public Display setSize(int width, int height) {
this.width = width;
this.height = height;
frame.setSize(width, height);
canvas.setSize(width, height);
Graphics.setStdWidth(width);
Graphics.setStdHeight(height);
}
return this;
}
Expand Down Expand Up @@ -196,17 +198,17 @@ public boolean isFullScreen() {
}

/**
* @return Returns the screen width.
* @return Returns the screen width. (Don't use this to render something at a relative position of the screen, use <code>Graphics.getStdWidth()</code>)
*/
public int getWidth() {
return frame.getWidth();
return canvas.getWidth();
}

/**
* @return Returns the screen height.
* @return Returns the screen height. (Don't use this to render something at a relative position of the screen, use <code>Graphics.getStdHeight()</code>)
*/
public int getHeight() {
return frame.getHeight();
return canvas.getHeight();
}

/**
Expand Down
21 changes: 2 additions & 19 deletions src/main/java/engine/Game.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package engine;

import engine.editor.EditScene;
import engine.editor.SettingsScene;
import engine.loops.Loop;
import engine.rendering.Graphics;

import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -54,12 +51,12 @@ public static void addScene(Scene scene, String alias) {
}

/**
* proxy to a display named <code>"MAIN"</code>
* proxy to a display named <code>"main"</code>
*
* @return the display named MAIN
*/
public static Display display() {
return display("MAIN");
return display("main");
}

/**
Expand All @@ -76,19 +73,6 @@ public static Display display(String name) {
return displays.get(name);
}

/**
* start the environment-editor using a new display called "editor"
*/
public static void startEditor() {
Display display = Game.display("editor");
Game.addScene(new EditScene(), "EditScene");
Game.addScene(new SettingsScene(), "Settings");
display.attachScene("EditScene");
Game.start();
Game.setFrameRate(60);
display.setTitle("Map Editor");
}

/**
* get a scene using it's alias
*
Expand All @@ -100,7 +84,6 @@ public static Scene getScene(String alias) {
}

/**
*
* @return How long it took to calculate the last frame in respect to the framerate
*/
public static double deltaTime() {
Expand Down
119 changes: 0 additions & 119 deletions src/main/java/engine/editor/EditScene.java

This file was deleted.

131 changes: 0 additions & 131 deletions src/main/java/engine/editor/Environment.java

This file was deleted.

Loading

0 comments on commit eb0ec04

Please sign in to comment.