SFML Python Library #14

Closed
opened 2024-03-09 18:38:09 +00:00 by john · 2 comments
Owner

notes say:
18 feat: Expose SFML library as a built-in

Is there an official wrapper for SFML? Can it be included as a built in?

Intentions:

  • Use SFML classes directly where they're used in McRogueFace (colors, vectors, textures, fonts)
  • Allow Python to instantiate and provide those objects, handle the handoff to get SFML pointers directly (i.e. follow the "C++ First" tenet, don't call Python every frame)
  • Prep for Window class which has more SFML objects that aren't of great interest to the rest of McRogueFace
  • If there's no library available, consider a mcrfpy.SFML submodule to expose the useful functionality
notes say: 18 feat: Expose SFML library as a built-in Is there an official wrapper for SFML? Can it be included as a built in? Intentions: * Use SFML classes directly where they're used in McRogueFace (colors, vectors, textures, fonts) * Allow Python to instantiate and provide those objects, handle the handoff to get SFML pointers directly (i.e. follow the "C++ First" tenet, don't call Python every frame) * Prep for Window class which has more SFML objects that aren't of great interest to the rest of McRogueFace * If there's no library available, consider a `mcrfpy.SFML` submodule to expose the useful functionality
john added the
Major Feature
label 2024-03-09 18:38:09 +00:00
john added this to the Alpha Release Targets milestone 2024-03-13 14:54:50 +00:00
Author
Owner

Status: Superseded by alternative approach

  • Instead of exposing SFML directly, the codebase now:
    • Has mcrfpy.libtcod submodule for FOV/pathfinding (src/McRFPy_Libtcod.h)
    • Exposes SFML-like types natively: mcrfpy.Color, mcrfpy.Vector, mcrfpy.Texture, mcrfpy.Font
    • Uses PyColor, PyVector, PyTexture, PyFont wrappers throughout

The goal of "use SFML classes directly" is effectively achieved through native mcrfpy types that wrap SFML objects.

Status: Superseded by alternative approach - Instead of exposing SFML directly, the codebase now: - Has mcrfpy.libtcod submodule for FOV/pathfinding (src/McRFPy_Libtcod.h) - Exposes SFML-like types natively: mcrfpy.Color, mcrfpy.Vector, mcrfpy.Texture, mcrfpy.Font - Uses PyColor, PyVector, PyTexture, PyFont wrappers throughout The goal of "use SFML classes directly" is effectively achieved through native mcrfpy types that wrap SFML objects.
john closed this issue 2025-11-26 10:12:41 +00:00
Author
Owner

Superseded by Current Approach

Instead of exposing SFML directly, the codebase now:

  1. Native mcrfpy types wrap SFML objects:

    • mcrfpy.Color wraps sf::Color
    • mcrfpy.Vector wraps sf::Vector2f
    • mcrfpy.Texture wraps texture loading
    • mcrfpy.Font wraps font loading
  2. mcrfpy.libtcod submodule for algorithms:

    • FOV computation
    • A* and Dijkstra pathfinding
    • Line algorithms

This approach is cleaner than a separate SFML module because:

  • Types are integrated directly into the mcrfpy namespace
  • No need to import a separate module
  • Types are designed for McRogueFace's use cases

The goal of "use SFML classes directly" is effectively achieved through native mcrfpy types.

## Superseded by Current Approach Instead of exposing SFML directly, the codebase now: 1. **Native mcrfpy types** wrap SFML objects: - `mcrfpy.Color` wraps `sf::Color` - `mcrfpy.Vector` wraps `sf::Vector2f` - `mcrfpy.Texture` wraps texture loading - `mcrfpy.Font` wraps font loading 2. **`mcrfpy.libtcod` submodule** for algorithms: - FOV computation - A* and Dijkstra pathfinding - Line algorithms This approach is cleaner than a separate SFML module because: - Types are integrated directly into the mcrfpy namespace - No need to import a separate module - Types are designed for McRogueFace's use cases The goal of "use SFML classes directly" is effectively achieved through native mcrfpy types.
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: john/McRogueFace#14
No description provided.