Compare commits
2 Commits
7974cbd0af
...
fe79c271fa
| Author | SHA256 | Date | |
|---|---|---|---|
| fe79c271fa | |||
| ddab82ec7f |
@@ -2,6 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:fullBackupContent="true"
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Net
|
||||
|
||||
class Lobby {
|
||||
//val localServers: MutableSetOf<String> = setOf<String>() <-- HashSet?
|
||||
|
||||
//val localPlayer: Player = <-- Should be local player. Has all their items etc.
|
||||
//val lobby: MutableList<Player> = listOf<Player>(localPlayer) <-- Limit to lobby size (2)?
|
||||
|
||||
val serverSocket = Gdx.net.newServerSocket(
|
||||
Net.Protocol.TCP,
|
||||
"127.0.0.1",
|
||||
2864,
|
||||
null
|
||||
)
|
||||
|
||||
val clientSocket = Gdx.net.newClientSocket(
|
||||
Net.Protocol.TCP,
|
||||
"127.0.0.1", // <- This should be other servers address
|
||||
2864, // <- This should be other servers port
|
||||
null
|
||||
)
|
||||
|
||||
val inputStream = clientSocket.inputStream
|
||||
|
||||
private fun findLocalServer() {
|
||||
Gdx.app.log("Lobby", "Finding local server...")
|
||||
|
||||
}
|
||||
|
||||
private fun replayHasLocalServer(remoteAddress: String, remotePort: Int) {
|
||||
Gdx.app.log("Lobby", "Pinged by another client. Informing that we have an open lobby...")
|
||||
}
|
||||
|
||||
private fun connectToServer(ip: String, port: Int) { // String is the ideal type for ip because v6 uses letters too?
|
||||
Gdx.app.log("Lobby", "Connecting to $ip on port $port...")
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,10 @@ package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g3d.ModelCache
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle
|
||||
@@ -15,12 +18,16 @@ import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||
import com.badlogic.gdx.utils.Logger
|
||||
import com.badlogic.gdx.utils.Scaling
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport
|
||||
import com.badlogic.gdx.utils.viewport.StretchViewport
|
||||
import com.badlogic.gdx.utils.viewport.Viewport
|
||||
import ktx.actors.centerPosition
|
||||
import ktx.actors.setPosition
|
||||
import ktx.actors.stage
|
||||
import ktx.app.KtxScreen
|
||||
import ktx.app.clearScreen
|
||||
import javax.swing.text.View
|
||||
|
||||
class MainMenu : KtxScreen {
|
||||
val myTable = Table().apply {
|
||||
@@ -28,7 +35,10 @@ class MainMenu : KtxScreen {
|
||||
setFillParent(true)
|
||||
}
|
||||
val myStage = Stage().apply {
|
||||
Gdx.input.inputProcessor = this
|
||||
addActor(myTable)
|
||||
// We need this to get the size of the table later
|
||||
//myTable.setSize(viewport.screenWidth.toFloat(), viewport.screenHeight.toFloat())
|
||||
}
|
||||
|
||||
//region Map Button
|
||||
@@ -42,32 +52,28 @@ class MainMenu : KtxScreen {
|
||||
)
|
||||
val mapButton = ImageButton(mapButtonStyle).apply {
|
||||
myTable.add(this)
|
||||
myTable.getCell<ImageButton>(this).padBottom(myStage.viewport.screenHeight * 0.05f) // Figure out how to centre
|
||||
myTable.getCell<ImageButton>(this)
|
||||
}
|
||||
//endregion
|
||||
|
||||
//endregion
|
||||
//region Player Buttons
|
||||
// Local Player
|
||||
// Remote Player
|
||||
val remotePlayerButton = PlayerButton().apply {
|
||||
myTable.row()
|
||||
myTable.add(this.playerGroup)
|
||||
myTable.getCell<HorizontalGroup>(this.playerGroup).padBottom(myStage.viewport.screenHeight * 0.05f) // You've got to size the sub actors!
|
||||
myTable.getCell<HorizontalGroup>(this.playerGroup) // You've got to size the sub actors!
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region Play Buttons
|
||||
val casualButtonStyle = TextButton.TextButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default_flipped.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
BitmapFont()
|
||||
)
|
||||
val casualButton = TextButton("Casual", casualButtonStyle).apply {
|
||||
myTable.row() // Start with a new row
|
||||
myTable.add(this)
|
||||
myTable.getCell<TextButton>(this)
|
||||
}
|
||||
val casualButton = TextButton("Casual", casualButtonStyle)
|
||||
|
||||
val competitiveButtonStyle = TextButton.TextButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
@@ -75,17 +81,31 @@ class MainMenu : KtxScreen {
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
BitmapFont()
|
||||
)
|
||||
val competitiveButton = TextButton("Competitive", competitiveButtonStyle).apply {
|
||||
val competitiveButton = TextButton("Competitive", competitiveButtonStyle)
|
||||
|
||||
// We need to wrap the play buttons in a group so they only take up 1 column
|
||||
val playButtonGroup = HorizontalGroup().apply {
|
||||
addActor(casualButton)
|
||||
addActor(competitiveButton)
|
||||
myTable.row()
|
||||
myTable.add(this)
|
||||
myTable.getCell<TextButton>(this).padLeft(myStage.viewport.screenWidth * 0.1f)
|
||||
myTable.getCell<HorizontalGroup>(this)
|
||||
}
|
||||
//endregion
|
||||
|
||||
private fun update(delta: Float) {
|
||||
if (casualButton.isPressed) {
|
||||
Gdx.app.log("MainMenu", "Casual Button Pressed!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
clearScreen(0.3f, 0.3f, 0.3f)
|
||||
|
||||
myStage.act(delta)
|
||||
myStage.draw()
|
||||
|
||||
update(delta)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
Reference in New Issue
Block a user