2026-01-10 21:31:20 -05:00
|
|
|
#pragma once
|
|
|
|
|
#include "Common.h"
|
|
|
|
|
#include "Python.h"
|
|
|
|
|
|
|
|
|
|
// Module-level MouseButton enum class (created at runtime using Python's IntEnum)
|
|
|
|
|
// Stored as a module attribute: mcrfpy.MouseButton
|
|
|
|
|
//
|
|
|
|
|
// Values map to sf::Mouse::Button:
|
2026-04-09 22:19:02 -04:00
|
|
|
// LEFT = 0
|
|
|
|
|
// RIGHT = 1
|
|
|
|
|
// MIDDLE = 2
|
|
|
|
|
// X1 = 3
|
|
|
|
|
// X2 = 4
|
2026-01-10 21:31:20 -05:00
|
|
|
|
|
|
|
|
class PyMouseButton {
|
|
|
|
|
public:
|
|
|
|
|
// Create the MouseButton 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 mouse button from Python arg
|
2026-04-09 22:19:02 -04:00
|
|
|
// Accepts MouseButton enum, string (enum name), or int
|
2026-01-10 21:31:20 -05:00
|
|
|
// Returns 1 on success, 0 on error (with exception set)
|
|
|
|
|
static int from_arg(PyObject* arg, sf::Mouse::Button* out_button);
|
|
|
|
|
|
|
|
|
|
// Cached reference to the MouseButton enum class for fast type checking
|
|
|
|
|
static PyObject* mouse_button_enum_class;
|
|
|
|
|
|
|
|
|
|
// Number of mouse buttons
|
|
|
|
|
static const int NUM_MOUSE_BUTTONS = 5;
|
|
|
|
|
};
|