Start re-creating main menu
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
package com.iofferyoutea.WitchQueen
|
||||||
|
|
||||||
|
class Game(val clients: Array<Client>) {
|
||||||
|
}
|
||||||
@@ -17,8 +17,8 @@ class Main : KtxGame<KtxScreen>() {
|
|||||||
override fun create() {
|
override fun create() {
|
||||||
KtxAsync.initiate()
|
KtxAsync.initiate()
|
||||||
|
|
||||||
addScreen(FirstScreen())
|
addScreen(MainMenu())
|
||||||
setScreen<FirstScreen>()
|
setScreen<MainMenu>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.iofferyoutea.WitchQueen
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.graphics.Texture
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Container
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||||
|
import ktx.app.KtxScreen
|
||||||
|
import ktx.app.clearScreen
|
||||||
|
import org.w3c.dom.Text
|
||||||
|
|
||||||
|
class MainMenu : KtxScreen {
|
||||||
|
val table = Table().apply {
|
||||||
|
debug = true
|
||||||
|
setFillParent(true)
|
||||||
|
}
|
||||||
|
val stage = Stage().apply {
|
||||||
|
Gdx.input.inputProcessor = this
|
||||||
|
addActor(table)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default
|
||||||
|
val defaultButtonTrd = TextureRegionDrawable(Texture("default.png"))
|
||||||
|
val flippedDefaultButtonTrd = TextureRegionDrawable(Texture("default_flipped.png"))
|
||||||
|
val defaultTextButtonStyle = TextButton.TextButtonStyle (
|
||||||
|
defaultButtonTrd,
|
||||||
|
flippedDefaultButtonTrd,
|
||||||
|
defaultButtonTrd,
|
||||||
|
BitmapFont()
|
||||||
|
)
|
||||||
|
|
||||||
|
// Map
|
||||||
|
|
||||||
|
// Lobby
|
||||||
|
// Start off only showing Host and Join button. When selected show menu for that option.
|
||||||
|
// Host is normal lobby
|
||||||
|
// Join will bring up menu with games on local network
|
||||||
|
val hostButton = TextButton("Host", defaultTextButtonStyle)
|
||||||
|
val joinButton = TextButton("Join", defaultTextButtonStyle)
|
||||||
|
val hostOrJoinVerticalGroup = VerticalGroup().apply {
|
||||||
|
addActor(hostButton)
|
||||||
|
addActor(joinButton)
|
||||||
|
}
|
||||||
|
val lobbyContainer = Container<Actor>(hostOrJoinVerticalGroup).apply {
|
||||||
|
table.add(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
//region Play
|
||||||
|
val casualButton = TextButton("Casual", defaultTextButtonStyle).apply {
|
||||||
|
table.row()
|
||||||
|
table.add(this)
|
||||||
|
}
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
private fun update(delta: Float) {
|
||||||
|
if (hostButton.isPressed) {
|
||||||
|
Gdx.app.log("MainMenu", "Host button pressed")
|
||||||
|
}
|
||||||
|
if (joinButton.isPressed) {
|
||||||
|
Gdx.app.log("MainMenu", "Join button pressed")
|
||||||
|
}
|
||||||
|
if (casualButton.isPressed) {
|
||||||
|
Gdx.app.log("MainMenu", "Casual button pressed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun render(delta: Float) {
|
||||||
|
clearScreen(0f,0f, 0f)
|
||||||
|
|
||||||
|
update(delta)
|
||||||
|
|
||||||
|
stage.act(delta)
|
||||||
|
stage.draw()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
stage.dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.iofferyoutea.WitchQueen
|
package com.iofferyoutea.WitchQueen
|
||||||
|
|
||||||
class Map(val mapType: MapType) {
|
class Map(val mapType: MapType) {
|
||||||
val rooms = Array(2) { Array<Room>(2) { Room.new } } // We use an array instead of list i think
|
val rooms = Array(2) { Array<Room>(2) { Room(mapType) } } // We use an array instead of list i think
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ enum class PlayerState {
|
|||||||
|
|
||||||
class Player(val map: Map) {
|
class Player(val map: Map) {
|
||||||
var currentState = PlayerState.IDLE
|
var currentState = PlayerState.IDLE
|
||||||
val currentRoom
|
val currentRoom = arrayOf(0, 0) // Make this a spawn room or something
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user