예제 #1
0
def register_new_type() -> int:
    """
    Calls the custom_type function from the PyGame event module to create a new user type, effectively registering a new
    event type ID that can be used.
    :return: int
    """
    return custom_type()
예제 #2
0
import pygame.event as event

IDLE = event.custom_type()
NEWTILE = event.custom_type()
예제 #3
0
from pygame.event import Event, post, custom_type

SELECT_TILE = custom_type()
DESELECT_TILE = custom_type()

DISPLAY_SELECTED_TILE_POPUP = custom_type()
HIDE_SELECTED_TILE_POPUP = custom_type()

DISPLAY_POPUP = custom_type()
HIDE_POPUP = custom_type()

TOGGLE_FULLSCREEN = custom_type()

TOGGLE_BUILD_MODE = custom_type()

GAME_TICK = custom_type()

PURCHASE = custom_type()


def create_select_tile_event(tile):
    print('dispatching SELECT_TILE')
    post(Event(SELECT_TILE, {"tile": tile}))
    create_display_selected_tile_popup()


def create_deselect_tile_event():
    print('dispatching DESELECT_TILE')
    create_hide_selected_tile_popup()
    post(Event(DESELECT_TILE))
예제 #4
0
# Copyright (C) 2021 Thomas Schott <*****@*****.**>
#
# This file is part of dicewars_pygame.
#
# dicewars_pygame is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# dicewars_pygame is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dicewars_pygame.  If not, see <http://www.gnu.org/licenses/>.

from pygame.event import custom_type


BUTTON_NUM_SEATS = custom_type()  # attributes: num_seats (int)
BUTTON_SHUFFLE = custom_type()
BUTTON_START = custom_type()
BUTTON_END_TURN = custom_type()
BUTTON_CONTINUE = custom_type()
BUTTON_RESTART = custom_type()
BUTTON_REPLAY = custom_type()

TIMER_NEXT_STEP = custom_type()  # attributes: next_step (callable)
예제 #5
0
    all the old events.
    """
    def __new__(cls, x,  *args, **kwargs):
        instance = int.__new__(cls, x, *args, **kwargs)
        return instance

    def __eq__(self, other):
        warn("Pygame GUI event types can now "
             "be used directly as event.type "
             "rather than event.user_type. This old style user_type event will "
             "go away in version 0.8.0", DeprecationWarning, stacklevel=2)
        return int.__eq__(self, other)


# UI Event types
UI_BUTTON_PRESSED = custom_type()
UI_BUTTON_START_PRESS = custom_type()
UI_BUTTON_DOUBLE_CLICKED = custom_type()
UI_BUTTON_ON_HOVERED = custom_type()
UI_BUTTON_ON_UNHOVERED = custom_type()
UI_TEXT_BOX_LINK_CLICKED = custom_type()
UI_TEXT_ENTRY_CHANGED = custom_type()
UI_TEXT_ENTRY_FINISHED = custom_type()
UI_DROP_DOWN_MENU_CHANGED = custom_type()
UI_HORIZONTAL_SLIDER_MOVED = custom_type()
UI_SELECTION_LIST_NEW_SELECTION = custom_type()
UI_SELECTION_LIST_DROPPED_SELECTION = custom_type()
UI_SELECTION_LIST_DOUBLE_CLICKED_SELECTION = custom_type()
UI_WINDOW_CLOSE = custom_type()
UI_WINDOW_MOVED_TO_FRONT = custom_type()
UI_CONFIRMATION_DIALOG_CONFIRMED = custom_type()