Here is a small example of using a text gropnode:

----8<----

#include <picogui.h>

int main(int argc,char **argv) {
   pghandle w;

   pgInit(argc,argv);
   pgRegisterApp(PG_APP_NORMAL,"Canvas Text",0);
   w = pgNewWidget(PG_WIDGET_CANVAS,0,0);
 
   pgWriteCmd(w,PGCANVAS_GROP,5,PG_GROP_TEXT,50,50,1,1);
   pgWriteCmd(w,PGCANVAS_SETGROP,3,pgNewString("Hello,\nWorld!"),0,0x000000); 
   pgWriteCmd(w,PGCANVAS_COLORCONV,1,4);

   pgEventLoop();
}

----8<----

For a little explanation... (sorry this stuff is horribly undocumented now)
The text gropnode takes 3 params: A string handle, an optional font descriptor, and a 
color. Because the color is parameter 3, the mask '4' is used with the color 
conversion.
The width and height parameters in PGCANVAS_GROP are not used, but should
be > 0 for compatibility.
It's a little convoluted as it is because that's the way it works in the server, 
hopefully sometime relatively soon I'll make macros or something so the canvas 
operations are more sane.

On Wed, 21 March 2001, Philippe Ney wrote:

> 
> Hi Micah,
> 
> I try to write text in canvas widget in the following way:
> 
> pgWriteCmd(from,PGCANVAS_GROP,3,PG_GROP_TEXT,100,100);
> pgWriteCmd(from,PGCANVAS_SETGROP,2,PG_GROP_TEXT,pgNewString("TEST"));
> pgWriteCmd(from,PGCANVAS_SETGROP,1,0x000000);
> pgWriteCmd(from,PGCANVAS_COLORCONV,1,1);
> 
> But the result is just an black square from origine to the pointer.
> As when I try to load bitmap in the canvas widget.
> 
> Could you tell me how to write text and bitmap in canvas widget?
> 
> Thanks,
> Philippe
> 
> _______________________________________________
> Pgui-devel mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/pgui-devel

--

Only wimps use tape backup: _real_ men just upload
their important stuff on ftp, and let the rest of the
world mirror it ;)
  -- Linus Torvalds


_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to