-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
229 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public class Dialogue { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
import java.util.HashMap; | ||
|
||
public class Eventmgr { | ||
HashMap<String, Integer> flags = new HashMap<>(); | ||
public void addEvent(String name, int value) { | ||
flags.put(name, value); | ||
} | ||
public void removeEvent(String name) { | ||
flags.remove(name); | ||
} | ||
public void setEventValue(String name, int value) { | ||
flags.put(name, value); | ||
} | ||
public int getEventValue(String name) { | ||
return flags.get(name); | ||
} | ||
// If event is 1, checkEvent will return true. if value is 0, false otherwise 0 | ||
public boolean checkEvent(String name) { | ||
return flags.get(name) == 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,68 @@ | ||
|
||
import java.util.HashMap; | ||
import javax.swing.JComponent; | ||
import javax.swing.JFrame; | ||
import javax.swing.JPanel; | ||
|
||
public class Graphicsmgr { | ||
final boolean isGUI; | ||
JPanel panel; | ||
JFrame frame; | ||
HashMap<String, javax.swing.JComponent> components = new HashMap<>(); | ||
public Graphicsmgr(boolean isGUI){ | ||
this.isGUI = isGUI; | ||
} | ||
public void makePanel(){ | ||
if(isGUI){ | ||
panel = new JPanel(); | ||
} | ||
} | ||
public void makePanel(String name){ | ||
if(isGUI){ | ||
panel = new JPanel(); | ||
frame = new JFrame(name); | ||
frame.add(panel); | ||
} | ||
} | ||
@Deprecated | ||
public void makeTextArea(){ | ||
if(isGUI){ | ||
javax.swing.JTextArea textArea = new javax.swing.JTextArea(); | ||
textArea.setFont(new java.awt.Font("Monospaced", java.awt.Font.PLAIN, 30)); | ||
components.put("textArea", textArea); | ||
panel.add(textArea); | ||
} | ||
} | ||
public void makeTextArea(String name){ | ||
if(isGUI){ | ||
javax.swing.JTextArea textArea = new javax.swing.JTextArea(); | ||
textArea.setFont(new java.awt.Font("Monospaced", java.awt.Font.PLAIN, 30)); | ||
components.put(name, textArea); | ||
panel.add(textArea); | ||
} | ||
} | ||
public JComponent getComponent(String name){ | ||
return components.get(name); | ||
} | ||
public void draw(){ | ||
if(isGUI){ | ||
drawGUI(); | ||
}else{ | ||
drawConsole(); | ||
drawTUI(); | ||
} | ||
} | ||
private void drawGUI(){ | ||
System.out.println("Drawing GUI"); | ||
} | ||
private void drawConsole(){ | ||
System.out.println("Drawing Console"); | ||
private void drawTUI(){ | ||
components.forEach((k, v) -> { | ||
if(v instanceof javax.swing.JTextArea textArea){ | ||
if(k.equals("tilemap")){ | ||
RenderedMap rm = Tilemapmgr.draw("test", 0, 0, 10, 10); | ||
rm.overlay(new RenderedMap(2, 4, 'X'), 4, 5); | ||
textArea.setText(rm.toString()); | ||
}; | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
public class Interactable { | ||
|
||
public class Interactable extends MapCharacter{ | ||
Dialogue dialogue; | ||
public Interactable(String name) { | ||
super(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
public class Location { | ||
Scene scene; | ||
Position position; | ||
public Location(Scene scene, Position position) { | ||
this.scene = scene; | ||
this.position = position; | ||
} | ||
public Position getPosition() { | ||
return position; | ||
} | ||
public Scene getScene() { | ||
return scene; | ||
} | ||
public void setPosition(Position position) { | ||
this.position = position; | ||
} | ||
public void setScene(Scene scene) { | ||
this.scene = scene; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public class Logicmgr { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
public class MapCharacter extends Character { | ||
Location location; | ||
public MapCharacter(String name) { | ||
this.name = name; | ||
location = new Location(null, new Position()); | ||
} | ||
public MapCharacter(String name, Scene scene, Position position) { | ||
this.name = name; | ||
location = new Location(scene, position); | ||
} | ||
public MapCharacter(String name, Location location) { | ||
this.name = name; | ||
this.location = location; | ||
} | ||
public void setLocation(Location location) { | ||
this.location = location; | ||
} | ||
public Location getLocation() { | ||
return location; | ||
} | ||
public void setPosition(int x, int y) { | ||
location.position.x = x; | ||
location.position.y = y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
public class Position { | ||
public int x; | ||
public int y; | ||
public Position(int x, int y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
public Position() { | ||
this(0, 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
import java.util.ArrayList; | ||
|
||
public class Scene { | ||
String name; | ||
Tilemap tilemap; | ||
ArrayList<MapCharacter> characters = new ArrayList<>(); | ||
public Scene(String name) { | ||
this.name = name; | ||
} | ||
public Scene(String name, Tilemap tilemap) { | ||
this.name = name; | ||
this.tilemap = tilemap; | ||
} | ||
public void addCharacter(MapCharacter character) { | ||
characters.add(character); | ||
} | ||
public void removeCharacter(MapCharacter character) { | ||
characters.remove(character); | ||
} | ||
public void setTilemap(Tilemap tilemap) { | ||
this.tilemap = tilemap; | ||
} | ||
public Tilemap getTilemap() { | ||
return tilemap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters