working pen menu

This commit is contained in:
minjaesong
2019-02-16 22:48:27 +09:00
parent 49f8b8d1c8
commit 3c1b4c8a64
11 changed files with 170 additions and 43 deletions

View File

@@ -15,12 +15,19 @@ open class UIItemImageButton(
parent: UICanvas,
val image: TextureRegion,
/** Colour when mouse is over */
val activeCol: Color = UIItemTextButton.defaultActiveCol,
/** Colour when mouse is over */
val activeBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_ACTIVECOL,
/** Colour when mouse is over */
val activeBackBlendMode: String = BlendMode.NORMAL,
/** Colour when clicked/selected */
val highlightCol: Color = UIItemTextButton.defaultHighlightCol,
/** Colour when clicked/selected */
val highlightBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_HIGHLIGHTCOL,
/** Colour when clicked/selected */
val highlightBackBlendMode: String = BlendMode.NORMAL,
/** Colour on normal status */
val inactiveCol: Color = UIItemTextButton.defaultInactiveCol,
val backgroundCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL,
val backgroundBlendMode: String = BlendMode.NORMAL,
@@ -30,6 +37,7 @@ open class UIItemImageButton(
override val width: Int = image.regionWidth,
override val height: Int = image.regionHeight,
/** When clicked, toggle its "lit" status */
var highlightable: Boolean
) : UIItem(parent) {
@@ -89,7 +97,7 @@ open class UIItemImageButton(
}
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
if (mouseUp) {
if (mouseUp && highlightable) {
highlighted = !highlighted
}

View File

@@ -23,16 +23,24 @@ open class UIItemTextButton(
override val width: Int,
val readFromLang: Boolean = false,
val activeCol: Color = defaultActiveCol,
/** Colour when mouse is over */
val activeCol: Color = UIItemTextButton.defaultActiveCol,
/** Colour when mouse is over */
val activeBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_ACTIVECOL,
/** Colour when mouse is over */
val activeBackBlendMode: String = BlendMode.NORMAL,
/** Colour when clicked/selected */
val highlightCol: Color = UIItemTextButton.defaultHighlightCol,
/** Colour when clicked/selected */
val highlightBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_HIGHLIGHTCOL,
/** Colour when clicked/selected */
val highlightBackBlendMode: String = BlendMode.NORMAL,
/** Colour on normal status */
val inactiveCol: Color = UIItemTextButton.defaultInactiveCol,
val backgroundCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL,
val backgroundBlendMode: String = BlendMode.NORMAL,
val preGapX: Int = 0,
val postGapX: Int = 0,

View File

@@ -3,12 +3,7 @@ package net.torvald.terrarum.ui
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.BlendMode
import net.torvald.terrarum.Second
import net.torvald.terrarum.fillRect
import net.torvald.terrarum.gameactors.ai.toInt
import net.torvald.terrarum.roundInt
import net.torvald.terrarum.ui.UIItemTextButton.Companion.defaultActiveCol
import net.torvald.terrarum.*
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
/**
@@ -31,16 +26,24 @@ class UIItemTextButtonList(
val iconCol: Color = UIItemTextButton.defaultInactiveCol,
// copied directly from UIItemTextButton
val activeCol: Color = defaultActiveCol,
val activeBackCol: Color = DEFAULT_BACKGROUND_ACTIVECOL,
/** Colour when mouse is over */
val activeCol: Color = UIItemTextButton.defaultActiveCol,
/** Colour when mouse is over */
val activeBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_ACTIVECOL,
/** Colour when mouse is over */
val activeBackBlendMode: String = BlendMode.NORMAL,
/** Colour when clicked/selected */
val highlightCol: Color = UIItemTextButton.defaultHighlightCol,
val highlightBackCol: Color = DEFAULT_BACKGROUND_HIGHLIGHTCOL,
/** Colour when clicked/selected */
val highlightBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_HIGHLIGHTCOL,
/** Colour when clicked/selected */
val highlightBackBlendMode: String = BlendMode.NORMAL,
/** Colour on normal status */
val inactiveCol: Color = UIItemTextButton.defaultInactiveCol,
val backgroundCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL,
val backgroundBlendMode: String = BlendMode.NORMAL,
val kinematic: Boolean = false,
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.CENTRE,