summaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/api/Button.kt2
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/main.kt4
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt1
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt1
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/states/MainMenu.kt8
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt1
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/states/SplashScreen.kt1
7 files changed, 16 insertions, 2 deletions
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/api/Button.kt b/src/main/kotlin/de/romjaki/pluggabledino/api/Button.kt
index b21761c..0fc8ddb 100644
--- a/src/main/kotlin/de/romjaki/pluggabledino/api/Button.kt
+++ b/src/main/kotlin/de/romjaki/pluggabledino/api/Button.kt
@@ -59,7 +59,7 @@ class Button(private val text: String, val x: Float, val y: Float) {
}
fun isMouseOver(input: Input): Boolean =
- rectangle.contains(input.mouseX, input.mouseY)
+ rectangle.contains(input.mouseX / 5 * 4, input.mouseY / 5 * 4)
}
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/main.kt b/src/main/kotlin/de/romjaki/pluggabledino/main.kt
index 1e86140..8be56f9 100644
--- a/src/main/kotlin/de/romjaki/pluggabledino/main.kt
+++ b/src/main/kotlin/de/romjaki/pluggabledino/main.kt
@@ -14,6 +14,8 @@ import org.newdawn.slick.state.StateBasedGame
const val WIDTH = 640
const val HEIGHT = 480
+const val REAL_WIDTH = 800
+const val REAL_HEIGHT = 600
const val FPS = 60
const val VERSION = 1.0
@@ -27,7 +29,7 @@ fun main(args: Array<String>) {
PluginLoader.loadPlugins()
Input.disableControllers()
val app = AppGameContainer(Application())
- app.setDisplayMode(WIDTH, HEIGHT, false)
+ app.setDisplayMode(REAL_WIDTH, REAL_HEIGHT, false)
app.setTargetFrameRate(FPS)
app.setShowFPS(true)
Events.broadcastEvent(PreInitEvent())
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt
index 3f3a01e..ae34db5 100644
--- a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt
+++ b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt
@@ -36,6 +36,7 @@ class GameState : BasicGameState() {
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
g!!
+ g.scale(1.25f,1.25f)
g.background = Color.white
if (world.hurt) {
g.background = Color.red
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt
index 9ebd2be..88b6daf 100644
--- a/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt
+++ b/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt
@@ -32,6 +32,7 @@ class LostState : BasicGameState() {
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
g!!
+ g.scale(1.25f,1.25f)
g.background = Color.lightGray
back.draw(g)
playAgain.draw(g)
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/MainMenu.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/MainMenu.kt
index f10a470..0d4d23b 100644
--- a/src/main/kotlin/de/romjaki/pluggabledino/states/MainMenu.kt
+++ b/src/main/kotlin/de/romjaki/pluggabledino/states/MainMenu.kt
@@ -18,11 +18,15 @@ class MainMenu : BasicGameState() {
playButton.addClickHandler {
game.enterState(GAME)
}
+ leaveButton.addClickHandler {
+ System.exit(0)
+ }
}
override fun enter(container: GameContainer?, game: StateBasedGame?) {
settingsButton.enter()
playButton.enter()
+ leaveButton.enter()
}
override fun update(container: GameContainer?, game: StateBasedGame?, delta: Int) {
@@ -32,6 +36,7 @@ class MainMenu : BasicGameState() {
if (container.input.isKeyDown(Input.KEY_Q)) {
System.exit(0)
}
+ leaveButton.update(container.input)
settingsButton.update(container.input)
playButton.update(container.input)
}
@@ -39,14 +44,17 @@ class MainMenu : BasicGameState() {
override fun getID(): Int =
MAINMENU
+ val leaveButton = Button("LEAVE", WIDTH / 2f, HEIGHT / 2f + 150)
val playButton = Button("PLAY", WIDTH / 2f, HEIGHT / 2f + 50)
val settingsButton = Button("SETTINGS", WIDTH / 2f, HEIGHT / 2f + 100)
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
g!!
+ g.scale(1.25f,1.25f)
g.background = Color.lightGray
g.drawImage(dinoAnimated.currentFrame, WIDTH / 2f - 16, HEIGHT / 2f - 16f)
playButton.draw(g)
settingsButton.draw(g)
+ leaveButton.draw(g)
}
}
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt
index 5003232..bceb6af 100644
--- a/src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt
+++ b/src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt
@@ -35,6 +35,7 @@ class SettingsState : BasicGameState() {
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
g!!
+ g.scale(1.25f,1.25f)
g.background = Color.lightGray
backButton.draw(g)
}
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/SplashScreen.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/SplashScreen.kt
index d39b31a..717bdb2 100644
--- a/src/main/kotlin/de/romjaki/pluggabledino/states/SplashScreen.kt
+++ b/src/main/kotlin/de/romjaki/pluggabledino/states/SplashScreen.kt
@@ -32,6 +32,7 @@ class SplashScreen : BasicGameState() {
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
g!!
+ g.scale(1.25f,1.25f)
g.drawImage(splash, 0f, 0f)
g.drawStringCentered("CLICK ANYWHERE TO CONTINUE", WIDTH / 2f, HEIGHT / 2f)
}