Introduce IconScope

This commit is contained in:
Fingercomp 2025-08-17 17:07:07 +03:00
parent ce2eeaec0a
commit cbc16a3d23
No known key found for this signature in database
GPG Key ID: BBC71CEE45D86E37
5 changed files with 317 additions and 345 deletions

View File

@ -2,7 +2,6 @@ version = 3.9.9
runner.dialect = scala213
preset = default
maxColumn = 120
indent.defnSite = 2
align = {
preset = none
@ -27,4 +26,10 @@ docstrings = {
oneline = unfold
wrap = keep
forceBlankLineBefore = false
}
}
indent {
defnSite = 2
extendSite = 2
withSiteRelativeToExtends = 2
}

View File

@ -8,12 +8,41 @@ import totoro.ocelot.brain.util.DyeColor
import totoro.ocelot.brain.util.ExtendedTier.ExtendedTier
import totoro.ocelot.brain.util.Tier.Tier
case class IconSource(
path: String,
animation: Option[IconSource.Animation] = None,
)
case class IconSource(path: String, animation: Option[IconSource.Animation] = None)
object IconSource {
case class Animation(frames: Array[(Int, Float)], frameSize: Option[Size2D])
object Animation {
def apply(frames: (Int, Float)*) = new Animation(frames.toArray, None)
def apply(size: Size2D)(frames: (Int, Float)*) = new Animation(frames.toArray, Some(size))
def apply(size: Option[Size2D] = None)(frames: Array[(Int, Float)]) = new Animation(frames, size)
}
class IconScope(directory: String)(implicit parent: Option[IconScope]) {
// this makes nested `IconScope` declarations use `this` as their parent scope.
implicit def scope: Option[IconScope] = Some(this)
private def prefix: String = parent match {
case Some(parent) => s"${parent.prefix}/$directory"
case None => directory
}
protected def get(name: String): IconSource = {
get(name, None)
}
protected def get(name: String, animation: Animation): IconSource = {
get(name, Some(animation))
}
protected def get(name: String, animation: Option[Animation]): IconSource = {
IconSource(s"$prefix/$name", animation)
}
}
private implicit val scope: Option[IconScope] = None
val Empty: IconSource = IconSource("Empty")
val EmptySlot: IconSource = IconSource("EmptySlot")
val ShadowCorner: IconSource = IconSource("ShadowCorner")
@ -27,75 +56,95 @@ object IconSource {
val KnobLimits: IconSource = IconSource("KnobLimits")
val KnobCenter: IconSource = IconSource("KnobCenter")
object Items {
protected val prefix: String = "items"
val Loading: IconSource = IconSource(
"Loading",
Some(
Animation(Size2D(48, 32))(
(0, 0.7f),
(1, 0.7f),
(2, 0.7f),
(3, 0.7f),
(4, 0.7f),
(5, 0.7f),
(6, 0.7f),
(7, 0.7f),
(8, 0.7f),
(9, 0.7f),
(10, 0.7f),
(11, 0.7f),
(12, 0.7f),
(13, 0.7f),
)
),
)
object Items extends IconScope("items") {
val Cpu: Tier => IconSource = { tier =>
IconSource(s"$prefix/CPU${tier.id}")
get(s"CPU${tier.id}")
}
val Apu: Tier => IconSource = { tier =>
IconSource(s"$prefix/APU${tier.id}", animation = Some(Animations.Apu))
get(s"APU${tier.id}", Animations.Apu)
}
val GraphicsCard: Tier => IconSource = { tier =>
IconSource(s"$prefix/GraphicsCard${tier.id}")
get(s"GraphicsCard${tier.id}")
}
val NetworkCard: IconSource = IconSource(s"$prefix/NetworkCard")
val NetworkCard: IconSource = get("NetworkCard")
val WirelessNetworkCard: Tier => IconSource = { tier =>
IconSource(s"$prefix/WirelessNetworkCard${tier.id}")
get(s"WirelessNetworkCard${tier.id}")
}
val LinkedCard: IconSource = IconSource(s"$prefix/LinkedCard", animation = Some(Animations.LinkedCard))
val LinkedCard: IconSource = get("LinkedCard", Animations.LinkedCard)
val InternetCard: IconSource = IconSource(s"$prefix/InternetCard", animation = Some(Animations.InternetCard))
val InternetCard: IconSource = get("InternetCard", Animations.InternetCard)
val RedstoneCard: Tier => IconSource = { tier =>
IconSource(s"$prefix/RedstoneCard${tier.id}")
get(s"RedstoneCard${tier.id}")
}
val DataCard: Tier => IconSource = { tier =>
IconSource(s"$prefix/DataCard${tier.id}", animation = Some(Animations.DataCard))
get(s"DataCard${tier.id}", Animations.DataCard)
}
val SoundCard: IconSource = IconSource(s"$prefix/SoundCard", animation = Some(Animations.DataCard))
val SoundCard: IconSource = get("SoundCard", Animations.DataCard)
val SelfDestructingCard: IconSource =
IconSource(s"$prefix/SelfDestructingCard", animation = Some(Animations.SelfDestructingCard))
get("SelfDestructingCard", Animations.SelfDestructingCard)
val OcelotCard: IconSource = IconSource(s"$prefix/OcelotCard", animation = Some(Animations.OcelotCard))
val OcelotCard: IconSource = get("OcelotCard", Animations.OcelotCard)
val HardDiskDrive: Tier => IconSource = { tier =>
IconSource(s"$prefix/HardDiskDrive${tier.id}")
get(s"HardDiskDrive${tier.id}")
}
val Eeprom: IconSource = IconSource(s"$prefix/EEPROM")
val Eeprom: IconSource = get("EEPROM")
val FloppyDisk: DyeColor => IconSource = { color =>
IconSource(s"$prefix/FloppyDisk_${color.name}")
get(s"FloppyDisk_${color.name}")
}
val Memory: ExtendedTier => IconSource = { tier =>
IconSource(s"$prefix/Memory${tier.id}")
get(s"Memory${tier.id}")
}
val Server: Tier => IconSource = { tier =>
IconSource(s"$prefix/Server${tier.id}")
get(s"Server${tier.id}")
}
val ComponentBus: Tier => IconSource = { tier =>
IconSource(s"$prefix/ComponentBus${tier.id}")
get(s"ComponentBus${tier.id}")
}
val Tape: TapeKind => IconSource = {
case TapeKind.Golder => Tape(TapeKind.Gold)
case TapeKind.NetherStarrer => Tape(TapeKind.NetherStar)
case kind => IconSource(s"$prefix/Tape$kind")
case kind => get(s"Tape$kind")
}
val DiskDriveMountable: IconSource = IconSource(s"$prefix/DiskDriveMountable")
val DiskDriveMountable: IconSource = get("DiskDriveMountable")
// noinspection ScalaWeakerAccess
object Animations {
@ -117,359 +166,287 @@ object IconSource {
}
}
case class Animation(frames: Array[(Int, Float)], frameSize: Option[Size2D])
object Animation {
def apply(frames: (Int, Float)*) = new Animation(frames.toArray, None)
def apply(size: Size2D, frames: (Int, Float)*) = new Animation(frames.toArray, Some(size))
def apply(size: Option[Size2D] = None, frames: Array[(Int, Float)]) = new Animation(frames, size)
}
// ----------------------- Ocelot interface icons -----------------------
val Loading: IconSource = IconSource(
"Loading",
animation = Some(Animation(
Size2D(48, 32),
(0, 0.7f),
(1, 0.7f),
(2, 0.7f),
(3, 0.7f),
(4, 0.7f),
(5, 0.7f),
(6, 0.7f),
(7, 0.7f),
(8, 0.7f),
(9, 0.7f),
(10, 0.7f),
(11, 0.7f),
(12, 0.7f),
(13, 0.7f),
)),
)
object Icons {
protected val prefix: String = "icons"
val Card: IconSource = IconSource(s"$prefix/Card")
val Cpu: IconSource = IconSource(s"$prefix/CPU")
val Hdd: IconSource = IconSource(s"$prefix/HDD")
val Eeprom: IconSource = IconSource(s"$prefix/EEPROM")
val Floppy: IconSource = IconSource(s"$prefix/Floppy")
val Memory: IconSource = IconSource(s"$prefix/Memory")
val Server: IconSource = IconSource(s"$prefix/Server")
val ComponentBus: IconSource = IconSource(s"$prefix/ComponentBus")
object Icons extends IconScope("icons") {
val Card: IconSource = get("Card")
val Cpu: IconSource = get("CPU")
val Hdd: IconSource = get("HDD")
val Eeprom: IconSource = get("EEPROM")
val Floppy: IconSource = get("Floppy")
val Memory: IconSource = get("Memory")
val Server: IconSource = get("Server")
val ComponentBus: IconSource = get("ComponentBus")
val Tier: Tier => IconSource = { tier =>
IconSource(s"$prefix/Tier${tier.id}")
get(s"Tier${tier.id}")
}
val SideNone: IconSource = IconSource(s"$prefix/SideNone")
val SideAny: IconSource = IconSource(s"$prefix/SideAny")
val SideUndefined: IconSource = IconSource(s"$prefix/SideUndefined")
val SideNone: IconSource = get("SideNone")
val SideAny: IconSource = get("SideAny")
val SideUndefined: IconSource = get("SideUndefined")
val Side: Direction => IconSource = {
case Down => IconSource(s"$prefix/SideDown")
case Up => IconSource(s"$prefix/SideUp")
case North => IconSource(s"$prefix/SideNorth")
case South => IconSource(s"$prefix/SideSouth")
case West => IconSource(s"$prefix/SideWest")
case East => IconSource(s"$prefix/SideEast")
case Down => get("SideDown")
case Up => get("SideUp")
case North => get("SideNorth")
case South => get("SideSouth")
case West => get("SideWest")
case East => get("SideEast")
case _ => SideUndefined
}
val Notification: NotificationType => IconSource = { notificationType =>
IconSource(s"$prefix/Notification$notificationType")
get(s"Notification$notificationType")
}
val SettingsKeymap: IconSource = IconSource(s"$prefix/SettingsKeymap")
val SettingsSystem: IconSource = IconSource(s"$prefix/SettingsSystem")
val SettingsSound: IconSource = IconSource(s"$prefix/SettingsSound")
val SettingsUI: IconSource = IconSource(s"$prefix/SettingsUI")
val Delete: IconSource = IconSource(s"$prefix/Delete")
val Label: IconSource = IconSource(s"$prefix/Label")
val Copy: IconSource = IconSource(s"$prefix/Copy")
val AspectRatio: IconSource = IconSource(s"$prefix/AspectRatio")
val Eject: IconSource = IconSource(s"$prefix/Eject")
val Restart: IconSource = IconSource(s"$prefix/Restart")
val Edit: IconSource = IconSource(s"$prefix/Edit")
val Folder: IconSource = IconSource(s"$prefix/Folder")
val FolderSlash: IconSource = IconSource(s"$prefix/FolderSlash")
val Code: IconSource = IconSource(s"$prefix/Code")
val File: IconSource = IconSource(s"$prefix/File")
val Link: IconSource = IconSource(s"$prefix/Link")
val LinkSlash: IconSource = IconSource(s"$prefix/LinkSlash")
val Power: IconSource = IconSource(s"$prefix/Power")
val Save: IconSource = IconSource(s"$prefix/Save")
val SaveAs: IconSource = IconSource(s"$prefix/SaveAs")
val Plus: IconSource = IconSource(s"$prefix/Plus")
val Cross: IconSource = IconSource(s"$prefix/Cross")
val Microchip: IconSource = IconSource(s"$prefix/Microchip")
val Antenna: IconSource = IconSource(s"$prefix/Antenna")
val Window: IconSource = IconSource(s"$prefix/Window")
val Tiers: IconSource = IconSource(s"$prefix/Tiers")
val LinesHorizontal: IconSource = IconSource(s"$prefix/LinesHorizontal")
val ArrowRight: IconSource = IconSource(s"$prefix/ArrowRight")
val Book: IconSource = IconSource(s"$prefix/Book")
val Help: IconSource = IconSource(s"$prefix/Help")
val Ocelot: IconSource = IconSource(s"$prefix/Ocelot")
val Guitar: IconSource = IconSource(s"$prefix/Guitar")
val Keyboard: IconSource = IconSource(s"$prefix/Keyboard")
val KeyboardOff: IconSource = IconSource(s"$prefix/KeyboardOff")
val ButtonRandomize: IconSource = IconSource(s"$prefix/ButtonRandomize")
val ButtonClipboard: IconSource = IconSource(s"$prefix/ButtonClipboard")
val ButtonCheck: IconSource = IconSource(s"$prefix/ButtonCheck")
val Home: IconSource = IconSource(s"$prefix/Home")
val Pin: IconSource = IconSource(s"$prefix/Pin")
val Unpin: IconSource = IconSource(s"$prefix/Unpin")
val Close: IconSource = IconSource(s"$prefix/Close")
val Grid: IconSource = IconSource(s"$prefix/Grid")
val GridOff: IconSource = IconSource(s"$prefix/GridOff")
val LMB: IconSource = IconSource(s"$prefix/LMB")
val RMB: IconSource = IconSource(s"$prefix/RMB")
val DragLMB: IconSource = IconSource(s"$prefix/DragLMB")
val DragRMB: IconSource = IconSource(s"$prefix/DragRMB")
val NA: IconSource = get("NA")
val SettingsKeymap: IconSource = get("SettingsKeymap")
val SettingsSystem: IconSource = get("SettingsSystem")
val SettingsSound: IconSource = get("SettingsSound")
val SettingsUI: IconSource = get("SettingsUI")
val Delete: IconSource = get("Delete")
val Label: IconSource = get("Label")
val Copy: IconSource = get("Copy")
val AspectRatio: IconSource = get("AspectRatio")
val Eject: IconSource = get("Eject")
val Restart: IconSource = get("Restart")
val Edit: IconSource = get("Edit")
val Folder: IconSource = get("Folder")
val FolderSlash: IconSource = get("FolderSlash")
val Code: IconSource = get("Code")
val File: IconSource = get("File")
val Link: IconSource = get("Link")
val LinkSlash: IconSource = get("LinkSlash")
val Power: IconSource = get("Power")
val Save: IconSource = get("Save")
val SaveAs: IconSource = get("SaveAs")
val Plus: IconSource = get("Plus")
val Cross: IconSource = get("Cross")
val Microchip: IconSource = get("Microchip")
val Antenna: IconSource = get("Antenna")
val Window: IconSource = get("Window")
val Tiers: IconSource = get("Tiers")
val LinesHorizontal: IconSource = get("LinesHorizontal")
val ArrowRight: IconSource = get("ArrowRight")
val Book: IconSource = get("Book")
val Help: IconSource = get("Help")
val Ocelot: IconSource = get("Ocelot")
val Guitar: IconSource = get("Guitar")
val Keyboard: IconSource = get("Keyboard")
val KeyboardOff: IconSource = get("KeyboardOff")
val ButtonRandomize: IconSource = get("ButtonRandomize")
val ButtonClipboard: IconSource = get("ButtonClipboard")
val ButtonCheck: IconSource = get("ButtonCheck")
val Home: IconSource = get("Home")
val Pin: IconSource = get("Pin")
val Unpin: IconSource = get("Unpin")
val Close: IconSource = get("Close")
val Grid: IconSource = get("Grid")
val GridOff: IconSource = get("GridOff")
val LMB: IconSource = get("LMB")
val RMB: IconSource = get("RMB")
val DragLMB: IconSource = get("DragLMB")
val DragRMB: IconSource = get("DragRMB")
val WireArrowLeft: IconSource = IconSource(s"$prefix/WireArrowLeft")
val WireArrowRight: IconSource = IconSource(s"$prefix/WireArrowRight")
val WireArrowLeft: IconSource = get("WireArrowLeft")
val WireArrowRight: IconSource = get("WireArrowRight")
val WaveSine: IconSource = IconSource(s"$prefix/WaveSine")
val WaveTriangle: IconSource = IconSource(s"$prefix/WaveTriangle")
val WaveSawtooth: IconSource = IconSource(s"$prefix/WaveSawtooth")
val WaveSquare: IconSource = IconSource(s"$prefix/WaveSquare")
val WaveNoise: IconSource = IconSource(s"$prefix/WaveNoise")
val WaveLFSR: IconSource = IconSource(s"$prefix/WaveLFSR")
val WaveSine: IconSource = get("WaveSine")
val WaveTriangle: IconSource = get("WaveTriangle")
val WaveSawtooth: IconSource = get("WaveSawtooth")
val WaveSquare: IconSource = get("WaveSquare")
val WaveNoise: IconSource = get("WaveNoise")
val WaveLFSR: IconSource = get("WaveLFSR")
}
// ----------------------- Node icons -----------------------
object Nodes extends IconScope("nodes") {
val NewNode: IconSource = get("NewNode")
val NA: IconSource = IconSource("icons/NA")
object Nodes {
val NewNode: IconSource = IconSource("nodes/NewNode")
val Cable: IconSource = IconSource("nodes/Cable")
val Camera: IconSource = IconSource("nodes/Camera")
val Chest: IconSource = IconSource("nodes/Chest")
val Cable: IconSource = get("Cable")
val Camera: IconSource = get("Camera")
val Chest: IconSource = get("Chest")
val HologramProjector: Tier => IconSource = { tier =>
IconSource(s"nodes/HologramProjector${tier.id}")
get(s"HologramProjector${tier.id}")
}
val IronNoteBlock: IconSource = IconSource("nodes/IronNoteBlock")
val NoteBlock: IconSource = IconSource("nodes/NoteBlock")
val OpenFMRadio: IconSource = IconSource("nodes/OpenFMRadio")
val Relay: IconSource = IconSource("nodes/Relay")
val TapeDrive: IconSource = IconSource("nodes/TapeDrive")
val IronNoteBlock: IconSource = get("IronNoteBlock")
val NoteBlock: IconSource = get("NoteBlock")
val OpenFMRadio: IconSource = get("OpenFMRadio")
val Relay: IconSource = get("Relay")
val TapeDrive: IconSource = get("TapeDrive")
object Computer extends PowerIconSource with DiskActivityIconSource {
override protected def prefix: String = "nodes/computer"
val Lamp: IconSource = get("Lamp")
val LampFrame: IconSource = get("LampFrame")
val LampGlow: IconSource = get("LampGlow")
val Default: IconSource = IconSource(s"$prefix/Default")
object Computer extends IconScope("computer") with PowerIconSource with DiskActivityIconSource {
val Default: IconSource = get("Default")
}
object DiskDrive extends DiskActivityIconSource with FloppyDriveIconSource {
override protected def prefix: String = "nodes/disk-drive"
val Default: IconSource = IconSource(s"$prefix/Default")
object DiskDrive extends IconScope("disk-drive") with DiskActivityIconSource with FloppyDriveIconSource {
val Default: IconSource = get("Default")
}
object Lamp extends IconSource("nodes/Lamp") {
val Frame: IconSource = IconSource("nodes/LampFrame")
val Glow: IconSource = IconSource("nodes/LampGlow")
object Microcontroller extends IconScope("microcontroller") with PowerIconSource {
val Default: IconSource = get("Default")
}
object Microcontroller extends PowerIconSource {
override protected def prefix: String = "nodes/microcontroller"
val Default: IconSource = IconSource(s"$prefix/Default")
}
object OcelotBlock {
val Default: IconSource = IconSource(
"nodes/ocelot-block/Default",
animation = Some(Animation(Size2D(16, 16), (0, 30f), (1, 5f), (2, 2f), (0, 20f), (3, 3f), (4, 2f))),
object OcelotBlock extends IconScope("ocelot-block") {
val Default: IconSource = get(
"Default",
Some(Animation(Size2D(16, 16))((0, 30f), (1, 5f), (2, 2f), (0, 20f), (3, 3f), (4, 2f))),
)
val Rx: IconSource = IconSource("nodes/ocelot-block/Rx")
val Tx: IconSource = IconSource("nodes/ocelot-block/Tx")
val Rx: IconSource = get("Rx")
val Tx: IconSource = get("Tx")
}
object Rack {
protected val prefix: String = "nodes/rack"
val Empty: IconSource = IconSource(s"$prefix/Empty")
val Default: IconSource = IconSource(s"$prefix/Default")
object Rack extends IconScope("rack") {
val Empty: IconSource = get("Empty")
val Default: IconSource = get("Default")
val Server: Array[Server] = Array.tabulate(4)(new Server(_))
val Drive: Array[Drive] = Array.tabulate(4)(new Drive(_))
class Server(val slot: Int) extends PowerIconSource with DiskActivityIconSource with NetworkActivityIconSource {
override protected def prefix: String = s"${Rack.prefix}/server/$slot"
class Server(val slot: Int)
extends IconScope(s"server/$slot")
with PowerIconSource
with DiskActivityIconSource
with NetworkActivityIconSource {
val Default: IconSource = IconSource(s"$prefix/Default")
val Default: IconSource = get("Default")
}
class Drive(val slot: Int) extends DiskActivityIconSource with FloppyDriveIconSource {
override protected def prefix: String = s"${Rack.prefix}/drive/$slot"
class Drive(val slot: Int)
extends IconScope(s"drive/$slot")
with DiskActivityIconSource
with FloppyDriveIconSource {
val Default: IconSource = IconSource(s"$prefix/Default")
val Default: IconSource = get("Default")
}
}
object Raid {
protected val prefix: String = "nodes/raid"
val Default: IconSource = IconSource(s"$prefix/Default")
object Raid extends IconScope("raid") {
val Default: IconSource = get("Default")
val Drive: Array[Drive] = Array.tabulate(3)(new Drive(_))
class Drive(val slot: Int) extends DiskActivityIconSource {
override protected def prefix: String = s"${Raid.prefix}/$slot"
val Error: IconSource = IconSource(s"$prefix/Error")
class Drive(val slot: Int) extends IconScope(slot.toString) with DiskActivityIconSource {
val Error: IconSource = get("Error")
}
}
object Screen {
protected val prefix: String = "nodes/screen"
object Screen extends IconScope("screen") {
val Standalone: IconSource = get("Standalone")
val PowerOnOverlay: IconSource = get("PowerOnOverlay")
val Standalone: IconSource = IconSource(s"$prefix/Standalone")
val PowerOnOverlay: IconSource = IconSource(s"$prefix/PowerOnOverlay")
val ColumnTop: IconSource = get("ColumnTop")
val ColumnMiddle: IconSource = get("ColumnMiddle")
val ColumnBottom: IconSource = get("ColumnBottom")
val ColumnTop: IconSource = IconSource(s"$prefix/ColumnTop")
val ColumnMiddle: IconSource = IconSource(s"$prefix/ColumnMiddle")
val ColumnBottom: IconSource = IconSource(s"$prefix/ColumnBottom")
val RowLeft: IconSource = get("RowLeft")
val RowMiddle: IconSource = get("RowMiddle")
val RowRight: IconSource = get("RowRight")
val RowLeft: IconSource = IconSource(s"$prefix/RowLeft")
val RowMiddle: IconSource = IconSource(s"$prefix/RowMiddle")
val RowRight: IconSource = IconSource(s"$prefix/RowRight")
val TopLeft: IconSource = get("TopLeft")
val TopMiddle: IconSource = get("TopMiddle")
val TopRight: IconSource = get("TopRight")
val TopLeft: IconSource = IconSource(s"$prefix/TopLeft")
val TopMiddle: IconSource = IconSource(s"$prefix/TopMiddle")
val TopRight: IconSource = IconSource(s"$prefix/TopRight")
val MiddleLeft: IconSource = get("MiddleLeft")
val Middle: IconSource = get("Middle")
val MiddleRight: IconSource = get("MiddleRight")
val MiddleLeft: IconSource = IconSource(s"$prefix/MiddleLeft")
val Middle: IconSource = IconSource(s"$prefix/Middle")
val MiddleRight: IconSource = IconSource(s"$prefix/MiddleRight")
val BottomLeft: IconSource = IconSource(s"$prefix/BottomLeft")
val BottomMiddle: IconSource = IconSource(s"$prefix/BottomMiddle")
val BottomRight: IconSource = IconSource(s"$prefix/BottomRight")
val BottomLeft: IconSource = get("BottomLeft")
val BottomMiddle: IconSource = get("BottomMiddle")
val BottomRight: IconSource = get("BottomRight")
}
object Holidays {
protected val prefix: String = "nodes/holidays"
val Christmas: IconSource = IconSource(s"$prefix/Christmas")
val Valentines: IconSource = IconSource(s"$prefix/Valentines")
val Halloween: IconSource = IconSource(s"$prefix/Halloween")
object Holidays extends IconScope("holidays") {
val Christmas: IconSource = get("Christmas")
val Valentines: IconSource = get("Valentines")
val Halloween: IconSource = get("Halloween")
}
}
trait PowerIconSource {
protected def prefix: String
val On: IconSource = IconSource(s"$prefix/On")
val Error: IconSource = IconSource(s"$prefix/Error")
trait PowerIconSource extends IconScope {
val On: IconSource = get("On")
val Error: IconSource = get("Error")
}
trait DiskActivityIconSource {
protected def prefix: String
val DiskActivity: IconSource = IconSource(s"$prefix/DiskActivity")
trait DiskActivityIconSource extends IconScope {
val DiskActivity: IconSource = get("DiskActivity")
}
trait NetworkActivityIconSource {
protected def prefix: String
val NetworkActivity: IconSource = IconSource(s"$prefix/NetworkActivity")
trait NetworkActivityIconSource extends IconScope {
val NetworkActivity: IconSource = get("NetworkActivity")
}
trait FloppyDriveIconSource {
protected def prefix: String
val Floppy: IconSource = IconSource(s"$prefix/Floppy")
trait FloppyDriveIconSource extends IconScope {
val Floppy: IconSource = get("Floppy")
}
object Screen {
protected val prefix: String = "screen"
object Screen extends IconScope("screen") {
val InnerCornerTL: IconSource = get("InnerCornerTL")
val InnerCornerTR: IconSource = get("InnerCornerTR")
val InnerCornerBL: IconSource = get("InnerCornerBL")
val InnerCornerBR: IconSource = get("InnerCornerBR")
val InnerCornerTL: IconSource = IconSource(s"$prefix/InnerCornerTL")
val InnerCornerTR: IconSource = IconSource(s"$prefix/InnerCornerTR")
val InnerCornerBL: IconSource = IconSource(s"$prefix/InnerCornerBL")
val InnerCornerBR: IconSource = IconSource(s"$prefix/InnerCornerBR")
val OuterCornerTL: IconSource = get("OuterCornerTL")
val OuterCornerTR: IconSource = get("OuterCornerTR")
val OuterCornerBL: IconSource = get("OuterCornerBL")
val OuterCornerBR: IconSource = get("OuterCornerBR")
val OuterCornerTL: IconSource = IconSource(s"$prefix/OuterCornerTL")
val OuterCornerTR: IconSource = IconSource(s"$prefix/OuterCornerTR")
val OuterCornerBL: IconSource = IconSource(s"$prefix/OuterCornerBL")
val OuterCornerBR: IconSource = IconSource(s"$prefix/OuterCornerBR")
val InnerBorderT: IconSource = get("InnerBorderT")
val OuterBorderT: IconSource = get("OuterBorderT")
val InnerBorderT: IconSource = IconSource(s"$prefix/InnerBorderT")
val OuterBorderT: IconSource = IconSource(s"$prefix/OuterBorderT")
val InnerBorderB: IconSource = IconSource(s"$prefix/InnerBorderB")
val InnerBorderB: IconSource = get("InnerBorderB")
}
// ----------------------- Particles -----------------------
object Particles {
protected val prefix: String = "particles"
val Note: IconSource = IconSource(s"$prefix/Note")
val Smoke: IconSource = IconSource(s"$prefix/Smoke")
object Particles extends IconScope("particles") {
val Note: IconSource = get("Note")
val Smoke: IconSource = get("Smoke")
}
// ----------------------- Buttons -----------------------
object Buttons extends IconScope("buttons") {
val BottomDrawerOpen: IconSource = get("BottomDrawerOpen")
val BottomDrawerClose: IconSource = get("BottomDrawerClose")
object Buttons {
protected val prefix: String = "buttons"
val BottomDrawerOpen: IconSource = IconSource(s"$prefix/BottomDrawerOpen")
val BottomDrawerClose: IconSource = IconSource(s"$prefix/BottomDrawerClose")
val PowerOff: IconSource = IconSource(s"$prefix/PowerOff")
val PowerOn: IconSource = IconSource(s"$prefix/PowerOn")
val PowerOff: IconSource = get("PowerOff")
val PowerOn: IconSource = get("PowerOn")
val OpenFMRadioVolumeOff: Boolean => IconSource = { isUp =>
IconSource(s"$prefix/OpenFMRadioVolume${if (isUp) "Up" else "Down"}Off")
get(s"OpenFMRadioVolume${if (isUp) "Up" else "Down"}Off")
}
val OpenFMRadioVolumeOn: Boolean => IconSource = { isUp =>
IconSource(s"$prefix/OpenFMRadioVolume${if (isUp) "Up" else "Down"}On")
get(s"OpenFMRadioVolume${if (isUp) "Up" else "Down"}On")
}
val OpenFMRadioRedstoneOff: IconSource = IconSource(s"$prefix/OpenFMRadioRedstoneOff")
val OpenFMRadioRedstoneOn: IconSource = IconSource(s"$prefix/OpenFMRadioRedstoneOn")
val OpenFMRadioRedstoneOff: IconSource = get("OpenFMRadioRedstoneOff")
val OpenFMRadioRedstoneOn: IconSource = get("OpenFMRadioRedstoneOn")
val OpenFMRadioCloseOff: IconSource = IconSource(s"$prefix/OpenFMRadioCloseOff")
val OpenFMRadioCloseOn: IconSource = IconSource(s"$prefix/OpenFMRadioCloseOn")
val OpenFMRadioCloseOff: IconSource = get("OpenFMRadioCloseOff")
val OpenFMRadioCloseOn: IconSource = get("OpenFMRadioCloseOn")
val OpenFMRadioStartOff: IconSource = IconSource(s"$prefix/OpenFMRadioStartOff")
val OpenFMRadioStopOn: IconSource = IconSource(s"$prefix/OpenFMRadioStopOn")
val OpenFMRadioStartOff: IconSource = get("OpenFMRadioStartOff")
val OpenFMRadioStopOn: IconSource = get("OpenFMRadioStopOn")
val RackRelayOff: IconSource = IconSource(s"$prefix/RackRelayOff")
val RackRelayOn: IconSource = IconSource(s"$prefix/RackRelayOn")
val RackRelayOff: IconSource = get("RackRelayOff")
val RackRelayOn: IconSource = get("RackRelayOn")
}
// ----------------------- Window icons -----------------------
object Window extends IconScope("window") {
val CornerTL: IconSource = get("CornerTL")
val CornerTR: IconSource = get("CornerTR")
val CornerBL: IconSource = get("CornerBL")
val CornerBR: IconSource = get("CornerBR")
object Window {
protected val prefix: String = "window"
val CornerTL: IconSource = IconSource(s"$prefix/CornerTL")
val CornerTR: IconSource = IconSource(s"$prefix/CornerTR")
val CornerBL: IconSource = IconSource(s"$prefix/CornerBL")
val CornerBR: IconSource = IconSource(s"$prefix/CornerBR")
val BorderLight: IconSource = IconSource(s"$prefix/BorderLight")
val BorderDark: IconSource = IconSource(s"$prefix/BorderDark")
object Tape {
protected val prefix: String = s"${Window.prefix}/tape"
val BorderLight: IconSource = get("BorderLight")
val BorderDark: IconSource = get("BorderDark")
object Tape extends IconScope("tape") {
abstract class TapeButtonIconSource private[Tape] (sprite: String) {
val Released: IconSource = IconSource(s"$prefix/$sprite")
val Pressed: IconSource = IconSource(s"$prefix/${sprite}Pressed")
val Released: IconSource = get(sprite)
val Pressed: IconSource = get(s"${sprite}Pressed")
}
object Back extends TapeButtonIconSource("Back")
@ -477,90 +454,80 @@ object IconSource {
object Stop extends TapeButtonIconSource("Stop")
object Forward extends TapeButtonIconSource("Forward")
val Screen: IconSource = IconSource(s"$prefix/Screen")
val Screen: IconSource = get("Screen")
}
object Case {
protected val prefix: String = s"${Window.prefix}/case"
val Motherboard: IconSource = IconSource(s"$prefix/Motherboard")
object Case extends IconScope("case") {
val Motherboard: IconSource = get("Motherboard")
}
object Rack {
protected val prefix: String = s"${Window.prefix}/rack"
val Motherboard: IconSource = IconSource(s"$prefix/Motherboard")
val Lines: IconSource = IconSource(s"$prefix/Lines")
object Rack extends IconScope("rack") {
val Motherboard: IconSource = get("Motherboard")
val Lines: IconSource = get("Lines")
trait DirectionIconSource {
protected def prefix: String
protected def iconPrefix: String
val DirectionIcon: Direction => IconSource = { direction =>
IconSource(s"$prefix${direction.side.capitalize}")
get(s"$iconPrefix${direction.side.capitalize}")
}
}
trait ConnectorIconSource {
protected def prefix: String
protected def iconPrefix: String
val Connector: IconSource = IconSource(s"${prefix}Connector")
val Connector: IconSource = get(s"${iconPrefix}Connector")
}
object Side extends DirectionIconSource with ConnectorIconSource {
override protected def prefix: String = s"${Rack.prefix}/Side"
override protected def iconPrefix: String = "Side"
}
object Network extends DirectionIconSource with ConnectorIconSource {
override protected def prefix: String = s"${Rack.prefix}/Network"
override protected def iconPrefix: String = "Network"
}
object Node extends DirectionIconSource {
override protected def prefix: String = s"${Rack.prefix}/Node"
override protected def iconPrefix: String = "Node"
}
}
object Raid {
protected val prefix: String = s"${Window.prefix}/raid"
val Slots: IconSource = IconSource(s"$prefix/Slots")
object Raid extends IconScope("raid") {
val Slots: IconSource = get("Slots")
}
val OpenFMRadio: IconSource = IconSource(s"$prefix/OpenFMRadio")
val OpenFMRadio: IconSource = get("OpenFMRadio")
}
object Panel {
protected val prefix: String = "panel"
val CornerTL: IconSource = IconSource(s"$prefix/CornerTL")
val CornerTR: IconSource = IconSource(s"$prefix/CornerTR")
val CornerBL: IconSource = IconSource(s"$prefix/CornerBL")
val CornerBR: IconSource = IconSource(s"$prefix/CornerBR")
object Panel extends IconScope("panel") {
val CornerTL: IconSource = get("CornerTL")
val CornerTR: IconSource = get("CornerTR")
val CornerBL: IconSource = get("CornerBL")
val CornerBR: IconSource = get("CornerBR")
val BorderT: IconSource = IconSource(s"$prefix/BorderT")
val BorderB: IconSource = IconSource(s"$prefix/BorderB")
val BorderL: IconSource = IconSource(s"$prefix/BorderL")
val BorderR: IconSource = IconSource(s"$prefix/BorderR")
val BorderT: IconSource = get("BorderT")
val BorderB: IconSource = get("BorderB")
val BorderL: IconSource = get("BorderL")
val BorderR: IconSource = get("BorderR")
val Fill: IconSource = IconSource(s"$prefix/Fill")
val Fill: IconSource = get("Fill")
}
object LightPanel {
protected val prefix: String = "light-panel"
val CornerTL: IconSource = IconSource(s"$prefix/CornerTL")
val CornerTR: IconSource = IconSource(s"$prefix/CornerTR")
val CornerBL: IconSource = IconSource(s"$prefix/CornerBL")
val CornerBR: IconSource = IconSource(s"$prefix/CornerBR")
object LightPanel extends IconScope("light-panel") {
val CornerTL: IconSource = get("CornerTL")
val CornerTR: IconSource = get("CornerTR")
val CornerBL: IconSource = get("CornerBL")
val CornerBR: IconSource = get("CornerBR")
val BorderT: IconSource = IconSource(s"$prefix/BorderT")
val BorderB: IconSource = IconSource(s"$prefix/BorderB")
val BorderL: IconSource = IconSource(s"$prefix/BorderL")
val BorderR: IconSource = IconSource(s"$prefix/BorderR")
val BorderT: IconSource = get("BorderT")
val BorderB: IconSource = get("BorderB")
val BorderL: IconSource = get("BorderL")
val BorderR: IconSource = get("BorderR")
val Fill: IconSource = IconSource(s"$prefix/Fill")
val Vent: IconSource = IconSource(s"$prefix/Vent")
val Fill: IconSource = get("Fill")
val Vent: IconSource = get("Vent")
val BookmarkLeft: IconSource = IconSource(s"$prefix/BookmarkLeft")
val BookmarkRight: IconSource = IconSource(s"$prefix/BookmarkRight")
val BookmarkLeft: IconSource = get("BookmarkLeft")
val BookmarkRight: IconSource = get("BookmarkRight")
}
}

View File

@ -82,7 +82,7 @@ trait BoomCardFxHandler extends Node with PositionalSoundSourcesNode with SmokeP
}
g.sprite(
IconSource.Nodes.Lamp.Glow,
IconSource.Nodes.LampGlow,
position - size * glowSize,
size * (1 + 2 * glowSize),
ColorScheme("BoomCardGlowStart").lerp(ColorScheme("BoomCardGlowEnd"), boomPhase).withAlpha(alpha),

View File

@ -119,7 +119,7 @@ abstract class Node extends Widget with MouseHandler with HoverHandler with Pers
super.dispose()
}
def iconSource: IconSource = IconSource.NA
def iconSource: IconSource = IconSource.Icons.NA
def iconColor: Color = RGBAColor(255, 255, 255)

View File

@ -24,12 +24,12 @@ class ColorfulLampNode(val lamp: ColorfulLamp) extends EntityNode(lamp) with Lab
)
g.rect(position.x + 2, position.y + 2, size.width - 4, size.height - 4, lastColor)
g.sprite(IconSource.Nodes.Lamp.Frame, position.x + 2, position.y + 2, size.width - 4, size.height - 4)
g.sprite(IconSource.Nodes.LampFrame, position.x + 2, position.y + 2, size.width - 4, size.height - 4)
}
override def drawLight(g: Graphics): Unit = {
super.drawLight(g)
g.sprite(IconSource.Nodes.Lamp.Glow, position - size / 2, size * 2, lastColor)
g.sprite(IconSource.Nodes.LampGlow, position - size / 2, size * 2, lastColor)
}
eventHandlers += {