closes #4 commit8f060dc87bAuthor: John McCardle <mccardle.john@gmail.com> Date: Fri Mar 15 22:20:03 2024 -0400 Removing std::cout debugging statements commitc9d5251c71Author: John McCardle <mccardle.john@gmail.com> Date: Fri Mar 15 20:00:57 2024 -0400 In-place map modification worked commit0a8f67e391Author: John McCardle <mccardle.john@gmail.com> Date: Thu Mar 14 23:13:13 2024 -0400 Stress test is failing: By removing a timer to a function (from inside that function?) I can immediately cause a segfault. commit05d9f6a882Author: John McCardle <mccardle.john@gmail.com> Date: Tue Mar 12 22:27:12 2024 -0400 wow, good test of Key and Click Callable classes. Cleanup, squash, and merge after I give it a lookover in daylight, though. commit972768eb26Author: John McCardle <mccardle.john@gmail.com> Date: Tue Mar 12 21:02:48 2024 -0400 inital PyCallable work; isolate very well behaved usage of PyObject references behind RAII
45 lines
838 B
C++
45 lines
838 B
C++
#pragma once
|
|
#include "Common.h"
|
|
#include "Python.h"
|
|
|
|
class PyCallable
|
|
{
|
|
protected:
|
|
PyObject* target;
|
|
PyCallable(PyObject*);
|
|
~PyCallable();
|
|
PyObject* call(PyObject*, PyObject*);
|
|
public:
|
|
bool isNone();
|
|
};
|
|
|
|
class PyTimerCallable: public PyCallable
|
|
{
|
|
private:
|
|
int interval;
|
|
int last_ran;
|
|
void call(int);
|
|
public:
|
|
bool hasElapsed(int);
|
|
bool test(int);
|
|
PyTimerCallable(PyObject*, int, int);
|
|
PyTimerCallable();
|
|
};
|
|
|
|
class PyClickCallable: public PyCallable
|
|
{
|
|
public:
|
|
void call(sf::Vector2f, std::string, std::string);
|
|
PyObject* borrow();
|
|
PyClickCallable(PyObject*);
|
|
PyClickCallable();
|
|
};
|
|
|
|
class PyKeyCallable: public PyCallable
|
|
{
|
|
public:
|
|
void call(std::string, std::string);
|
|
//PyObject* borrow(); // not yet implemented
|
|
PyKeyCallable(PyObject*);
|
|
PyKeyCallable();
|
|
};
|