Phase 1 - FOV Enum System: - Create PyFOV.h/cpp with mcrfpy.FOV IntEnum (BASIC, DIAMOND, SHADOW, etc.) - Add mcrfpy.default_fov module property initialized to FOV.BASIC - Add grid.fov and grid.fov_radius properties for per-grid defaults - Remove deprecated module-level FOV_* constants (breaking change) Phase 2 - Layer Operations: - Implement ColorLayer.fill_rect(pos, size, color) for rectangle fills - Implement TileLayer.fill_rect(pos, size, index) for tile rectangle fills - Implement ColorLayer.draw_fov(source, radius, fov, visible, discovered, unknown) to paint FOV-based visibility on color layers using parent grid's TCOD map The FOV enum uses Python's IntEnum for type safety while maintaining backward compatibility with integer values. Tests updated to use new API. Addresses #114 (FOV enum), #113 (layer operations) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
22 lines
836 B
C++
22 lines
836 B
C++
#pragma once
|
|
#include "Common.h"
|
|
#include "Python.h"
|
|
#include <libtcod.h>
|
|
|
|
// Module-level FOV enum class (created at runtime using Python's IntEnum)
|
|
// Stored as a module attribute: mcrfpy.FOV
|
|
|
|
class PyFOV {
|
|
public:
|
|
// Create the FOV enum class and add to module
|
|
// Returns the enum class (new reference), or NULL on error
|
|
static PyObject* create_enum_class(PyObject* module);
|
|
|
|
// Helper to extract algorithm from Python arg (accepts FOV enum, int, or None)
|
|
// Returns 1 on success, 0 on error (with exception set)
|
|
// If arg is None, sets *out_algo to the default (FOV_BASIC) and sets *was_none to true
|
|
static int from_arg(PyObject* arg, TCOD_fov_algorithm_t* out_algo, bool* was_none = nullptr);
|
|
|
|
// Cached reference to the FOV enum class for fast type checking
|
|
static PyObject* fov_enum_class;
|
|
};
|