Vertex Docs

GameEngine

Description: The GameEngine class is the core controller of a Vertex game. It is responsible for creating and managing the main window, controlling the game loop, enforcing FPS limits, and coordinating scene updates and rendering.

This class acts as the backbone of your game, connecting the window, scene system, rendering pipeline, and update loop into a single, unified engine instance.

Example: Usage

from VertexEngine.engine import GameEngine
from PyQt6.QtWidgets import QApplication
from PyQt6.QtGui import QIcon
import sys

if __name__ == '__main__':
    app = QApplication(sys.argv)  # Create Qt application

    # Initialize the game engine
    engine = GameEngine(
        fps=60, # Amount of calculation steps/second
        width=1920, # window resolution width (px)
        height=1080, # window resolution height (px)
        color=(0,0,0) # the color in (R, G, B)
    )

    engine.setWindowTitle("Screen.com/totally-not-virus")  # Window title DEFAULTS TO 'python3'
    engine.setWindowIcon(QIcon("snake.ico"))                # Window icon OPTIONAL
    engine.show()                                           # Show window

    main_scene = Main(engine)  # Initialize main scene

    engine.scene_manager.add_scene("main", main_scene)      # Register scene
    engine.scene_manager.switch_to("main")                  # Activate scene

    app.exec()  # Start the application loop

Responsibilities

Common Parameters

Returns

A fully initialized game engine instance that runs your game, manages FPS, controls rendering quality, and handles scene execution.

Notes