Compare commits

..

12 Commits

16 changed files with 9440 additions and 154 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.6 MiB

View File

@@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-permission android:name="android.permission.INTERNET" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:fullBackupContent="true" android:fullBackupContent="true"

View File

@@ -1,19 +0,0 @@
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)
}

View File

@@ -0,0 +1,6 @@
package com.iofferyoutea.WitchQueen
class Client(val hostAddress: String, val hostPort: Int, val playerProfile: PlayerProfile) {
val preparedItems: MutableList<Int> = mutableListOf(0, 0, 0, 0) // Item ID. 0 for no item
lateinit var map: Map
}

View File

@@ -0,0 +1,4 @@
package com.iofferyoutea.WitchQueen
class Game(val clients: Array<Client>) {
}

View File

@@ -1,5 +1,6 @@
package com.iofferyoutea.WitchQueen package com.iofferyoutea.WitchQueen
import com.badlogic.gdx.Game
import com.badlogic.gdx.graphics.Texture import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.Texture.TextureFilter.Linear import com.badlogic.gdx.graphics.Texture.TextureFilter.Linear
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
@@ -10,13 +11,12 @@ import ktx.assets.disposeSafely
import ktx.assets.toInternalFile import ktx.assets.toInternalFile
import ktx.async.KtxAsync import ktx.async.KtxAsync
import ktx.graphics.use import ktx.graphics.use
import java.lang.ref.WeakReference
class Main : KtxGame<KtxScreen>() { class Main : KtxGame<KtxScreen>() {
override fun create() { override fun create() {
KtxAsync.initiate() KtxAsync.initiate()
// addScreen(FirstScreen())
// setScreen<FirstScreen>()
addScreen(MainMenu()) addScreen(MainMenu())
setScreen<MainMenu>() setScreen<MainMenu>()
} }

View File

@@ -2,87 +2,51 @@ 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.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.VerticalGroup import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.badlogic.gdx.scenes.scene2d.ui.Value
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
class MainMenu : KtxScreen { class MainMenu : KtxScreen {
val table = Table().apply { val stage = Stage()
setFillParent(true)
debug = true
}
val stage = Stage().apply {
Gdx.input.inputProcessor = this
addActor(table)
}
// Map Selection Button val table = Table()
var tableWidthPadAmount = 0.8f
var tableHeightPadAmount = 0.8f
// Player Table //region Buttons
// val inviteButton = Button( val defaultButtonTrd = TextureRegionDrawable(Texture("default.png"))
// "default.png", val flippedDefaultButtonTrd = TextureRegionDrawable(Texture("default_flipped.png"))
// "default_flipped.png", val defaultTextButtonStyle = TextButton.TextButtonStyle (
// "", defaultButtonTrd,
// "Invite Player", flippedDefaultButtonTrd,
// true, defaultButtonTrd,
// 2f BitmapFont()
// ).apply {
// table.add(this.button).size(1024f, 512f)
// table.row()
// }
// Invite Player Button
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
) )
val defaultButton = TextButton("Default Button", defaultTextButtonStyle)
//endregion
// Competitive Button override fun show() {
val competitiveButton = Button( // Stage Setup
"default.png", Gdx.input.inputProcessor = stage
"default_flipped.png", stage.addActor(table)
"",
"Competitive",
true,
2f
)
val playButtonGroup = HorizontalGroup().apply { // Table Setup
addActor(casualButton.button) table.debug = true
addActor(competitiveButton.button) table.setPosition(
table.add(this) stage.width * ((1 - tableWidthPadAmount) / 2),
stage.height * ((1 - tableHeightPadAmount) / 2)
) // This centres the table
table.setSize(stage.width * tableWidthPadAmount, stage.height * tableHeightPadAmount)
table.add(defaultButton).growX().height(Value.percentWidth(9f / 32f, table)) // We use a FreeTypeFontGenerator to do font sizing maybe?
} }
override fun render(delta: Float) { override fun render(delta: Float) {
super.render(delta) clearScreen(0f, 0f, 0f)
clearScreen(0f, 255f, 0f)
stage.act(delta) stage.act(delta)
stage.draw() stage.draw()

View File

@@ -0,0 +1,6 @@
package com.iofferyoutea.WitchQueen
class Map(val mapType: MapType) {
val rooms = Array(2) { Array<Room>(2) { Room(mapType) } } // We use an array instead of list i think
}

View File

@@ -0,0 +1,5 @@
package com.iofferyoutea.WitchQueen
enum class MapType {
DUNGEON, STREETS
}

View File

@@ -0,0 +1,10 @@
package com.iofferyoutea.WitchQueen
enum class PlayerState {
IDLE, LOOTING, FIGHTING
}
class Player(val map: Map) {
var currentState = PlayerState.IDLE
val currentRoom = arrayOf(0, 0) // Make this a spawn room or something
}

View File

@@ -0,0 +1,7 @@
package com.iofferyoutea.WitchQueen
class PlayerProfile {
var iconPath = "default.png"
var username = "Default"
val availableItems: MutableList<Int> = mutableListOf() // Use Item IDs?
}

View File

@@ -1,62 +0,0 @@
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)
}

View File

@@ -1,4 +0,0 @@
package com.iofferyoutea.WitchQueen
class PlayerTablePlaceholderButton {
}

View File

@@ -0,0 +1,12 @@
package com.iofferyoutea.WitchQueen
enum class RoomActivity {
EMPTY, LOOT, FIGHT
}
class Room(val mapType: MapType) {
var availableActivities: MutableList<RoomActivity> = mutableListOf()
init {
// Generate Room in this init block!
}
}