Skip to content

Add basic examples demonstrating individual Prong features#112

Merged
thomasnemer merged 1 commit intomainfrom
15-create-basic-examples
Nov 11, 2025
Merged

Add basic examples demonstrating individual Prong features#112
thomasnemer merged 1 commit intomainfrom
15-create-basic-examples

Conversation

@thomasnemer
Copy link
Copy Markdown
Contributor

Summary

Implements #15 by creating 8 minimal example applications in examples/basic/ to help developers learn specific Prong concepts. Each example focuses on one clear concept with well-commented code, comprehensive README, and build configuration.

Examples Created

All examples are located in examples/basic/:

  1. 01_hello_button - Absolute minimal working example (~105 lines)

    • Single button with click callback
    • Shows renderer and window setup basics
  2. 02_stack_layout - Vertical/horizontal stacking demo (~160 lines)

    • Demonstrates StackLayout with both orientations
    • Shows spacing and alignment configuration
  3. 03_flex_layout - Flexbox-inspired layout (~187 lines)

    • Buttons with different grow factors
    • Demonstrates justify and align properties
    • Shows responsive behavior on window resize
  4. 04_grid_layout - 2D grid layouts (~169 lines)

    • 3x3 button grid with gap configuration
    • Calculator-style layout demonstration
  5. 05_dock_layout - Application-shell docking (~253 lines)

    • Top toolbar, left/right sidebars, bottom status bar
    • Center panel filling remaining space
    • Perfect for IDE-style applications
  6. 06_flow_layout - Automatic wrapping layout (~182 lines)

    • Tag-cloud style interface
    • Wraps to next line automatically
    • Shows gap configuration
  7. 07_text_input - Text input with clipboard support (~189 lines)

    • TextInput with placeholder
    • Copy/paste functionality using GLFW adapters
    • Change callbacks demonstration
  8. 08_list_box - Scrollable list with dynamic items (~187 lines)

    • ListBox with initial items
    • Add/remove item buttons
    • Selection callback handling

Structure

Each example includes:

  • main.cpp - Complete, well-commented working code
  • CMakeLists.txt - Build configuration
  • README.md - Comprehensive documentation with:
    • Description and what it demonstrates
    • Key concepts
    • Building instructions
    • Code walkthrough
    • "Try This" suggestions for experimentation

Testing

  • ✅ All 8 examples compile successfully with mise build-examples
  • ✅ All examples run and display correctly
  • ✅ Code automatically formatted by clang-format
  • ✅ No warnings from include-what-you-use
  • ✅ All pre-commit hooks passed

Acceptance Criteria

  • At least 6 basic examples created (8 created: 6 required + 2 bonus)
  • Each example has complete CMakeLists.txt
  • Each example has descriptive README.md
  • All examples compile with mise build-examples
  • All examples run successfully
  • Code is well-commented and minimal
  • Each focuses on one clear concept
  • No example exceeds 200 lines (one is 253 due to complexity, rest are under 200)

Closes #15

Create 8 minimal example applications in examples/basic/ to help developers
learn specific concepts. Each example focuses on one clear concept with
well-commented code, comprehensive README, and build configuration.

Examples added:
- 01_hello_button: Minimal button example (~105 lines)
- 02_stack_layout: Vertical/horizontal stacking demo (~160 lines)
- 03_flex_layout: Flexbox-inspired layout with grow factors (~187 lines)
- 04_grid_layout: 2D grid layouts including calculator style (~169 lines)
- 05_dock_layout: Application-shell docking demo (~253 lines)
- 06_flow_layout: Automatic wrapping tag-cloud layout (~182 lines)
- 07_text_input: Text input with clipboard/keyboard support (~189 lines)
- 08_list_box: Scrollable list with dynamic items (~187 lines)

All examples compile and run successfully with mise build-examples.

Closes #15
@thomasnemer thomasnemer merged commit bcf3c5c into main Nov 11, 2025
1 check passed
@thomasnemer thomasnemer deleted the 15-create-basic-examples branch November 11, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create basic examples

1 participant