Question about texts

Posted By: Caermundh

Question about texts - 06/16/12 17:40

I know that I can use size_x & size_y to limit the horizontal and vertical display area of a text, and I can use offset_y to scroll the text vertically. Is there such a thing offset_x to scroll a text horizontally?
Posted By: Germanunkol

Re: Question about texts - 06/17/12 07:41

I don't think there is such a thing as offset_x.

Can't you just change pos_x ? Or is the problem that you want it to move out of the window and not be displayed any more?
The other thing you can try (not tested) is to use a render_target and render onto a (possibly transparent, if you don't want any additional images) panel. Then display that panel instead of displaying the text directly on the screen. It should have the same effect, and if you only do it for a text, it shouldn't be much slower (but don't hold me to that).
Posted By: Caermundh

Re: Question about texts - 06/17/12 21:00

as you said, i want the text to scroll off the window and not be displayed anymore. I want to be able to scroll a text both horizontally and/or vertically and limit the text display to a given area.

Ive (sort of) found a way to do it copying the string to a temp text and clipping the string using str_clip/str_trunc, then displaying the temp text instead of the real text. it *almost* works - but its kinda painful and clunky.

How would i render text to panel with render_target? I looked up render_target in the manual and it gives me a bunch of shader code - shaders just plain make my brain hurt. I dont understand the concept - let alone the code.
Posted By: Superku

Re: Question about texts - 06/17/12 22:25

You can use panel.target_map to render panels into bitmaps.
Posted By: Caermundh

Re: Question about texts - 06/17/12 22:59

but how do i convert a text to a bitmap or panel to begin with? or can i use text.target_map to render the text into a bitmap?
Posted By: Superku

Re: Question about texts - 06/18/12 00:00

Quote:
can i use text.target_map to render the text into a bitmap?

Yes. Did you check the manual?
Posted By: Caermundh

Re: Question about texts - 06/18/12 00:30

ok, read the manual - tried the following:

TEXT* test_text =
{ layer = 10;
strings = 1;
string("This is a test string.");
}

PANEL* test_panel =
{ layer = 10;
pos_x = 25;
pos_y = 25;
flags = SHOW;
}

funciton main()
{ test_panel.bmap = test_text.target_map;
}

This didnt work - what am i missing here?
Posted By: Superku

Re: Question about texts - 06/18/12 01:02

Your code does not make much sense.

BMAP* my_bitmap = "...";

test_text.target_map = my_bitmap;

Then draw the bitmap in a panel or with draw_quad.
Posted By: Caermundh

Re: Question about texts - 06/18/12 01:11

im trying to get the text from the text into a bitmap - IE get the string "this is a test string" into a bmap format.
Posted By: Superku

Re: Question about texts - 06/18/12 01:45

Quote:
im trying to get the text from the text into a bitmap - IE get the string "this is a test string" into a bmap format.

=>
Quote:
BMAP* my_bitmap = "...";

test_text.target_map = my_bitmap;

Then draw the bitmap in a panel or with draw_quad.

© 2024 lite-C Forums