Rename iconSource properties to icon

This commit is contained in:
Fingercomp 2025-08-17 18:43:05 +03:00
parent d28572124f
commit 4edfd8fff2
No known key found for this signature in database
GPG Key ID: BBC71CEE45D86E37
18 changed files with 22 additions and 22 deletions

View File

@ -119,7 +119,7 @@ abstract class Node extends Widget with MouseHandler with HoverHandler with Pers
super.dispose()
}
def iconSource: IconSource = IconSource.Icons.NA
def icon: IconSource = IconSource.Icons.NA
def iconColor: Color = RGBAColor(255, 255, 255)
@ -263,7 +263,7 @@ abstract class Node extends Widget with MouseHandler with HoverHandler with Pers
drawHighlight(g)
g.sprite(
iconSource,
icon,
position.x + HighlightThickness,
position.y + HighlightThickness,
size.width - HighlightThickness * 2,

View File

@ -6,7 +6,7 @@ import ocelot.desktop.node.EntityNode
import totoro.ocelot.brain.entity.Cable
class CableNode(val cable: Cable) extends EntityNode(cable) {
override def iconSource: IconSource = IconSource.Nodes.Cable
override def icon: IconSource = IconSource.Nodes.Cable
override def rotatable: Boolean = false

View File

@ -6,7 +6,7 @@ import ocelot.desktop.node.{EntityNode, LabeledEntityNode, WindowedNode}
import ocelot.desktop.windows.CameraWindow
class CameraNode(val camera: Camera) extends EntityNode(camera) with LabeledEntityNode with WindowedNode[CameraWindow] {
override def iconSource: IconSource = IconSource.Nodes.Camera
override def icon: IconSource = IconSource.Nodes.Camera
override def rotatable: Boolean = true

View File

@ -10,7 +10,7 @@ import ocelot.desktop.windows.ChestWindow
class ChestNode extends LabeledNode with WindowedNode[ChestWindow] with PersistedInventory {
override type I = Item with PersistableItem
override def iconSource: IconSource = IconSource.Nodes.Chest
override def icon: IconSource = IconSource.Nodes.Chest
override def rotatable: Boolean = false

View File

@ -20,7 +20,7 @@ class ComputerNode(val computerCase: Case)
with AudibleComputerAware
with WindowedNode[ComputerWindow] {
override val iconSource: IconSource = IconSource.Nodes.Computer.Default
override val icon: IconSource = IconSource.Nodes.Computer.Default
override def iconColor: Color = TierColor.get(computerCase.tier)
override def rotatable: Boolean = true

View File

@ -21,7 +21,7 @@ class DiskDriveNode(entity: FloppyDiskDrive)
with ShiftClickNode
with WindowedNode[DiskDriveWindow] {
override def iconSource: IconSource = IconSource.Nodes.DiskDrive.Default
override def icon: IconSource = IconSource.Nodes.DiskDrive.Default
override def rotatable: Boolean = true

View File

@ -8,7 +8,7 @@ import totoro.ocelot.brain.entity.HologramProjector
class HologramProjectorNode(val hologramProjector: HologramProjector)
extends EntityNode(hologramProjector) with LabeledEntityNode with WindowedNode[HologramProjectorWindow] {
override def iconSource: IconSource = IconSource.Nodes.HologramProjector(hologramProjector.tier)
override def icon: IconSource = IconSource.Nodes.HologramProjector(hologramProjector.tier)
override def rotatable: Boolean = false

View File

@ -9,7 +9,7 @@ import totoro.ocelot.brain.event.{EventBus, NoteBlockTriggerEvent}
import scala.util.Random
class IronNoteBlockNode(val ironNoteBlock: IronNoteBlock) extends NoteBlockNodeBase(ironNoteBlock) {
override def iconSource: IconSource = IconSource.Nodes.IronNoteBlock
override def icon: IconSource = IconSource.Nodes.IronNoteBlock
override def rotatable: Boolean = false

View File

@ -21,7 +21,7 @@ class MicrocontrollerNode(val microcontroller: Microcontroller)
with DefaultSlotItemsFillable
with WindowedNode[ComputerWindow] {
override val iconSource: IconSource = IconSource.Nodes.Microcontroller.Default
override val icon: IconSource = IconSource.Nodes.Microcontroller.Default
override def setupContextMenu(menu: ContextMenu, event: ClickEvent): Unit = {
addPowerContextMenuEntries(menu)

View File

@ -7,7 +7,7 @@ import totoro.ocelot.brain.entity.NoteBlock
import totoro.ocelot.brain.event.{EventBus, NoteBlockTriggerEvent}
class NoteBlockNode(val noteBlock: NoteBlock) extends NoteBlockNodeBase(noteBlock) {
override def iconSource: IconSource = IconSource.Nodes.NoteBlock
override def icon: IconSource = IconSource.Nodes.NoteBlock
override def rotatable: Boolean = false

View File

@ -22,7 +22,7 @@ class OcelotBlockNode(val ocelot: OcelotBlock)
override def name: String = "Ocelot Block"
override def iconSource: IconSource = IconSource.Nodes.OcelotBlock.Default
override def icon: IconSource = IconSource.Nodes.OcelotBlock.Default
override def rotatable: Boolean = false

View File

@ -9,7 +9,7 @@ import ocelot.desktop.windows.OpenFMRadioWindow
class OpenFMRadioNode(val openFMRadio: OpenFMRadio)
extends EntityNode(openFMRadio) with LabeledEntityNode with WindowedNode[OpenFMRadioWindow] {
override def iconSource: IconSource = IconSource.Nodes.OpenFMRadio
override def icon: IconSource = IconSource.Nodes.OpenFMRadio
override def rotatable: Boolean = true

View File

@ -18,7 +18,7 @@ import totoro.ocelot.brain.network
import totoro.ocelot.brain.util.Direction
class RackNode(val rack: Rack) extends ComputerAwareNode(rack) with WindowedNode[RackWindow] {
override val iconSource: IconSource = IconSource.Nodes.Rack.Empty
override val icon: IconSource = IconSource.Nodes.Rack.Empty
override def exposeAddress = false
override def ports: Array[NodePort] = Array(

View File

@ -27,7 +27,7 @@ class RaidNode(val raid: Raid)
with WindowedNode[RaidWindow] {
var diskSlots: Array[HddSlotWidget] = Array.tabulate(3)(index => new HddSlotWidget(Slot(index), Tier.Three))
override val iconSource: IconSource = IconSource.Nodes.Raid.Default
override val icon: IconSource = IconSource.Nodes.Raid.Default
override def rotatable: Boolean = true

View File

@ -11,7 +11,7 @@ import totoro.ocelot.brain.util.Direction
class RelayNode(val relay: Relay)
extends EntityNode(relay) with SyncedInventory with LabeledNode with WindowedNode[RelayWindow] {
override val iconSource: IconSource = IconSource.Nodes.Relay
override val icon: IconSource = IconSource.Nodes.Relay
override def ports: Array[NodePort] = Array(
NodePort(Some(Direction.North)),

View File

@ -91,7 +91,7 @@ class ScreenNode(val screen: Screen)
}
}
override def iconSource: IconSource = IconSource.Nodes.Screen.Standalone
override def icon: IconSource = IconSource.Nodes.Screen.Standalone
override def iconColor: Color = TierColor.get(screen.tier)

View File

@ -18,7 +18,7 @@ class TapeDriveNode(val tapeDrive: TapeDrive)
with PositionalSoundSourcesNode
with WindowedNode[TapeDriveWindow] {
override def iconSource: IconSource = IconSource.Nodes.TapeDrive
override def icon: IconSource = IconSource.Nodes.TapeDrive
override def rotatable: Boolean = true

View File

@ -1,6 +1,6 @@
package ocelot.desktop.util
import ocelot.desktop.geometry.{Rect2D, Size2D, Vector2D}
import ocelot.desktop.geometry.{Rect2D, Size2D}
import ocelot.desktop.graphics.{IconSource, Texture}
import javax.imageio.ImageIO
@ -15,18 +15,18 @@ object Spritesheet extends Resource with Logging {
def spriteSize(sprite: String): Size2D = sprites(sprite).size * resolution
def spriteSize(iconSource: IconSource): Size2D = iconSource.animation match {
def spriteSize(icon: IconSource): Size2D = icon.animation match {
case Some(animation) =>
animation.frameSize match {
case Some(size) => size
case None =>
val size = spriteSize(iconSource.path)
val size = spriteSize(icon.path)
Size2D(size.width, size.width)
}
case None => spriteSize(iconSource.path)
case None => spriteSize(icon.path)
}
def load(): Unit = {