Rendering Text and Graphics
Jump to navigation
Jump to search
To put text and/or graphics on a cubelet screen, you put code in the ON_Render() routine.
This code would put some text on screen 0 on the cubelet where the code is running, displaying the cubelet # and the screen #, and a small blue circle.
GFX_setRenderTarget(0); GFX_drawText([ 120,180 ], TEXT_SIZE, 0, 0, TEXT_ALIGN_CENTER, 0xFF0000FF, "md: %d sn:%d", SELF_ID,0); GFX_drawSolidCircleXY(80,80,10,0xFF0000FF); GFX_render();
- Once you call GFX_setRenderTarget, everything currently on that screen is erased
- Once you call GFX_Render, all of the calls after the previous GFX_setRenderTarget will "take effect"
- The upshot of this is that anything you want to appear on the screen has to all be executed between those two statements. You can render some text in one place and add more text or circles in another place. Therefore you may have a lot of logic in ON_Render to determine what should be drawn at any given time.