Announcement

Collapse
No announcement yet.

SampleMenu — FireMonkey Screen Manager Framework

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SampleMenu — FireMonkey Screen Manager Framework

    ================================================== ===========================
    SampleMenu — FireMonkey Screen Manager Framework
    Delphi FMX | Windows 1024x768
    ================================================== ===========================

    FILES
    -----
    SampleMenu.dpr — Main project
    MainForm.pas — Single form (no DFM, everything in code)
    class_screen.pas — TScreenManager + TGameScreen (adapted for FMX)
    screens.pas — All game scenes
    global.pas — Scene constants and shared variables

    SCENES
    ------
    SCREEN_LOGO_DEV ($0001) — Developer Studio logo (2s, F to skip)
    SCREEN_LOGO_PUB ($0002) — Distributor logo (2s, F to skip)
    SCREEN_MENU ($0003) — Main menu with FMX buttons
    SCREEN_LEVELMAP ($0004) — 100-level map (snake-style winding path)
    SCREEN_GAME ($0005) — Match3 game placeholder

    FLOW
    ----
    LogoDev → LogoPub → Menu
    ├─ Start Game → LevelMap → Game
    ├─ Free Play → Game (level 1)
    ├─ Credits → Dialog
    ├─ Options → Dialog
    └─ Exit → Closes app

    CONTROLS
    --------
    Logos: F = skip scene
    Menu: ESC = quit
    LevelMap: ← → or A D = navigate levels
    Enter = play selected level
    ESC = back to menu
    Game: ESC = back to map

    ARCHITECTURE
    ------------
    - No DFM: all components created in code inside DoCreate
    - FMX Canvas injected into TScreenManager every frame in OnPaint
    - FMX buttons overlaid on TPaintBox, visible only on SCREEN_MENU
    - Native FMX double buffering (no manual bitmap required)
    - Delta time via Now * 86400 (seconds of the day)

    HOW TO EXPAND
    -------------
    1. Add a new scene in screens.pas inheriting from TGameScreen
    2. Register the constant in global.pas
    3. Call FScreenManager.Add(...) in MainForm's DoCreate
    4. Use ExitScreen(SCREEN_NEW) to navigate to it

    ================================================== ===========================​

    In attach how to handle multiple scenes and just one Form(Firemonkey) on Delphi.
    Attached Files
    Last edited by anthonyedwardstark; 03-12-2026, 10:02 PM.

  • #2
    Originally posted by anthonyedwardstark View Post
    ================================================== ===========================
    SampleMenu — FireMonkey Screen Manager Framework
    Delphi FMX | Windows 1024x768
    ================================================== ===========================

    FILES
    -----
    SampleMenu.dpr — Main project
    MainForm.pas — Single form (no DFM, everything in code)
    class_screen.pas — TScreenManager + TGameScreen (adapted for FMX)
    screens.pas — All game scenes
    global.pas — Scene constants and shared variables

    SCENES
    ------
    SCREEN_LOGO_DEV ($0001) — Developer Studio logo (2s, F to skip)
    SCREEN_LOGO_PUB ($0002) — Distributor logo (2s, F to skip)
    SCREEN_MENU ($0003) — Main menu with FMX buttons
    SCREEN_LEVELMAP ($0004) — 100-level map (snake-style winding path)
    SCREEN_GAME ($0005) — Match3 game placeholder

    FLOW
    ----
    LogoDev → LogoPub → Menu
    ├─ Start Game → LevelMap → Game
    ├─ Free Play → Game (level 1)
    ├─ Credits → Dialog
    ├─ Options → Dialog
    └─ Exit → Closes app

    CONTROLS
    --------
    Logos: F = skip scene
    Menu: ESC = quit
    LevelMap: ← → or A D = navigate levels
    Enter = play selected level
    ESC = back to menu
    Game: ESC = back to map

    ARCHITECTURE
    ------------
    - No DFM: all components created in code inside DoCreate
    - FMX Canvas injected into TScreenManager every frame in OnPaint
    - FMX buttons overlaid on TPaintBox, visible only on SCREEN_MENU
    - Native FMX double buffering (no manual bitmap required)
    - Delta time via Now * 86400 (seconds of the day)

    HOW TO EXPAND
    -------------
    1. Add a new scene in screens.pas inheriting from TGameScreen
    2. Register the constant in global.pas
    3. Call FScreenManager.Add(...) in MainForm's DoCreate
    4. Use ExitScreen(SCREEN_NEW) to navigate to it

    ================================================== ===========================​

    In attach how to handle multiple scenes and just one Form(Firemonkey) on Delphi.
    Hello, this is a very smart way to work with multiple screens, singleton can make a lots of bugs!

    Thank you!

    Comment

    Working...
    X