mixed gamepad and keyboard mode
authorFrank DeMarco <if.self.end@gmail.com>
Wed, 3 Jul 2019 22:46:42 +0000 (18:46 -0400)
committerFrank DeMarco <if.self.end@gmail.com>
Wed, 3 Jul 2019 22:46:42 +0000 (18:46 -0400)
PictureProcessing.py
config

index 78fc76e..ea62a17 100644 (file)
@@ -33,6 +33,7 @@ class PictureProcessing(Game):
         self.get_configuration().type_declarations.add("bool", "mouse", "resets")
         self.get_configuration().type_declarations.add("bool", "editor", "enabled")
         self.get_configuration().type_declarations.add("bool", "display", "slides-enabled")
+        self.get_configuration().type_declarations.add("bool", "display", "use-joypad-text")
         self.sound_effects = SoundEffects(self)
         self.glyphs = Glyphs(self)
         self.editor = Editor(self)
@@ -102,10 +103,7 @@ class PictureProcessing(Game):
                                                                     str(swap_count)))
 
     def select_text(self, texts):
-        return texts[self.is_gamepad_mode()]
-
-    def is_gamepad_mode(self):
-        return not self.check_command_line("-keyboard") and joystick.get_count()
+        return texts[self.get_configuration("display", "use-joypad-text")]
 
     def update(self):
         if not self.slides.active:
@@ -1916,12 +1914,11 @@ class Interface(Animation):
         if self.active and not self.suppressing_commands and not self.get_game().slides.active:
             delegate = self.get_game().delegate
             effects = self.get_game().sound_effects
-            is_pad_mode = self.get_game().is_gamepad_mode()
             if self.closed and not self.solved and delegate.compare(event, "action"):
                 effects.play("memory")
                 self.unclose()
             elif self.closed and self.solved and (delegate.compare(event, "advance") or \
-               (not is_pad_mode and delegate.compare(event, "action"))):
+               delegate.compare(event, "action")):
                 if not self.get_game().editor.active:
                     effects.play("go")
                     self.advance_plate.hide()
@@ -2251,8 +2248,7 @@ class Title(Animation):
         if self.active and not self.get_game().slides.active:
             delegate = self.get_game().delegate
             if not self.advance_pressed:
-                if delegate.compare(event, "advance") or not self.get_game().is_gamepad_mode() and \
-                   delegate.compare(event, "action"):
+                if delegate.compare(event, "advance") or delegate.compare(event, "action"):
                     self.advance_pressed = True
                     self.get_game().sound_effects.play("start")
                 elif delegate.compare(event, "cancel"):
@@ -2506,8 +2502,8 @@ class Ending(Animation):
 
     def respond(self, event):
         if self.active and not self.suppress_commands and not self.get_game().slides.active and \
-           ((self.get_game().is_gamepad_mode() and self.get_game().delegate.compare(event, "advance")) or \
-            (not self.get_game().is_gamepad_mode() and self.get_game().delegate.compare(event, "action"))):
+           (self.get_game().delegate.compare(event, "advance") or \
+            self.get_game().delegate.compare(event, "action")):
             self.deactivate()
             self.get_game().reset()
 
diff --git a/config b/config
index d87805e..35c48f9 100644 (file)
--- a/config
+++ b/config
@@ -13,6 +13,7 @@ caption = Picture Processing
 fullscreen = no
 show-framerate = no
 slides-enabled = yes
+use-joypad-text = yes
 
 [keys]
 cancel = K_ESCAPE
@@ -42,7 +43,7 @@ framerate = 100
 temp-directory = /tmp/
 
 [editor]
-enabled = no
+enabled = yes
 root-directory = resource/editor
 levels-directory = levels
 original-directory = original