Skip to content

Commit

Permalink
test and fix slides
Browse files Browse the repository at this point in the history
  • Loading branch information
jabdoa2 committed Feb 15, 2020
1 parent 8a35363 commit 6d03831
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 78 deletions.
26 changes: 18 additions & 8 deletions displays/slides/creating_slides.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Defining slides in the slides: section of a config file

The main way to do it is in the "slides" section of a config file, like this:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
slides:
some_slide:
Expand Down Expand Up @@ -92,13 +92,17 @@ documentation for the slide_player is in the

You can define slides in the slide_player like this:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
slide_player:
some_event:
my_slide_1:
- type: text
text: THIS IS MY SLIDE
slide_player:
some_event:
my_slide_1:
- type: text
text: THIS IS MY SLIDE
##! test
#! post some_event
#! advance_time_and_run .1
#! assert_text_on_top_slide "THIS IS MY SLIDE"
In the above example, when the event *some_event* is posted, the slide player
will respond and show the slide called *my_slide_1* which will include that
Expand All @@ -124,8 +128,10 @@ configuration section of a config file).
So here's an example of a slide created within a show for use within a specific
step in that show:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
#! show_player:
#! start_show: my_show
##! show: my_show
# show_version=5
- time: 0
Expand All @@ -137,6 +143,10 @@ step in that show:
- type: rectangle
width: 128
height: 32
##! test
#! post start_show
#! advance_time_and_run .1
#! assert_text_on_top_slide "MISSION PINBALL"
Again, see the :doc:`show documentation </shows/index>` for details. Here we're
just showing that it's also possible to define a slide in a show config.
105 changes: 61 additions & 44 deletions displays/slides/multiplayer_display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,37 @@ different pieces one-by-one as the number of players increases. In this example,
we have a large score for the current player, show the player's custom-variable
"level" in the lower-left, and their current ball number in the lower-right

.. code-block:: mpf-config
slides:
base_slide: []
slide_player:
single_player_ball_started: base_slide
widgets:
base_score_widget:
- type: text
text: (score)
style: score_style_singleplayer
base_level_widget:
- type: text
text: LVL (player|level)
style: mp_player_3
base_ball_widget:
- type: text
text: BALL (ball)
style: mp_player_4
widget_player:
# First event, before additional players have a chance to enter
game_started:
base_score_widget:
slide: base_slide
base_level_widget:
slide: base_slide
base_ball_widget:
slide: base_slide
.. code-block:: mpf-mc-config
slides:
base_slide: []
slide_player:
single_player_ball_started: base_slide
widgets:
base_score_widget:
- type: text
text: (score)
base_level_widget:
- type: text
text: LVL (player|level)
base_ball_widget:
- type: text
text: BALL (ball)
widget_player:
# First event, before additional players have a chance to enter
game_started:
base_score_widget:
slide: base_slide
base_level_widget:
slide: base_slide
base_ball_widget:
slide: base_slide
##! test
#! start_game
#! advance_time_and_run .1
#! assert_text_on_top_slide "0"
#! assert_text_on_top_slide "LVL 0"
#! assert_text_on_top_slide "BALL 1"
This is all we need to have a nice single-player slide that shows the score, the
ball, and a custom game-specific player variable.
Expand Down Expand Up @@ -84,22 +87,36 @@ Because the "game" mode exists between player turns, its slides can interfere
with other slide behavior (e.g. bonus slides and start/end of turn slides).
We'll keep it clean and manually clear the score slide at the end of each ball.

.. code-block:: mpf-config
slide_player:
single_player_ball_started: base_slide
multi_player_ball_started: multiplayer_slide
# If a second player joins during player1's turn, swap base_slide for multiplayer_slide
multiplayer_game:
base_slide:
action: remove
multiplayer_slide:
action: play
ball_will_end:
base_slide:
action: remove
multiplayer_slide:
action: remove
.. code-block:: mpf-mc-config
slides:
base_slide:
- type: text
text: "Single Player Game"
multiplayer_slide:
- type: text
text: "Multiplayer Player Game"
slide_player:
single_player_ball_started: base_slide
multi_player_ball_started: multiplayer_slide
# If a second player joins during player1's turn, swap base_slide for multiplayer_slide
multiplayer_game:
base_slide:
action: remove
multiplayer_slide:
action: play
ball_will_end:
base_slide:
action: remove
multiplayer_slide:
action: remove
##! test
#! start_game
#! advance_time_and_run .1
#! assert_text_on_top_slide "Single Player Game"
#! add_player
#! advance_time_and_run .1
#! assert_text_on_top_slide "Multiplayer Player Game"
With only two players, we can keep the "level" and "ball" widgets in the bottom
left and right corners. We want to add the player_1 and player_2 widgets in the
Expand Down
105 changes: 83 additions & 22 deletions displays/slides/showing_slides.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,38 @@ meaning that you basically say, "play THIS slide when THAT event happens".
For example, if you want to play a slide named "good_job" when the event
"left_lane_hit" is posted, you would set your config like this:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
slide_player:
left_lane_hit: good_job
#! slides:
#! good_job:
#! - type: text
#! text: "GOOD JOB"
slide_player:
left_lane_hit: good_job
##! test
#! post left_lane_hit
#! advance_time_and_run .1
#! assert_text_on_top_slide "GOOD JOB"
You can have as many event/slide combinations as you want, like this:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
slide_player:
left_lane_hit: good_job
right_lane_hit: good_job
left_ramp_hit: ramp_champ
#! slides:
#! good_job:
#! - type: text
#! text: "GOOD JOB"
#! ramp_champ:
#! - type: text
#! text: "RAMP CHAMP"
slide_player:
left_lane_hit: good_job
right_lane_hit: good_job
left_ramp_hit: ramp_champ
##! test
#! post left_lane_hit
#! advance_time_and_run .1
#! assert_text_on_top_slide "GOOD JOB"
The above examples are what we call the "express" config option since each
event specifies a slide name, but no other options. (It just uses the default
Expand All @@ -55,22 +74,40 @@ slide name, then *another* sub-entry with additional options, like this:
expire: 2s
target: dmd
##! test
##! post_event right_ramp_hit
##! advance_time_and_run .1
##! assert_text_on_top_slide "Ramp has been hit" dmd
#! post right_ramp_hit
#! advance_time_and_run .1
#! assert_text_on_top_slide "Ramp has been hit" dmd
You can mix-and-match all of these in a single config, like this:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
slide_player:
left_lane_hit: good_job
right_lane_hit: good_job
left_ramp_hit: ramp_champ
right_ramp_hit:
ramp_hit_slide:
expire: 2s
target: dmd
#! displays:
#! dmd:
#! width: 128
#! height: 32
#! slides:
#! ramp_hit_slide:
#! - type: text
#! text: Ramp has been hit
#! good_job:
#! - type: text
#! text: "GOOD JOB"
#! ramp_champ:
#! - type: text
#! text: "RAMP CHAMP"
slide_player:
left_lane_hit: good_job
right_lane_hit: good_job
left_ramp_hit: ramp_champ
right_ramp_hit:
ramp_hit_slide:
expire: 2s
target: dmd
##! test
#! post right_ramp_hit
#! advance_time_and_run .1
#! assert_text_on_top_slide "Ramp has been hit" dmd
In the example above, when the event "left_ramp_hit" happens, the slide
"ramp_champ" is shown. When the event "right_ramp_hit" happens, the slide
Expand All @@ -93,21 +130,45 @@ player in a show, you add a :doc:`/config/slides` section to a show step.
For example, if you want a slide called "happy_face" to play in a step in a
show, you can do it like this (this is a snippet of a single step in a show):

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
#! slides:
#! happy_face:
#! - type: text
#! text: "Happy Face"
#! show_player:
#! play_show: my_show
##! show: my_show
- duration: 3s
slides: happy_face
##! test
#! post play_show
#! advance_time_and_run .1
#! assert_text_on_top_slide "Happy Face"
Again, you can use the sub-entry format to specify additional options:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
#! displays:
#! playfield_screen:
#! width: 200
#! height: 300
#! slides:
#! happy_face:
#! - type: text
#! text: "Happy Face"
#! show_player:
#! play_show: my_show
##! show: my_show
- duration: 3s
slides:
happy_face:
target: playfield_screen
##! test
#! post play_show
#! advance_time_and_run .1
#! assert_text_on_top_slide "Happy Face"
Creating new slides in the slide_player
---------------------------------------
Expand Down
24 changes: 20 additions & 4 deletions displays/slides/split_screen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ representation of a blank canvas that holds graphical content. They are logical
We will need to define and configure five displays for this layout: one that covers the entire window area, and
four smaller ones that will each be used for one of the four smaller quadrant displays.

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
#config_version=5
window:
Expand Down Expand Up @@ -56,8 +56,24 @@ widget will be set to the corresponding display name that we want to display in
While the display widgets will automatically scale the display contents to fit in the widget boundaries, it is
recommended you use the same size display widget as the source display for the best visual results.

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
#! displays:
#! window:
#! width: 1280
#! height: 720
#! upper_left:
#! width: 580
#! height: 260
#! upper_right:
#! width: 580
#! height: 260
#! lower_left:
#! width: 580
#! height: 260
#! lower_right:
#! width: 580
#! height: 260
slides:
layout_4_mini:
background_color: red
Expand Down Expand Up @@ -115,7 +131,7 @@ is just as simple as creating slides and setting their target value to the name
them. Here is our example from the previous steps that has now been extended to show a simple slide in each of the
four quadrants:

.. code-block:: mpf-config
.. code-block:: mpf-mc-config
#config_version=5
window:
Expand Down

0 comments on commit 6d03831

Please sign in to comment.