lite icon indicating copy to clipboard operation
lite copied to clipboard

How using C function to draw a text on screen?

Open fab1an2 opened this issue 4 years ago • 7 comments

Hello,

Anybody can help me creating example how drawing a text on screen?

fab1an2 avatar Dec 17 '20 11:12 fab1an2

i dunno how relevant this may be to the editor but what i do know for graphics related stuff, like making windows and rendering text to screen, people commonly use SDL2, especially when working with C

quadroli avatar Dec 17 '20 15:12 quadroli

This is borderline related to lite. Anyways, let me google that for you @fab1an2

takase1121 avatar Dec 19 '20 14:12 takase1121

using lite engine?

zerotrzy avatar Dec 22 '20 19:12 zerotrzy

I thought it was obvious. Yes, I would like to display the text with lite engine system C

@quadroli how fast is editor (benchmark) and trouble , errors

fab1an2 avatar Dec 23 '20 12:12 fab1an2

You should be using the methods on the "C-injected" renderer table.

If you want an example, you can look at my memusage plugin which uses the draw_text function to display Lua's RAM usage.

Edit: This is the exact line I call it.

Tmpod avatar Jan 25 '21 11:01 Tmpod

draw_text is also exposed via common.draw_text and can be required by require "core.common". This version provides some extra utilities such as alignment and returning the incremented stride instead of the stride alone.

takase1121 avatar Jan 25 '21 12:01 takase1121

I create a small repo. In future I create a benchmark (meybe convert to other g engine?) https://gitlab.com/0xtrzy/engine-tui/-/tree/master Question is why this code not working?

 rencache_begin_frame();
 rencache_draw_rect(male, czerwone);
 rencache_draw_text(foncik, "żółw", 14, 2, kolorek);
 rencache_end_frame();

(original comented https://gitlab.com/0xtrzy/engine-tui/-/blob/master/main.c )

Anybody can look at this repo and tell me why this code not showing text?

0xtrzy avatar Mar 13 '21 09:03 0xtrzy