Skip to content

Commit

Permalink
Fixed text drawing for non-gui objects
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Dec 20, 2023
1 parent d69208f commit 9ade045
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
27 changes: 27 additions & 0 deletions pdlua.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "m_pd.h"
#include "s_stuff.h" // for sys_register_loader()
#include "m_imp.h" // for struct _class
#include "g_canvas.h"
/* BAD: support for Pd < 0.41 */

#include "pdlua_gfx.h"
Expand Down Expand Up @@ -663,6 +664,30 @@ static void pdlua_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp
}

void pdlua_vis(t_gobj *z, t_glist *glist, int vis){
if(!((t_pdlua *)z)->has_gui)
{
t_text *x = (t_text *)z;
if (vis)
{
if (gobj_shouldvis(&x->te_g, glist))
{
t_rtext *y = glist_findrtext(glist, x);
text_drawborder(x, glist, rtext_gettag(y),
rtext_width(y), rtext_height(y), 1);
rtext_draw(y);
}
}
else
{
t_rtext *y = glist_findrtext(glist, x);
if (gobj_shouldvis(&x->te_g, glist))
{
text_eraseborder(x, glist, rtext_gettag(y));
rtext_erase(y);
}
}
return;
}
if(vis)
{
pdlua_gfx_repaint((t_object*)z);
Expand Down Expand Up @@ -876,6 +901,8 @@ static int pdlua_object_creategui(lua_State *L)
{
gfx_initialize(o);
}

return 0;
}

/** Lua object inlet creation. */
Expand Down
3 changes: 0 additions & 3 deletions pdlua_gfx.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <g_canvas.h>

typedef struct _pdlua_gfx
{
#if !PLUGDATA
Expand Down Expand Up @@ -647,7 +645,6 @@ static int line_to(lua_State* L) {
int x = luaL_checknumber(L, 1);
int y = luaL_checknumber(L, 2);


gfx->path_segments[gfx->num_path_segments][0] = x;
gfx->path_segments[gfx->num_path_segments][1] = y;
gfx->num_path_segments++;
Expand Down

0 comments on commit 9ade045

Please sign in to comment.