CombatUI

open class CombatUI

Author

tomatopaste A few methods in the UTILS section were copied from MagicLib when they were private and inaccessible, in addition to several static fields at the beginning of the class. References to these methods can probably be replaced with references to the methods in the original MagicLib UI file.

All other code where applicable:

MIT License

Copyright (c) 2024 tomatopaste

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
open class SpriteDimWrapper
Simple wrapper to make drawing sprites easier (not sure why this was necessary, but it is what it is) Only requires an input SpriteAPI

Functions

Link copied to clipboard
open fun dimRender(colour: Color, start: Vector2f, offset: Vector2f, dimWrapper: CombatUI.SpriteDimWrapper, size: Vector2f, tiles: Array<Boolean>, extra: Int, text: String, textOnLeft: Boolean): Float
Renders a series of dims.
Link copied to clipboard
open fun drawDot(x: Float, y: Float)
Unused but useful for UI debugging.
Link copied to clipboard
open fun drawDroneSystemStateWidget(mothership: ShipAPI, tiles: Array<Boolean>, extra: Int, text1: String, text2: String, cooldown: Float, reserve: Int, reserveMax: Int, activeState: Int, numStates: Int, state: String, icon: SpriteAPI, drones: Map<ShipAPI, CombatUI.SpriteDimWrapper>, background: SpriteAPI, shipSprite: CombatUI.SpriteDimWrapper)
Used to draw the Pearson Exotronics drone system HUD elements.
Link copied to clipboard
open fun drawShieldArc(ship: ShipAPI, colour: Color, zoom: Float, center: Vector2f, alpha: Float, angleOffset: Float)
Draws a curved line imitating the shield arc of a ship.
Link copied to clipboard
open fun drawSubsystemStatus(ship: ShipAPI, fill: Float, name: String, extraText: String, extraTextColor: Color, stateText: String, hotkey: String, briefText: String, showInfoText: Boolean, guiBarCount: Int, inputLoc: Vector2f, extraBarPadding: Float, rootLoc: Vector2f): Vector2f
open fun drawSubsystemStatus(ship: ShipAPI, fill: Float, name: String, hudColor: Color, extraText: String, extraTextColor: Color, stateText: String, hotkey: String, briefText: String, showInfoText: Boolean, guiBarCount: Int, inputLoc: Vector2f, extraBarPadding: Float, rootLoc: Vector2f): Vector2f
Draws the status bar for a basic subsystem, imitating the shipsystem UI.
Link copied to clipboard
open fun drawSubsystemsTitle(ship: ShipAPI, showInfo: Boolean, rootLoc: Vector2f, displayAdditionalInfo: Boolean)
Draws the SUBSYSTEM deco element.
Link copied to clipboard
Link copied to clipboard
open fun getNumWeapons(ship: ShipAPI): Int
Determines the number of weapons appearing the weapon list HUD element of the vanilla UI
Link copied to clipboard
open fun getSubsystemsRootLocation(ship: ShipAPI, numBars: Int, barHeight: Float): Vector2f
Determines the root location (top left corner) of Subsystem UI elements by calculating total height of all subsystems on player ship.
Link copied to clipboard
open fun getSubsystemTitleLoc(ship: ShipAPI): Vector2f
Finds the SUBSYSTEM deco element root location.
Link copied to clipboard
open fun iconRender(colour: Color, sprite: SpriteAPI, start: Vector2f, offset: Vector2f, size: Vector2f)
Renders the drone mode icon (but can render any sprite arbitrarily)
Link copied to clipboard
open fun renderAuxiliaryStatusBar(ship: ShipAPI, indent: Float, indentLine: Boolean, fillStartX: Float, fillLength: Float, fillLevel: Float, text1: String, text2: String, text2OnLeft: Boolean, inputLoc: Vector2f)
Renders another subsystem HUD element intended for drone subsystems, but can be used for any purpose.
Link copied to clipboard
open fun reserveRender(colour: Color, start: Vector2f, offset: Vector2f, size: Vector2f, num: Int, max: Int)
Renders indicator squares as progress up a vertical stack.
Link copied to clipboard
open fun spatialRender(colour: Color, start: Vector2f, offset: Vector2f, size: Vector2f, background: SpriteAPI, drones: Map<ShipAPI, CombatUI.SpriteDimWrapper>, mothership: ShipAPI, shipSprite: CombatUI.SpriteDimWrapper)
Renders HUD element of mothership and drones with shields
Link copied to clipboard
open fun stateRender(colour: Color, start: Vector2f, offset: Vector2f, size: Vector2f, text: String, num: Int, active: Int)
Renders a series of hexagons used to indicate an active state out of a series of possible states.
Link copied to clipboard
open fun statusRender(colour: Color, start: Vector2f, offset: Vector2f, size: Vector2f, text: String, fill: Float, hPad: Float, full: Boolean)
Draws a cooldown bar with text.
Link copied to clipboard
open fun systemlikeStatusRender(colour: Color, start: Vector2f, offset: Vector2f, size: Vector2f, text: String, fill: Float, hPad: Float, full: Boolean): Vector2f
Draws a cooldown bar with text.
Link copied to clipboard
open fun tileRender(colour: Color, start: Vector2f, offset: Vector2f, size: Vector2f, tiles: Array<Boolean>, extra: Int, text: String, textOnLeft: Boolean): Float
Renders a series of chevron tiles

Properties

Link copied to clipboard
val BAR_HEIGHT: Float = 13.0f
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val STATUS_BAR_WIDTH: Float = 45.0f