Skip to content

Commit

Permalink
Merge pull request #45 from timothyschoen/master
Browse files Browse the repository at this point in the history
Improvements to pdlua graphics
  • Loading branch information
agraef committed Jul 15, 2024
2 parents 70fd51f + 22a2823 commit 88e2e3c
Show file tree
Hide file tree
Showing 3 changed files with 425 additions and 540 deletions.
18 changes: 10 additions & 8 deletions pd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,16 @@ function pd.Clock:destruct()
end

function pd.Clock:dispatch()
local m = self._target[self._method]
if type(m) == "function" then
return m(self._target)
else
self._target:error(
"no method for `" .. self._method ..
"' at clock of Lua object `" .. self._name .. "'"
)
if pd._objects[self._target] then
local m = self._target[self._method]
if type(m) == "function" then
return m(self._target)
else
self._target:error(
"no method for `" .. self._method ..
"' at clock of Lua object `" .. self._name .. "'"
)
end
end
end

Expand Down
8 changes: 6 additions & 2 deletions pdlua.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,32 @@

#include "m_pd.h"

#if !PLUGDATA
typedef enum {SCALE, TRANSLATE} transform_type;

typedef struct _gfx_transform
{
transform_type type;
float x, y;
} gfx_transform;
#endif

typedef struct _pdlua_gfx
{
// Size variables
int width, height;
void *object;

#if !PLUGDATA
char object_tag[128]; // Tcl/tk tag that is attached to all drawings
char order_tag[64]; // Tag for invisible line, used to preserve correct object ordering
char current_item_tag[64]; // Tcl/tk tag that is only attached to the current drawing in progress
gfx_transform* transforms;
int num_transforms;
char current_color[8]; // Keep track of current color

// Variables to keep track of mouse button state and drag position
int mouse_drag_x, mouse_drag_y, mouse_down;
int first_draw;

#else
void(*plugdata_draw_callback)(void*, t_symbol*, int, t_atom*); // Callback to perform drawing in plugdata
#endif
Expand Down
Loading

0 comments on commit 88e2e3c

Please sign in to comment.