DavidHAVE / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

bitlash #63

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Add binding to http://bitlash.net/
probably needs something like
u8g line 1 2 3 4
ug8 text x y "text"
--> not sure if bitslash supports strings for user defined functions

Original issue reported on code.google.com by olikr...@gmail.com on 16 Apr 2012 at 11:11

GoogleCodeExporter commented 8 years ago
Bitlash user defined functions are able to accept string constant arguments.  
In your user function, cast the result of getarg(n) to char* and off you go.  
So ug8_text(22,33,"foo") would work just fine for text placement.

Original comment by bill....@palmeta.com on 19 Apr 2012 at 1:48

GoogleCodeExporter commented 8 years ago
Hi Bill
Thanks for clarification!

Original comment by olikr...@gmail.com on 19 Apr 2012 at 2:44

GoogleCodeExporter commented 8 years ago
If you like, it is pretty easy to get printf-formatted output using the 
built-in bitlash printf() formatter via the func_printf_handler hook, something 
like this:

//////////
//
//  Send one byte of generated output to the text display system
//  Used in func_xyprintf() below.
//
void display_put_char(byte) {
    // call your function to display one byte of generated output
    // do bookkeeping for the position of the next char here too
    ...
}

//////////
//
// xyprintf(): print formatted output at [x,y]
//
//  Examples: 
//      xyprintf(0, 0, "Hello, world!");
//      xyprintf(22, 5, "Time: %5d", millis);
//
numvar func_xyprintf(void) {

    // call your function to save the text rendering position
    // set_xy(getarg(0), getarg(1));
    ...

    // generate formatted output
    setOutputHandler(&display_put_char);    // redirect output to handler above
    func_printf_handler(3,4);       // format=arg(3), optional args start at 4
    resetOutputHandler();           // restore normal serial output
    return 0;
}

Original comment by bill....@palmeta.com on 19 Apr 2012 at 3:25

GoogleCodeExporter commented 8 years ago
wow, but i guess i have to implement some basic functionailty first.

Original comment by olikr...@gmail.com on 19 Apr 2012 at 3:46

GoogleCodeExporter commented 8 years ago
i never found time to implement this :-(
Closing this for now...

Original comment by olikr...@gmail.com on 22 Jan 2014 at 7:57