Ejemplo n.º 1
0
    def __init__(self, parent):
        super().__init__(parent)

        self._drawing_panel = DrawingPanel(self, is_tilemap_mode=True)
        self._tilemap_panel = TilemapPanel(self)
        self._image_panel = ImagePanel(self, is_tilemap_mode=True)
        self._tilemap_picker = NumberPicker(self, 48, 161, 0,
                                            TILEMAP_BANK_COUNT - 1, 0)
        self._tool_button = RadioButton(self, 81, 161, 3, EDITOR_IMAGE_X + 63,
                                        EDITOR_IMAGE_Y, 7, TOOL_PENCIL)
        self._image_picker = NumberPicker(
            self,
            192,
            161,
            0,
            IMAGE_BANK_COUNT - 2,
            pyxel.tilemap(self._tilemap_picker.value).refimg,
        )

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("update", self.__on_update)
        self.add_event_handler("draw", self.__on_draw)
        self._tilemap_picker.add_event_handler("change",
                                               self.__on_tilemap_picker_change)
        self._image_picker.add_event_handler("change",
                                             self.__on_image_picker_change)
        self.add_number_picker_help(self._tilemap_picker)
        self.add_number_picker_help(self._image_picker)
        self.add_tool_button_help(self._tool_button)
Ejemplo n.º 2
0
    def __init__(self, parent):
        super().__init__(parent)

        self.field_cursor = FieldCursor(
            self.get_data,
            self.add_pre_history,
            self.add_post_history,
            MAX_SOUND_LENGTH,
            MAX_SOUND_LENGTH,
            4,
        )
        self.octave = 2
        self._is_playing = False
        self._play_pos = -1
        self._history_data = None
        self._sound_picker = NumberPicker(self, 45, 17, 0,
                                          pyxel.USER_SOUND_BANK_COUNT - 1, 0)
        self._speed_picker = NumberPicker(self, 105, 17, 1, 99,
                                          pyxel.sound(0).speed)
        self._play_button = ImageButton(self, 185, 17, 3, EDITOR_IMAGE_X + 126,
                                        EDITOR_IMAGE_Y)
        self._stop_button = ImageButton(self,
                                        195,
                                        17,
                                        3,
                                        EDITOR_IMAGE_X + 135,
                                        EDITOR_IMAGE_Y,
                                        is_enabled=False)
        self._loop_button = ImageToggleButton(self, 205, 17, 3,
                                              EDITOR_IMAGE_X + 144,
                                              EDITOR_IMAGE_Y)
        self._piano_keyboard = PianoKeyboard(self)
        self._piano_roll = PianoRoll(self)
        self._sound_field = SoundField(self)
        self._left_octave_bar = OctaveBar(self, 12, 25)
        self._right_octave_bar = OctaveBar(self, 224, 25)

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("hide", self.__on_hide)
        self.add_event_handler("update", self.__on_update)
        self.add_event_handler("draw", self.__on_draw)
        self._sound_picker.add_event_handler("change",
                                             self.__on_sound_picker_change)
        self._speed_picker.add_event_handler("change",
                                             self.__on_speed_picker_change)
        self._play_button.add_event_handler("press",
                                            self.__on_play_button_press)
        self._stop_button.add_event_handler("press",
                                            self.__on_stop_button_press)
        self._play_button.add_event_handler("mouse_hover",
                                            self.__on_play_button_mouse_hover)
        self._stop_button.add_event_handler("mouse_hover",
                                            self.__on_stop_button_mouse_hover)
        self._loop_button.add_event_handler("mouse_hover",
                                            self.__on_loop_button_mouse_hover)
        self.add_number_picker_help(self._sound_picker)
        self.add_number_picker_help(self._speed_picker)
Ejemplo n.º 3
0
    def __init__(self, parent):
        super().__init__(parent)

        self.cursor_x = 0
        self.cursor_y = 0
        self.octave = 2
        self._play_info = SoundEditor.PlayInfo()
        self._history_data = None
        self._sound_picker = NumberPicker(self, 45, 17, 0,
                                          AUDIO_SOUND_COUNT - 1, 0)
        self._speed_picker = NumberPicker(self, 105, 17, 1, 99,
                                          pyxel.sound(0).speed)
        self._play_button = ImageButton(self, 185, 17, 3, EDITOR_IMAGE_X + 126,
                                        EDITOR_IMAGE_Y)
        self._stop_button = ImageButton(self,
                                        195,
                                        17,
                                        3,
                                        EDITOR_IMAGE_X + 135,
                                        EDITOR_IMAGE_Y,
                                        is_enabled=False)
        self._loop_button = ImageToggleButton(self, 205, 17, 3,
                                              EDITOR_IMAGE_X + 144,
                                              EDITOR_IMAGE_Y)
        self._piano_keyboard = PianoKeyboard(self)
        self._piano_roll = PianoRoll(self)
        self._sound_input = SoundInput(self)
        self._left_octave_bar = OctaveBar(self, 12, 25)
        self._right_octave_bar = OctaveBar(self, 224, 25)

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("update", self.__on_update)
        self.add_event_handler("draw", self.__on_draw)
        self._sound_picker.add_event_handler("change",
                                             self.__on_sound_picker_change)
        self._speed_picker.add_event_handler("change",
                                             self.__on_speed_picker_change)
        self._play_button.add_event_handler("press",
                                            self.__on_play_button_press)
        self._stop_button.add_event_handler("press",
                                            self.__on_stop_button_press)
        self._play_button.add_event_handler("mouse_hover",
                                            self.__on_play_button_mouse_hover)
        self._stop_button.add_event_handler("mouse_hover",
                                            self.__on_stop_button_mouse_hover)
        self._loop_button.add_event_handler("mouse_hover",
                                            self.__on_loop_button_mouse_hover)
        self.add_number_picker_help(self._sound_picker)
        self.add_number_picker_help(self._speed_picker)
Ejemplo n.º 4
0
    def __init__(self, parent):
        super().__init__(parent)

        self._drawing_panel = DrawingPanel(self, is_tilemap_mode=False)
        self._image_panel = ImagePanel(self, is_tilemap_mode=False)
        self._color_picker = ColorPicker(self, 11, 156, 7, with_shadow=False)
        self._tool_button = RadioButton(
            self,
            81,
            161,
            pyxel.IMAGE_BANK_FOR_SYSTEM,
            EDITOR_IMAGE_X + 63,
            EDITOR_IMAGE_Y,
            7,
            TOOL_PENCIL,
        )
        self._image_picker = NumberPicker(self, 192, 161, 0,
                                          pyxel.USER_IMAGE_BANK_COUNT - 1, 0)

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("drop", self.__on_drop)
        self.add_event_handler("update", self.__on_update)
        self.add_event_handler("draw", self.__on_draw)
        self._color_picker.add_event_handler(
            "mouse_hover", self.__on_color_picker_mouse_hover)
        self.add_tool_button_help(self._tool_button)
        self.add_number_picker_help(self._image_picker)
Ejemplo n.º 5
0
    def __init__(self, parent):
        super().__init__(parent)

        self._is_playing = False
        self._play_pos = [0 for _ in range(pyxel.MUSIC_CHANNEL_COUNT)]
        self.field_cursor = FieldCursor(
            self.get_data,
            self.add_pre_history,
            self.add_post_history,
            MAX_MUSIC_LENGTH,
            16,
            pyxel.MUSIC_CHANNEL_COUNT,
        )
        self._music_picker = NumberPicker(self, 45, 17, 0,
                                          pyxel.MUSIC_BANK_COUNT - 1, 0)
        self._play_button = ImageButton(
            self,
            185,
            17,
            pyxel.IMAGE_BANK_FOR_SYSTEM,
            EDITOR_IMAGE_X + 126,
            EDITOR_IMAGE_Y,
        )
        self._stop_button = ImageButton(
            self,
            195,
            17,
            pyxel.IMAGE_BANK_FOR_SYSTEM,
            EDITOR_IMAGE_X + 135,
            EDITOR_IMAGE_Y,
        )
        self._loop_button = ImageToggleButton(
            self,
            205,
            17,
            pyxel.IMAGE_BANK_FOR_SYSTEM,
            EDITOR_IMAGE_X + 144,
            EDITOR_IMAGE_Y,
        )
        self._music_field = [
            MusicField(self, 11, 29 + i * 25, i) for i in range(4)
        ]
        self._sound_selector = SoundSelector(self)

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("hide", self.__on_hide)
        self.add_event_handler("update", self.__on_update)
        self.add_event_handler("draw", self.__on_draw)
        self._play_button.add_event_handler("press",
                                            self.__on_play_button_press)
        self._stop_button.add_event_handler("press",
                                            self.__on_stop_button_press)
        self._play_button.add_event_handler("mouse_hover",
                                            self.__on_play_button_mouse_hover)
        self._stop_button.add_event_handler("mouse_hover",
                                            self.__on_stop_button_mouse_hover)
        self._loop_button.add_event_handler("mouse_hover",
                                            self.__on_loop_button_mouse_hover)
        self.add_number_picker_help(self._music_picker)
Ejemplo n.º 6
0
    def __init__(self, parent):
        super().__init__(parent)

        self._sound_picker = NumberPicker(self, 45, 17, 0,
                                          AUDIO_SOUND_COUNT - 1, 0)
        self._speed_picker = NumberPicker(self, 105, 17, 0, 99, 0)

        self._scroll_var = ScrollBar(self,
                                     222,
                                     24,
                                     125,
                                     ScrollBar.VERTICAL,
                                     100,
                                     10,
                                     0,
                                     with_shadow=False)

        self.add_event_handler("draw", self.__on_draw)
Ejemplo n.º 7
0
    def __init__(self, parent):
        super().__init__(parent)

        self._music_picker = NumberPicker(self, 45, 17, 0, AUDIO_MUSIC_COUNT - 1, 0)
        self._play_button = ImageButton(self, 190, 17, 3, 126, 16)
        self._stop_button = ImageButton(self, 200, 17, 3, 135, 16)
        self._loop_button = ImageButton(self, 210, 17, 3, 144, 16)

        self.add_event_handler("draw", self.__on_draw)
Ejemplo n.º 8
0
    def __init__(self, parent):
        super().__init__(parent, "tilemap_editor.png")

        self._edit_frame = EditFrame(self, is_tilemap_mode=True)
        self._tilemap_frame = TilemapFrame(self)
        self._select_frame = ImageFrame(self, is_tilemap_mode=True)
        self._tilemap_number = NumberPicker(self, 48, 161, 0,
                                            RENDERER_TILEMAP_COUNT - 1)
        self._tool_button = RadioButton(self, 81, 161, 3, 81, 173, 7)
        self._image_number = NumberPicker(self, 192, 161, 0,
                                          RENDERER_IMAGE_COUNT - 2)

        self.color = 0
        self.tool = 1

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("update", self.__on_update)
Ejemplo n.º 9
0
    def __init__(self, parent):
        super().__init__(parent)

        self._edit_frame = EditFrame(self, is_tilemap_mode=True)
        self._tilemap_frame = TilemapFrame(self)
        self._image_frame = ImageFrame(self, is_tilemap_mode=True)
        self._tilemap_picker = NumberPicker(self, 48, 161, 0,
                                            RENDERER_TILEMAP_COUNT - 1, 0)
        self._tool_button = RadioButton(self, 81, 161, 3, 63, 16, 7,
                                        TOOL_PENCIL)
        self._image_picker = NumberPicker(self, 192, 161, 0,
                                          RENDERER_IMAGE_COUNT - 2, 0)

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("update", self.__on_update)
        self.add_event_handler("draw", self.__on_draw)
        self.add_number_picker_help(self._tilemap_picker)
        self.add_number_picker_help(self._image_picker)
        self.add_tool_button_help(self._tool_button)
Ejemplo n.º 10
0
    def __init__(self, parent):
        super().__init__(parent)

        self._music_picker = NumberPicker(self, 45, 17, 0,
                                          AUDIO_MUSIC_COUNT - 1, 0)
        self._play_button = ImageButton(self, 185, 17, 3, EDITOR_IMAGE_X + 126,
                                        EDITOR_IMAGE_Y)
        self._stop_button = ImageButton(self, 195, 17, 3, EDITOR_IMAGE_X + 135,
                                        EDITOR_IMAGE_Y)
        self._loop_button = ImageButton(self, 205, 17, 3, EDITOR_IMAGE_X + 144,
                                        EDITOR_IMAGE_Y)

        self.add_event_handler("draw", self.__on_draw)
Ejemplo n.º 11
0
    def __init__(self, parent):
        super().__init__(parent, "image_editor.png")

        self._edit_frame = EditFrame(self, is_tilemap_mode=False)
        self._image_frame = ImageFrame(self, is_tilemap_mode=False)
        self._color_picker = ColorPicker(self, 11, 156)
        self._tool_button = RadioButton(self, 81, 161, 3, 81, 173, 7)
        self._image_number = NumberPicker(self, 192, 161, 0,
                                          RENDERER_IMAGE_COUNT - 2)

        self.color = 7
        self.tool = 1

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
Ejemplo n.º 12
0
    def __init__(self, parent):
        super().__init__(parent)

        self._drawing_panel = DrawingPanel(self, is_tilemap_mode=False)
        self._image_panel = ImagePanel(self, is_tilemap_mode=False)
        self._color_picker = ColorPicker(self, 11, 156, 7, with_shadow=False)
        self._tool_button = RadioButton(self, 81, 161, 3, EDITOR_IMAGE_X + 63,
                                        EDITOR_IMAGE_Y, 7, TOOL_PENCIL)
        self._image_picker = NumberPicker(self, 192, 161, 0,
                                          RENDERER_IMAGE_COUNT - 2, 0)

        self.add_event_handler("undo", self.__on_undo)
        self.add_event_handler("redo", self.__on_redo)
        self.add_event_handler("update", self.__on_update)
        self.add_event_handler("draw", self.__on_draw)
        self.add_tool_button_help(self._tool_button)
        self.add_number_picker_help(self._image_picker)