Skip to content

Commit

Permalink
feat(view): add characte creation view and entry view
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Hoefer committed Dec 17, 2020
1 parent c117e59 commit 7d2e3f6
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package com.github.xetra11.ck3workbench.app
import androidx.compose.runtime.mutableStateOf

object ViewManager {
val currentView = mutableStateOf(View.CHARACTER_VIEW)
val currentView = mutableStateOf(View.ENTRY_VIEW)

enum class View {
CHARACTER_VIEW,
OTHER_VIEW
CHARACTER_CREATE_VIEW,
ENTRY_VIEW,
DYNASTY_VIEW
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fun WorkbenchPanel() {
val squareImage = imageResource("$panzerImagesPath/BG_Square_Brown.png")
val crownImage = imageResource("$panzerImagesPath/Piece_Crown_Rusty.png")
val bloodImage = imageResource("$panzerImagesPath/Piece_Blood.png")
val plusIconImage = imageResource("icons/plus.png")

Column(Modifier.fillMaxHeight(0.8F), verticalArrangement = Arrangement.SpaceBetween) {
Box(
Expand All @@ -33,7 +34,15 @@ fun WorkbenchPanel() {
Image(crownImage, modifier = Modifier.fillMaxSize(0.7F))
}
Box(
boxModifier.clickable(onClick = { ViewManager.currentView.value = ViewManager.View.OTHER_VIEW }),
boxModifier.clickable(onClick = { ViewManager.currentView.value = ViewManager.View.CHARACTER_CREATE_VIEW }),
contentAlignment = Alignment.Companion.Center,
) {
Image(squareImage)
Image(crownImage, modifier = Modifier.fillMaxSize(0.7F))
Image(plusIconImage, modifier = Modifier.fillMaxSize(0.4F).align(Alignment.BottomEnd))
}
Box(
boxModifier.clickable(onClick = { ViewManager.currentView.value = ViewManager.View.DYNASTY_VIEW }),
contentAlignment = Alignment.Companion.Center,
) {
Image(squareImage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ package com.github.xetra11.ck3workbench.module.character.view

import androidx.compose.runtime.Composable
import com.github.xetra11.ck3workbench.app.ViewManager
import com.github.xetra11.ck3workbench.app.view.EntryView

@Composable
fun CurrentMainView() {
when (ViewManager.currentView.value) {
ViewManager.View.ENTRY_VIEW -> EntryView()
ViewManager.View.DYNASTY_VIEW -> DynastieModuleView()
ViewManager.View.CHARACTER_VIEW -> CharacterModuleView()
ViewManager.View.OTHER_VIEW -> DynastieModuleView()
ViewManager.View.CHARACTER_CREATE_VIEW -> CharacterCreateView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.xetra11.ck3workbench.app.view

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp

@Composable
fun EntryView() {
Column(modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text("Welcome to CK3-Workbench", fontSize = TextUnit.Companion.Sp(15), modifier = Modifier.padding(bottom = 5.dp) )
Text("On the left panel you can choose a function category", fontSize = TextUnit.Companion.Sp(10) )
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.xetra11.ck3workbench.module.character.view

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp

@Composable
fun CharacterCreateView() {
Column(modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Top
) {
Text("Character Creation", fontSize = TextUnit.Sp(15), modifier = Modifier.padding(bottom = 5.dp) )
Text("In here you can create new characters", fontSize = TextUnit.Sp(10) )
}

}
Binary file added src/main/resources/icons/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7d2e3f6

Please sign in to comment.