Views¶
Game views represent different screens and game states in the Pedre framework.
Location¶
GameView¶
Primary gameplay view with player control, NPCs, and interactions.
Constructor¶
from pedre import GameView
game_view = GameView(view_manager, map_file="level1.tmx", scene_name="forest")
Parameters:
view_manager: ViewManager- ViewManager instancemap_file: str- Path to Tiled .tmx map file (optional)scene_name: str- Unique identifier for this scene (optional)
Key Plugins¶
The GameView provides access to all game plugins through its context:
npc_plugin: NPCPlugin- NPC state and interactionsdialog_plugin: DialogPlugin- Dialog displayinventory_plugin: InventoryPlugin- Item managementscript_plugin: ScriptPlugin- Event-driven scriptsaudio_plugin: AudioPlugin- Sound and musicsave_plugin: SavePlugin- Game persistencecamera_plugin: CameraPlugin- Camera controlportal_plugin: PortalPlugin- Map transitionsinteraction_plugin: InteractionPlugin- Object interactionsparticle_plugin: ParticlePlugin- Visual effects
Example¶
# Access via view manager
game_view = view_manager.game_view
# Access plugins through context
context = game_view.context
npc_plugin = context.get_plugin("npc")
dialog_plugin = context.get_plugin("dialog")
MenuView¶
Main menu with navigation and asset preloading.
Constructor¶
Parameters:
view_manager: ViewManager- ViewManager instance
Configuration¶
Menu appearance is controlled through settings:
MENU_TITLE- Menu title textMENU_TITLE_SIZE- Font size for titleMENU_OPTION_SIZE- Font size for optionsMENU_SPACING- Vertical spacing between optionsMENU_BACKGROUND_IMAGE- Path to background imageMENU_PRELOAD_MUSIC_FILES- Music files to preload
See Configuration Guide for details.
Example¶
LoadGameView¶
Load game screen for selecting save slots.
Constructor¶
Parameters:
view_manager: ViewManager- ViewManager instance
Example¶
SaveGameView¶
Save game screen for selecting save slots.
Constructor¶
Parameters:
view_manager: ViewManager- ViewManager instance
Example¶
See Also¶
- ViewManager - View controller and transitions
- GameContext - Shared state container
- Plugins Reference - Individual plugin documentation