display.editor_frame documentation - wladekpal/The-Lazy-Snek GitHub Wiki
EditorFrame
Abstract class representing subsurface of display.editor_view.EditorView
view.
Properties
width
- frame width in pixelsheight
- frame height in pixelsposition
- two elements (x, y) tuple representing frame's top left corner position on application windowsurface
-pygame.Surface
type object representing frame's surface
EditorFrame(screen, details).
Creates new frame, where screen
is main application window. details
is two-element (position, dimensions) tuple, where position is (x, y) tuple of frame top left corner on application window and dimensions is (width, height) tuple of frame size in pixels.
resize(self, screen, details)
Resizes frame. Arguments similar to constructor. Should be called after application window was resized.
pos_in_frame_area(self, pos):
Checks whether given position pos
on application window overlaps with frame and returns True
if so and False
otherwise.
get_relative_pos(self, pos):
Takes pos
, wchich is position on application frame. Returns same position, but sets coordinates relatively to frame's surface, where (0, 0) point is frame's top left corner instead of application window's top left corner.
handle_click(pos, active_tool, active_id, editor_container)
Handles right_click event on frame's area, where pos
is position where frame was clicked, active_tool
is EditorTool
value indicating level editor tool that is currently active, active_id
is id of field or block currently focused in all blocks available in game frame (see engine.id_parser) and editor_container
is wrapper for currently created level (see engine.editor_container)
refresh()
Updates frame's displayed content.
EditorTool
Enum type for all tools available in level editor.
Values
ADD_BLOCK
- tool for adding blocks and fields to level boardERASE
- tool for erasing blocks, fields and snakes from level board and blocks from frame with all blocks available in levelSNAKE_CREATOR
- tool for adding snake to level board and extending itSNAKE_CHANGE_COLOR
- tool for changing snake colorSNAKE_ROTATE_HEAD
- tool for rotating snake headTELEPORT_LINKER
- tool for linking teleport entrance and exitADD_TO_LEVEL
- tool for adding blocks to collection of blocks available in level in side pane (blocks used to solve level)