Verified Commit a59f02c1 authored by Mathias O. Myklebust's avatar Mathias O. Myklebust 🦆
Browse files

Change Game.WIDTH/HEIGHT to Float

parent 95c8d7af
......@@ -15,10 +15,10 @@ class Game : ApplicationAdapter() {
private lateinit var batch: SpriteBatch
companion object {
const val WIDTH = 2280
const val HEIGHT = 1080
const val TITLE = "Battlegoose"
val viewPort = FitViewport(WIDTH.toFloat(), HEIGHT.toFloat())
const val WIDTH = 2280f
const val HEIGHT = 1080f
const val TITLE = "BattleGoose"
val viewPort = FitViewport(WIDTH, HEIGHT)
/**
* Public function that scales Gdx values to Viewport values
......@@ -31,7 +31,7 @@ class Game : ApplicationAdapter() {
override fun create() {
batch = SpriteBatch()
resize(WIDTH, HEIGHT)
resize(WIDTH.toInt(), HEIGHT.toInt())
GameStateManager.push(MainMenuState())
}
......
......@@ -13,7 +13,7 @@ class CreateLobbyState : GameState() {
protected var cam: OrthographicCamera = OrthographicCamera()
init {
cam.setToOrtho(false, Game.WIDTH.toFloat(), Game.HEIGHT.toFloat())
cam.setToOrtho(false, Game.WIDTH, Game.HEIGHT)
}
private val background = Texture("placeholder.png")
......
......@@ -50,7 +50,7 @@ class MainMenuView(
}
override fun render(sb: SpriteBatch) {
sb.draw(background, 0f, 0f, Game.WIDTH.toFloat(), Game.HEIGHT.toFloat())
sb.draw(background, 0f, 0f, Game.WIDTH, Game.HEIGHT)
createLobbyBtn.render(sb)
joinLobbyBtn.render(sb)
quickJoinBtn.render(sb)
......
......@@ -10,8 +10,8 @@ object DesktopLauncher {
fun main(arg: Array<String>) {
val config = LwjglApplicationConfiguration()
LwjglApplication(Game(), config)
config.width = Game.WIDTH
config.height = Game.HEIGHT
config.width = Game.WIDTH.toInt()
config.height = Game.HEIGHT.toInt()
config.title = Game.TITLE
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment