Compare commits
4 Commits
01da51665e
...
1960fa51a7
| Author | SHA256 | Date | |
|---|---|---|---|
| 1960fa51a7 | |||
| 75d7e3e101 | |||
| f915f7bbba | |||
| 1136fd018d |
BIN
Raw Assets/player-frame-pressed.aseprite
Normal file
BIN
Raw Assets/player-frame.aseprite
Normal file
BIN
Raw Assets/prepared-item-frame.aseprite
Normal file
@@ -14,7 +14,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="com.iofferyoutea.WitchQueen.android.AndroidLauncher"
|
android:name="com.iofferyoutea.WitchQueen.android.AndroidLauncher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="portrait"
|
||||||
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout"
|
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
BIN
WitchQueen/assets/default_flipped.png
Normal file
|
After Width: | Height: | Size: 94 B |
BIN
WitchQueen/assets/grey-plus.png
Normal file
|
After Width: | Height: | Size: 108 B |
BIN
WitchQueen/assets/player-frame-down.png
Normal file
|
After Width: | Height: | Size: 197 B |
BIN
WitchQueen/assets/player-frame-up.png
Normal file
|
After Width: | Height: | Size: 216 B |
BIN
WitchQueen/assets/player-frame.png
Normal file
|
After Width: | Height: | Size: 211 B |
BIN
WitchQueen/assets/prepared-item-frame.png
Normal file
|
After Width: | Height: | Size: 154 B |
BIN
WitchQueen/assets/red-x.png
Normal file
|
After Width: | Height: | Size: 129 B |
BIN
WitchQueen/assets/transparent.png
Normal file
|
After Width: | Height: | Size: 81 B |
@@ -0,0 +1,19 @@
|
|||||||
|
package com.iofferyoutea.WitchQueen
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Texture
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||||
|
import ktx.assets.toInternalFile
|
||||||
|
|
||||||
|
open class Button(val upTexturePath: String, val downTexturePath: String, val fontPath: String, val defaultText: String = "New Button", val useDefaultFont: Boolean = true, val fontScale: Float = 1f) {
|
||||||
|
val buttonText = defaultText
|
||||||
|
val buttonUp = TextureRegionDrawable(Texture(upTexturePath))
|
||||||
|
val buttonDown = TextureRegionDrawable(Texture(downTexturePath))
|
||||||
|
val buttonFont = (if (useDefaultFont) BitmapFont() else BitmapFont(fontPath.toInternalFile())).apply { data.scale(fontScale) }
|
||||||
|
|
||||||
|
val buttonStyle = TextButtonStyle().apply { up = buttonUp; down = buttonDown; font = buttonFont }
|
||||||
|
|
||||||
|
val button = TextButton(defaultText, buttonStyle)
|
||||||
|
}
|
||||||
@@ -2,17 +2,15 @@ package com.iofferyoutea.WitchQueen
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
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 com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||||
import ktx.app.KtxScreen
|
import ktx.app.KtxScreen
|
||||||
import ktx.app.clearScreen
|
import ktx.app.clearScreen
|
||||||
import ktx.assets.toInternalFile
|
|
||||||
import com.badlogic.gdx.graphics.Texture.TextureFilter.Nearest
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
|
||||||
|
|
||||||
class MainMenu : KtxScreen {
|
class MainMenu : KtxScreen {
|
||||||
val table = Table().apply {
|
val table = Table().apply {
|
||||||
@@ -24,16 +22,62 @@ class MainMenu : KtxScreen {
|
|||||||
addActor(table)
|
addActor(table)
|
||||||
}
|
}
|
||||||
|
|
||||||
val mySkin = Skin("uiskin.json".toInternalFile())
|
// Map Selection Button
|
||||||
|
|
||||||
val textureRegion = TextureRegion(Texture("default.png").apply { setFilter(Nearest,
|
// Player Table
|
||||||
Nearest
|
// val inviteButton = Button(
|
||||||
)} )
|
// "default.png",
|
||||||
val buttonFont = BitmapFont("default.fnt".toInternalFile())
|
// "default_flipped.png",
|
||||||
val style = TextButton.TextButtonStyle().apply { up = TextureRegionDrawable(textureRegion); font = buttonFont }
|
// "",
|
||||||
|
// "Invite Player",
|
||||||
|
// true,
|
||||||
|
// 2f
|
||||||
|
// ).apply {
|
||||||
|
// table.add(this.button).size(1024f, 512f)
|
||||||
|
// table.row()
|
||||||
|
// }
|
||||||
|
|
||||||
val button = TextButton("Button", style).apply {
|
// Invite Player Button
|
||||||
table.add(this).size(512f, 512f)
|
val playerPlaceholderButtonUp = TextureRegionDrawable(Texture("player-frame-up.png"))
|
||||||
|
val playerPlaceholderButtonDown = TextureRegionDrawable(Texture("player-frame-down.png"))
|
||||||
|
val playerPlaceholderButtonChecked = TextureRegionDrawable(Texture("player-frame-up.png"))
|
||||||
|
val playerPlaceholderButtonStyle = ImageButton.ImageButtonStyle()
|
||||||
|
.apply { up = playerPlaceholderButtonUp; down = playerPlaceholderButtonDown; checked = playerPlaceholderButtonChecked }
|
||||||
|
val playerPlaceholderButton = ImageButton(playerPlaceholderButtonStyle)
|
||||||
|
|
||||||
|
val player1TableButton = PlayerTableButton() // These should only be collections no t buttons?
|
||||||
|
val player2TableButton = PlayerTableButton() // Since the collection contains the buttons we need anyway?
|
||||||
|
val playerTableButtonCollection = VerticalGroup().apply {
|
||||||
|
addActor(player1TableButton.button)
|
||||||
|
addActor(playerPlaceholderButton)
|
||||||
|
table.add(this)
|
||||||
|
table.row()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Casual Button
|
||||||
|
val casualButton = Button(
|
||||||
|
"default.png",
|
||||||
|
"default_flipped.png",
|
||||||
|
"",
|
||||||
|
"Casual",
|
||||||
|
true,
|
||||||
|
2f
|
||||||
|
)
|
||||||
|
|
||||||
|
// Competitive Button
|
||||||
|
val competitiveButton = Button(
|
||||||
|
"default.png",
|
||||||
|
"default_flipped.png",
|
||||||
|
"",
|
||||||
|
"Competitive",
|
||||||
|
true,
|
||||||
|
2f
|
||||||
|
)
|
||||||
|
|
||||||
|
val playButtonGroup = HorizontalGroup().apply {
|
||||||
|
addActor(casualButton.button)
|
||||||
|
addActor(competitiveButton.button)
|
||||||
|
table.add(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.iofferyoutea.WitchQueen
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.Texture
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||||
|
import ktx.assets.toInternalFile
|
||||||
|
|
||||||
|
class PlayerTableButton(val playerIconPath: String = "default.png", val newPlayerName: String = "PLAYER"):
|
||||||
|
Table() {
|
||||||
|
val playerIcon = Image(Texture(playerIconPath))
|
||||||
|
val playerNameStyle = Label.LabelStyle(BitmapFont("default.fnt".toInternalFile()), Color.WHITE)
|
||||||
|
val playerName = Label(newPlayerName, playerNameStyle)
|
||||||
|
// Change preparedItems and kickButton into actual buttons
|
||||||
|
var preparedItems: MutableList<Image> = mutableListOf( // We should use libGDX scene2d.ui List?
|
||||||
|
Image(Texture("prepared-item-frame.png")),
|
||||||
|
Image(Texture("prepared-item-frame.png")),
|
||||||
|
Image(Texture("prepared-item-frame.png")),
|
||||||
|
Image(Texture("prepared-item-frame.png"))
|
||||||
|
)
|
||||||
|
val preparedItemsGroup = HorizontalGroup().apply {
|
||||||
|
for (item in preparedItems) addActor(item)
|
||||||
|
}
|
||||||
|
val kickButton = Image(Texture("red-x.png"))
|
||||||
|
|
||||||
|
// Sub-table for Player/Items stack - Use VerticalGroup instead
|
||||||
|
// val playerPlusItemsStack = Table().apply {
|
||||||
|
// add(playerName)
|
||||||
|
// row()
|
||||||
|
// for (item in preparedItems) add(item)
|
||||||
|
// }
|
||||||
|
val playerLabelPlusItemsGroup = VerticalGroup().apply {
|
||||||
|
addActor(playerName)
|
||||||
|
addActor(preparedItemsGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sub-table for the contents of the PlayerTableButton - Use HorizontalGroup instead
|
||||||
|
// val subTable = Table().apply {
|
||||||
|
// add(playerName, playerPlusItemsStack, kickButton)
|
||||||
|
// }
|
||||||
|
val componentCollection = HorizontalGroup().apply {
|
||||||
|
addActor(playerIcon)
|
||||||
|
addActor(playerLabelPlusItemsGroup)
|
||||||
|
addActor(kickButton)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Base Button stuff
|
||||||
|
val buttonUp = TextureRegionDrawable(Texture("transparent.png"))
|
||||||
|
val buttonDown = TextureRegionDrawable(Texture("transparent.png"))
|
||||||
|
val buttonChecked = TextureRegionDrawable(Texture("transparent.png"))
|
||||||
|
|
||||||
|
val buttonStyle = ButtonStyle().apply { up = buttonUp; down = buttonDown; checked = buttonChecked }
|
||||||
|
|
||||||
|
val button = Button(componentCollection, buttonStyle)
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.iofferyoutea.WitchQueen
|
||||||
|
|
||||||
|
class PlayerTablePlaceholderButton {
|
||||||
|
}
|
||||||