Skip to content

Commit

Permalink
feat: get virtual segments playing well with slides
Browse files Browse the repository at this point in the history
  • Loading branch information
unRARed committed Feb 6, 2025
1 parent 5a1156e commit 6b4e8f7
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 28 deletions.
12 changes: 9 additions & 3 deletions config/common/displays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ displays:
height: 480
default: true

# segment_displays:
# segment1:
# number: 1
segment_displays:
segment1:
number: 1
segment2:
number: 2
segment3:
number: 3
segment4:
number: 4
19 changes: 13 additions & 6 deletions config/common/players.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#config_version=6

# segment_display_player:
# player_score:
# segment1:
# flashing: off
# color: 00acf0
# text: "{players[0].score:d}"
segment_display_player:
player_score{game.num_players > 0}:
segment1:
text: "{players[0].score:d}"
player_score{game.num_players > 1}:
segment2:
text: "{players[1].score:d}"
player_score{game.num_players > 2}:
segment3:
text: "{players[2].score:d}"
player_score{game.num_players > 3}:
segment4:
text: "{players[3].score:d}"

sound_player:
mode_attract_started:
Expand Down
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# NOTE: this is needed for the unittests which expect
# the main config file to be named config.yaml.
config:
- production_macos.yaml
- development.yaml
84 changes: 84 additions & 0 deletions config/development/virtual_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,90 @@
hardware:
platform: smart_virtual

virtual_segment_display_connector:
segment_displays:
- segment1
- segment2
- segment3
- segment4

widgets:
segment_display_widget:
- type: segment_display_emulator
name: segment1
display_type: 7seg
character_count: 7
padding: 0.1
background_color: 11111160
color: blue
# character_slant_angle: 0
character_spacing: 10
segment_width: 0.09
# segment_interval: 0.04
segment_off_color: 222222
segment_on_color: 73a4ff
# side_bevel_enabled: false
# dot_enabled: false
# comma_enabled: false
text: ""
width: 180
height: 30
y: 450
x: 480
- type: segment_display_emulator
name: segment2
display_type: 7seg
character_count: 7
padding: 0.1
background_color: 11111160
character_spacing: 10
segment_width: 0.09
segment_off_color: 222222
segment_on_color: 73a4ff
text: ""
width: 180
height: 30
y: 450
x: 680
- type: segment_display_emulator
name: segment3
display_type: 7seg
character_count: 7
padding: 0.1
background_color: 11111160
character_spacing: 10
segment_width: 0.09
segment_off_color: 222222
segment_on_color: 73a4ff
text: ""
width: 180
height: 30
y: 400
x: 680
- type: segment_display_emulator
name: segment4
display_type: 7seg
character_count: 7
padding: 0.1
background_color: 11111160
character_spacing: 10
segment_width: 0.09
segment_off_color: 222222
segment_on_color: 73a4ff
text: ""
width: 180
height: 30
y: 350
x: 680

widget_player:
init_done:
segment_display_widget:
widget_settings:
# z: -1 is "always on top" per

This comment has been minimized.

Copy link
@unRARed

unRARed Feb 6, 2025

Author Contributor

this is a key setting

# https://missionpinball.org/latest/mc/widgets/layers/
z: -1

# So a dev/test game starts with balls in the trough
virtual_platform_start_active_switches:
- s_trough1
Expand Down
32 changes: 14 additions & 18 deletions tests/test_segment_displays.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@
class TestSegmentDisplays(DeathSaveMcTesting):

def test_segment1(self):
pass
# TODO: Bring back once we have the production
# hardware ports setup correctly
#
# self.assertModeRunning("attract")
self.assertModeRunning("attract")

# ## game begins and puts player1's score
# ## on the segment display
# self.hit_and_release_switch("s_start")
# self.hit_and_release_switch("s_shooter_lane")
# self.advance_time_and_run(1)
## game begins and puts player1's score
## on the segment display
self.hit_and_release_switch("s_start")
self.hit_and_release_switch("s_shooter_lane")
self.advance_time_and_run(1)

# self.assertEqual(self.machine.game.player.score,
# int(self.machine.segment_displays['segment1'].text))
self.assertEqual(self.machine.game.player.score,
int(self.machine.segment_displays['segment1'].text))

# ## player scores 10 points by hitting the
# ## grand advance switch scoring 10 points
# self.hit_and_release_switch("s_grand_advance")
# self.advance_time_and_run(1)
# self.assertEqual(10,
# int(self.machine.segment_displays['segment1'].text))
## player scores 10 points by hitting the
## grand advance switch scoring 10 points
self.hit_and_release_switch("s_grand_advance")
self.advance_time_and_run(1)
self.assertEqual(10,
int(self.machine.segment_displays['segment1'].text))

0 comments on commit 6b4e8f7

Please sign in to comment.