Added relay mode button & spritepack binaries

This commit is contained in:
Igor Timofeev 2023-09-26 15:50:04 +00:00
parent eaf1e0369e
commit 5f39265145
10 changed files with 246 additions and 197 deletions

View File

@ -162,6 +162,11 @@ the version displayed in the window title and the logs, run:
$ sbt buildInfo
```
If you need to add additional sprites or modify existing ones, do it in the
`sprites` directory. When everything is ready, you need to pack them into a
texture atlas by running the `SpritePack` tool located in the project's
home directory.
## Credits
- **LeshaInc:** the author of Ocelot Desktop and the graphics guru.
- **Totoro:** the creator of [ocelot-brain][] and [ocelot.online][ocelot-online].

View File

@ -1,9 +0,0 @@
#!/usr/bin/bash
if ! command -v spritepack &> /dev/null
then
echo "spritepack could not be found in the PATH variable!"
exit
fi
spritepack -s 512x512 -o ./src/main/resources/ocelot/desktop/images/spritesheet -n spritesheet ./sprites/

View File

@ -1,3 +0,0 @@
:: keep .exe after 'spritepack' otherwise the batch script will call itself in loop
spritepack.exe -s 512x512 -o ./src/main/resources/ocelot/desktop/images/spritesheet -n spritesheet ./sprites/
pause

View File

@ -0,0 +1,3 @@
:: keep .exe after 'spritepack' otherwise the batch script will call itself in loop
%~dp0/bin/spritepack.exe -s 1024x1024 -o ../src/main/resources/ocelot/desktop/images/spritesheet -n spritesheet ../sprites/
pause

3
spritepack/spritepack.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/bash
./bin/spritepack -s 1024x1024 -o ../src/main/resources/ocelot/desktop/images/spritesheet -n spritesheet ../sprites/

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -1,158 +1,160 @@
BackgroundPattern 0 0 304 304
BarSegment 29 499 16 4
Empty 153 381 16 16
EmptySlot 256 330 18 18
Empty 278 324 16 16
EmptySlot 256 349 18 18
Knob 692 0 50 50
KnobCenter 743 0 50 50
KnobLimits 794 0 50 50
ShadowBorder 0 538 1 24
ShadowCorner 153 305 24 24
ShadowCorner 153 324 24 24
TabArrow 0 484 8 14
blocks/Generic 170 381 16 16
blocks/Generic 295 324 16 16
blocks/HologramEffect 8 547 4 4
blocks/HologramProjector1Top 187 381 16 16
blocks/HologramProjector2Top 204 381 16 16
blocks/HologramProjectorSide 221 381 16 16
buttons/BottomDrawerClose 275 330 18 18
buttons/BottomDrawerOpen 294 330 18 18
blocks/HologramProjector1Top 312 324 16 16
blocks/HologramProjector2Top 329 324 16 16
blocks/HologramProjectorSide 346 324 16 16
buttons/BottomDrawerClose 275 349 18 18
buttons/BottomDrawerOpen 294 349 18 18
buttons/OpenFMRadioCloseOff 48 510 7 8
buttons/OpenFMRadioCloseOn 56 510 7 8
buttons/OpenFMRadioRedstoneOff 3 510 8 8
buttons/OpenFMRadioRedstoneOn 12 510 8 8
buttons/OpenFMRadioStartOff 178 305 24 24
buttons/OpenFMRadioStartOn 203 305 24 24
buttons/OpenFMRadioStopOff 228 305 24 24
buttons/OpenFMRadioStopOn 253 305 24 24
buttons/OpenFMRadioStartOff 178 324 24 24
buttons/OpenFMRadioStartOn 203 324 24 24
buttons/OpenFMRadioStopOff 228 324 24 24
buttons/OpenFMRadioStopOn 253 324 24 24
buttons/OpenFMRadioVolumeDownOff 9 484 10 10
buttons/OpenFMRadioVolumeDownOn 20 484 10 10
buttons/OpenFMRadioVolumeUpOff 31 484 10 10
buttons/OpenFMRadioVolumeUpOn 42 484 10 10
buttons/PowerOff 313 330 18 18
buttons/PowerOn 332 330 18 18
icons/Antenna 238 381 16 16
icons/ArrowRight 255 381 16 16
icons/AspectRatio 272 381 16 16
icons/ButtonCheck 153 363 17 17
icons/ButtonClipboard 171 363 17 17
icons/ButtonRandomize 189 363 17 17
icons/CPU 289 381 16 16
icons/Card 306 381 16 16
buttons/PowerOff 313 349 18 18
buttons/PowerOn 332 349 18 18
buttons/RackRelayOff 153 305 65 18
buttons/RackRelayOn 219 305 65 18
icons/Antenna 363 324 16 16
icons/ArrowRight 380 324 16 16
icons/AspectRatio 397 324 16 16
icons/ButtonCheck 153 382 17 17
icons/ButtonClipboard 171 382 17 17
icons/ButtonRandomize 189 382 17 17
icons/CPU 414 324 16 16
icons/Card 431 324 16 16
icons/Close 0 451 15 14
icons/Code 323 381 16 16
icons/ComponentBus 340 381 16 16
icons/Copy 357 381 16 16
icons/Cross 374 381 16 16
icons/Delete 391 381 16 16
icons/DragLMB 351 330 21 14
icons/DragRMB 373 330 21 14
icons/EEPROM 408 381 16 16
icons/Edit 425 381 16 16
icons/Eject 442 381 16 16
icons/File 459 381 16 16
icons/Floppy 476 381 16 16
icons/Folder 493 381 16 16
icons/FolderSlash 510 381 16 16
icons/Grid 187 330 22 22
icons/GridOff 210 330 22 22
icons/HDD 527 381 16 16
icons/Home 233 330 22 22
icons/Code 448 324 16 16
icons/ComponentBus 465 324 16 16
icons/Copy 482 324 16 16
icons/Cross 499 324 16 16
icons/Delete 516 324 16 16
icons/DragLMB 351 349 21 14
icons/DragRMB 373 349 21 14
icons/EEPROM 533 324 16 16
icons/Edit 550 324 16 16
icons/Eject 567 324 16 16
icons/File 584 324 16 16
icons/Floppy 601 324 16 16
icons/Folder 618 324 16 16
icons/FolderSlash 635 324 16 16
icons/Grid 187 349 22 22
icons/GridOff 210 349 22 22
icons/HDD 652 324 16 16
icons/Home 233 349 22 22
icons/LMB 71 466 11 14
icons/Label 544 381 16 16
icons/LinesHorizontal 561 381 16 16
icons/Link 578 381 16 16
icons/LinkSlash 595 381 16 16
icons/Memory 612 381 16 16
icons/Microchip 629 381 16 16
icons/NA 646 381 16 16
icons/Label 669 324 16 16
icons/LinesHorizontal 686 324 16 16
icons/Link 703 324 16 16
icons/LinkSlash 720 324 16 16
icons/Memory 737 324 16 16
icons/Microchip 754 324 16 16
icons/NA 771 324 16 16
icons/NotificationError 95 466 11 11
icons/NotificationInfo 107 466 11 11
icons/NotificationWarning 119 466 11 11
icons/Pin 26 466 14 14
icons/Plus 663 381 16 16
icons/Power 680 381 16 16
icons/Plus 788 324 16 16
icons/Power 805 324 16 16
icons/RMB 83 466 11 14
icons/Restart 697 381 16 16
icons/Save 714 381 16 16
icons/SaveAs 731 381 16 16
icons/Server 748 381 16 16
icons/Restart 822 324 16 16
icons/Save 839 324 16 16
icons/SaveAs 856 324 16 16
icons/Server 873 324 16 16
icons/SettingsSound 0 466 12 17
icons/SettingsUI 13 466 12 17
icons/Tier0 765 381 16 16
icons/Tier1 782 381 16 16
icons/Tier2 799 381 16 16
icons/Tiers 816 381 16 16
icons/Tier0 890 324 16 16
icons/Tier1 907 324 16 16
icons/Tier2 924 324 16 16
icons/Tiers 941 324 16 16
icons/Unpin 41 466 14 14
icons/WaveLFSR 121 434 24 10
icons/WaveNoise 146 434 24 10
icons/WaveSawtooth 171 434 24 10
icons/WaveSine 196 434 24 10
icons/WaveSquare 221 434 24 10
icons/WaveTriangle 246 434 24 10
icons/Window 833 381 16 16
icons/WaveLFSR 257 434 24 10
icons/WaveNoise 282 434 24 10
icons/WaveSawtooth 307 434 24 10
icons/WaveSine 332 434 24 10
icons/WaveSquare 357 434 24 10
icons/WaveTriangle 382 434 24 10
icons/Window 958 324 16 16
icons/WireArrowLeft 2 538 4 8
icons/WireArrowRight 7 538 4 8
items/APU0 85 305 16 96
items/APU1 102 305 16 96
items/APU2 119 305 16 96
items/CPU0 850 381 16 16
items/CPU1 867 381 16 16
items/CPU2 884 381 16 16
items/CardBase 901 381 16 16
items/CircuitBoard 918 381 16 16
items/ComponentBus0 935 381 16 16
items/ComponentBus1 952 381 16 16
items/ComponentBus2 969 381 16 16
items/ComponentBus3 986 381 16 16
items/CPU0 975 324 16 16
items/CPU1 992 324 16 16
items/CPU2 285 305 16 16
items/CardBase 302 305 16 16
items/CircuitBoard 319 305 16 16
items/ComponentBus0 336 305 16 16
items/ComponentBus1 353 305 16 16
items/ComponentBus2 370 305 16 16
items/ComponentBus3 387 305 16 16
items/DataCard0 0 305 16 128
items/DataCard1 17 305 16 128
items/DataCard2 34 305 16 128
items/DebugCard 1003 381 16 16
items/DiskDriveMountable 278 305 16 16
items/EEPROM 295 305 16 16
items/FloppyDisk_dyeBlack 312 305 16 16
items/FloppyDisk_dyeBlue 329 305 16 16
items/FloppyDisk_dyeBrown 346 305 16 16
items/FloppyDisk_dyeCyan 363 305 16 16
items/FloppyDisk_dyeGray 380 305 16 16
items/FloppyDisk_dyeGreen 397 305 16 16
items/FloppyDisk_dyeLightBlue 414 305 16 16
items/FloppyDisk_dyeLightGray 431 305 16 16
items/FloppyDisk_dyeLime 448 305 16 16
items/FloppyDisk_dyeMagenta 465 305 16 16
items/FloppyDisk_dyeOrange 482 305 16 16
items/FloppyDisk_dyePink 499 305 16 16
items/FloppyDisk_dyePurple 516 305 16 16
items/FloppyDisk_dyeRed 533 305 16 16
items/FloppyDisk_dyeWhite 550 305 16 16
items/FloppyDisk_dyeYellow 567 305 16 16
items/GraphicsCard0 584 305 16 16
items/GraphicsCard1 601 305 16 16
items/GraphicsCard2 618 305 16 16
items/HardDiskDrive0 635 305 16 16
items/HardDiskDrive1 652 305 16 16
items/HardDiskDrive2 669 305 16 16
items/InternetCard 153 330 16 32
items/DebugCard 404 305 16 16
items/DiskDriveMountable 421 305 16 16
items/EEPROM 438 305 16 16
items/FloppyDisk_dyeBlack 455 305 16 16
items/FloppyDisk_dyeBlue 472 305 16 16
items/FloppyDisk_dyeBrown 489 305 16 16
items/FloppyDisk_dyeCyan 506 305 16 16
items/FloppyDisk_dyeGray 523 305 16 16
items/FloppyDisk_dyeGreen 540 305 16 16
items/FloppyDisk_dyeLightBlue 557 305 16 16
items/FloppyDisk_dyeLightGray 574 305 16 16
items/FloppyDisk_dyeLime 591 305 16 16
items/FloppyDisk_dyeMagenta 608 305 16 16
items/FloppyDisk_dyeOrange 625 305 16 16
items/FloppyDisk_dyePink 642 305 16 16
items/FloppyDisk_dyePurple 659 305 16 16
items/FloppyDisk_dyeRed 676 305 16 16
items/FloppyDisk_dyeWhite 693 305 16 16
items/FloppyDisk_dyeYellow 710 305 16 16
items/GraphicsCard0 727 305 16 16
items/GraphicsCard1 744 305 16 16
items/GraphicsCard2 761 305 16 16
items/HardDiskDrive0 778 305 16 16
items/HardDiskDrive1 795 305 16 16
items/HardDiskDrive2 812 305 16 16
items/InternetCard 153 349 16 32
items/LinkedCard 136 305 16 96
items/Memory0 686 305 16 16
items/Memory1 703 305 16 16
items/Memory2 720 305 16 16
items/Memory3 737 305 16 16
items/Memory4 754 305 16 16
items/Memory5 771 305 16 16
items/NetworkCard 788 305 16 16
items/Memory0 829 305 16 16
items/Memory1 846 305 16 16
items/Memory2 863 305 16 16
items/Memory3 880 305 16 16
items/Memory4 897 305 16 16
items/Memory5 914 305 16 16
items/NetworkCard 931 305 16 16
items/OcelotCard 51 305 16 128
items/RedstoneCard0 805 305 16 16
items/RedstoneCard1 822 305 16 16
items/SelfDestructingCard 170 330 16 32
items/Server0 839 305 16 16
items/Server1 856 305 16 16
items/Server2 873 305 16 16
items/Server3 890 305 16 16
items/RedstoneCard0 948 305 16 16
items/RedstoneCard1 965 305 16 16
items/SelfDestructingCard 170 349 16 32
items/Server0 982 305 16 16
items/Server1 999 305 16 16
items/Server2 85 402 16 16
items/Server3 102 402 16 16
items/SoundCard 68 305 16 128
items/WirelessNetworkCard0 907 305 16 16
items/WirelessNetworkCard1 924 305 16 16
light-panel/BookmarkLeft 102 434 18 14
light-panel/BookmarkRight 207 363 20 14
items/WirelessNetworkCard0 119 402 16 16
items/WirelessNetworkCard1 136 402 16 16
light-panel/BookmarkLeft 238 434 18 14
light-panel/BookmarkRight 207 382 20 14
light-panel/BorderB 13 547 4 4
light-panel/BorderL 103 547 4 2
light-panel/BorderR 18 547 4 4
@ -164,73 +166,73 @@ light-panel/CornerTR 43 547 4 4
light-panel/Fill 6 558 2 2
light-panel/Vent 0 499 2 38
nodes/Cable 21 510 8 8
nodes/Camera 941 305 16 16
nodes/Camera 153 402 16 16
nodes/Chest 56 466 14 14
nodes/HologramProjector0 958 305 16 16
nodes/HologramProjector1 975 305 16 16
nodes/IronNoteBlock 992 305 16 16
nodes/Lamp 85 402 16 16
nodes/LampFrame 102 402 16 16
nodes/HologramProjector0 170 402 16 16
nodes/HologramProjector1 187 402 16 16
nodes/IronNoteBlock 204 402 16 16
nodes/Lamp 221 402 16 16
nodes/LampFrame 238 402 16 16
nodes/LampGlow 305 106 128 128
nodes/NewNode 119 402 16 16
nodes/NoteBlock 136 402 16 16
nodes/OpenFMRadio 153 402 16 16
nodes/Relay 170 402 16 16
nodes/computer/Activity 187 402 16 16
nodes/computer/Default 204 402 16 16
nodes/computer/Error 221 402 16 16
nodes/computer/On 238 402 16 16
nodes/disk-drive/Activity 255 402 16 16
nodes/disk-drive/Default 272 402 16 16
nodes/disk-drive/Floppy 289 402 16 16
nodes/rack/Default 306 402 16 16
nodes/rack/Empty 323 402 16 16
nodes/rack/drive/0/Activity 340 402 16 16
nodes/rack/drive/0/Default 357 402 16 16
nodes/rack/drive/0/Floppy 374 402 16 16
nodes/rack/drive/1/Activity 391 402 16 16
nodes/rack/drive/1/Default 408 402 16 16
nodes/rack/drive/1/Floppy 425 402 16 16
nodes/rack/drive/2/Activity 442 402 16 16
nodes/rack/drive/2/Default 459 402 16 16
nodes/rack/drive/2/Floppy 476 402 16 16
nodes/rack/drive/3/Activity 493 402 16 16
nodes/rack/drive/3/Default 510 402 16 16
nodes/rack/drive/3/Floppy 527 402 16 16
nodes/rack/drive/Floppy 544 402 16 16
nodes/rack/server/0/Activity 561 402 16 16
nodes/rack/server/0/Default 578 402 16 16
nodes/rack/server/0/Error 595 402 16 16
nodes/rack/server/0/On 612 402 16 16
nodes/rack/server/1/Activity 629 402 16 16
nodes/rack/server/1/Default 646 402 16 16
nodes/rack/server/1/Error 663 402 16 16
nodes/rack/server/1/On 680 402 16 16
nodes/rack/server/2/Activity 697 402 16 16
nodes/rack/server/2/Default 714 402 16 16
nodes/rack/server/2/Error 731 402 16 16
nodes/rack/server/2/On 748 402 16 16
nodes/rack/server/3/Activity 765 402 16 16
nodes/rack/server/3/Default 782 402 16 16
nodes/rack/server/3/Error 799 402 16 16
nodes/rack/server/3/On 816 402 16 16
nodes/screen/BottomLeft 833 402 16 16
nodes/screen/BottomMiddle 850 402 16 16
nodes/screen/BottomRight 867 402 16 16
nodes/screen/ColumnBottom 884 402 16 16
nodes/screen/ColumnMiddle 901 402 16 16
nodes/screen/ColumnTop 918 402 16 16
nodes/screen/Middle 935 402 16 16
nodes/screen/MiddleLeft 952 402 16 16
nodes/screen/MiddleRight 969 402 16 16
nodes/screen/PowerOnOverlay 986 402 16 16
nodes/screen/RowLeft 1003 402 16 16
nodes/screen/RowMiddle 0 434 16 16
nodes/screen/RowRight 17 434 16 16
nodes/screen/Standalone 34 434 16 16
nodes/screen/TopLeft 51 434 16 16
nodes/screen/TopMiddle 68 434 16 16
nodes/screen/TopRight 85 434 16 16
nodes/NewNode 255 402 16 16
nodes/NoteBlock 272 402 16 16
nodes/OpenFMRadio 289 402 16 16
nodes/Relay 306 402 16 16
nodes/computer/Activity 323 402 16 16
nodes/computer/Default 340 402 16 16
nodes/computer/Error 357 402 16 16
nodes/computer/On 374 402 16 16
nodes/disk-drive/Activity 391 402 16 16
nodes/disk-drive/Default 408 402 16 16
nodes/disk-drive/Floppy 425 402 16 16
nodes/rack/Default 442 402 16 16
nodes/rack/Empty 459 402 16 16
nodes/rack/drive/0/Activity 476 402 16 16
nodes/rack/drive/0/Default 493 402 16 16
nodes/rack/drive/0/Floppy 510 402 16 16
nodes/rack/drive/1/Activity 527 402 16 16
nodes/rack/drive/1/Default 544 402 16 16
nodes/rack/drive/1/Floppy 561 402 16 16
nodes/rack/drive/2/Activity 578 402 16 16
nodes/rack/drive/2/Default 595 402 16 16
nodes/rack/drive/2/Floppy 612 402 16 16
nodes/rack/drive/3/Activity 629 402 16 16
nodes/rack/drive/3/Default 646 402 16 16
nodes/rack/drive/3/Floppy 663 402 16 16
nodes/rack/drive/Floppy 680 402 16 16
nodes/rack/server/0/Activity 697 402 16 16
nodes/rack/server/0/Default 714 402 16 16
nodes/rack/server/0/Error 731 402 16 16
nodes/rack/server/0/On 748 402 16 16
nodes/rack/server/1/Activity 765 402 16 16
nodes/rack/server/1/Default 782 402 16 16
nodes/rack/server/1/Error 799 402 16 16
nodes/rack/server/1/On 816 402 16 16
nodes/rack/server/2/Activity 833 402 16 16
nodes/rack/server/2/Default 850 402 16 16
nodes/rack/server/2/Error 867 402 16 16
nodes/rack/server/2/On 884 402 16 16
nodes/rack/server/3/Activity 901 402 16 16
nodes/rack/server/3/Default 918 402 16 16
nodes/rack/server/3/Error 935 402 16 16
nodes/rack/server/3/On 952 402 16 16
nodes/screen/BottomLeft 969 402 16 16
nodes/screen/BottomMiddle 986 402 16 16
nodes/screen/BottomRight 1003 402 16 16
nodes/screen/ColumnBottom 0 434 16 16
nodes/screen/ColumnMiddle 17 434 16 16
nodes/screen/ColumnTop 34 434 16 16
nodes/screen/Middle 51 434 16 16
nodes/screen/MiddleLeft 68 434 16 16
nodes/screen/MiddleRight 85 434 16 16
nodes/screen/PowerOnOverlay 102 434 16 16
nodes/screen/RowLeft 119 434 16 16
nodes/screen/RowMiddle 136 434 16 16
nodes/screen/RowRight 153 434 16 16
nodes/screen/Standalone 170 434 16 16
nodes/screen/TopLeft 187 434 16 16
nodes/screen/TopMiddle 204 434 16 16
nodes/screen/TopRight 221 434 16 16
panel/BorderB 48 547 4 4
panel/BorderL 108 547 4 2
panel/BorderR 53 547 4 4

View File

@ -1,5 +1,8 @@
package ocelot.desktop.windows
import ocelot.desktop.ColorScheme
import ocelot.desktop.audio.SoundSource
import ocelot.desktop.color.Color
import ocelot.desktop.geometry.{Padding2D, Size2D}
import ocelot.desktop.graphics.Graphics
import ocelot.desktop.inventory.item.{NetworkCardItem, ServerItem}
@ -73,6 +76,17 @@ class RackWindow(rackNode: RackNode) extends PanelWindow {
override def maximumSize: Size2D = minimumSize
override def draw(g: Graphics): Unit = {
// Relay mode line
if (rackNode.rack.isRelayEnabled) {
g.sprite(
s"window/rack/NetworkConnector",
position.x + 12,
position.y + 172,
102,
4
)
}
// Lines background
g.sprite(
"window/rack/Lines",
@ -224,7 +238,7 @@ class RackWindow(rackNode: RackNode) extends PanelWindow {
new Label {
override def text: String = data
},
Padding2D(bottom = 6)
Padding2D(left = 20, bottom = 6)
)
}
@ -233,8 +247,42 @@ class RackWindow(rackNode: RackNode) extends PanelWindow {
addLabel("Back")
addLabel("Right")
addLabel("Left")
// Power button
children :+= new PaddingBox(
new IconButton(
"buttons/RackRelayOff",
"buttons/RackRelayOn",
mode = IconButton.Mode.Switch,
sizeMultiplier = 2,
model = IconButton.ReadOnlyModel(rackNode.rack.isRelayEnabled)
) {
override def onPressed(): Unit = rackNode.rack.isRelayEnabled = true
override def onReleased(): Unit = rackNode.rack.isRelayEnabled = false
override def draw(g: Graphics): Unit = {
super.draw(g)
val x = position.x + 38
val y = position.y + size.height / 2 - 8
val text = if (rackNode.rack.isRelayEnabled) "Enabled" else "Disabled"
// Shadow
g.foreground = ColorScheme("ButtonForeground")
g.text(x + 2, y + 1, text)
// Text itself
g.foreground = ColorScheme("ButtonBackground")
g.foreground = Color.White
g.text(x, y, text)
}
protected override def clickSoundSource: SoundSource = SoundSource.MinecraftClick
},
Padding2D(left = 16, top = 3)
Padding2D(left = -15, top = 45)
)
},
Padding2D(top = 3)
)
},
Padding2D(