Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cherno/src/com/thecherno/cherno/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.thecherno.cherno.engine.graphics.Color;
import com.thecherno.cherno.engine.graphics.Texture;
import com.thecherno.cherno.engine.input.Keyboard;
import com.thecherno.cherno.engine.utils.FileUtils;

public class Main extends Cherno {

Expand All @@ -21,6 +22,7 @@ protected void init() {
createDisplay("Cherno 0.1a", 960, 540);
setInput(KEYBOARD);
start();

}

protected void update() {
Expand Down
6 changes: 6 additions & 0 deletions Cherno/src/com/thecherno/cherno/engine/Cherno.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ protected void createDisplay(String name, int width, int height) {
protected void setInput(byte device) {
display.enable(device);
}

/**
* Updates Engine
* <p>
* <strong> Main update loop for the whole engine
*/

public void run() {
long lastTime = System.nanoTime();
Expand Down
6 changes: 6 additions & 0 deletions Cherno/src/com/thecherno/cherno/engine/graphics/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public void drawImage(BufferedImage image) {
g = bs.getDrawGraphics();
g.drawImage(image, 0, 0, window.getWidth(), window.getHeight(), null);
}

/**
* Shows BufferStrategy
* <p>
* <strong> Disposes of the Graphics and shows the BufferStrategy
*/

public void show() {
g.dispose();
Expand Down
7 changes: 7 additions & 0 deletions Cherno/src/com/thecherno/cherno/engine/utils/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ public class FileUtils {

private FileUtils() {
}

/**
* Reads Text from a file
* <p>
* <strong> Takes in text from and loads it in as a string.
*/

public static String loadText(String path) {
String result = "";
Expand All @@ -17,6 +23,7 @@ public static String loadText(String path) {
while ((buffer = reader.readLine()) != null) {
result += buffer + "\n";
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
Expand Down