Draw var on texture

Posted By: Progger

Draw var on texture - 11/24/11 22:48

To make a speedometer i want to draw a var on a texture but how to do it is there some function to do it. Or do i have to write the function on my own?
Thanks for reading and answering laugh
PS:I also know some workarounds like changing the texture
But i want to learn something new so is there a function for it

WFG Progger
Posted By: 3run

Re: Draw var on texture - 11/24/11 23:00

May be adding additional view with panel, which will be visible only on it? Just a quick tought laugh
Posted By: Superku

Re: Draw var on texture - 11/24/11 23:11

You can use a panel (with digits) and panel.target_map = texture_pointer;
Posted By: Progger

Re: Draw var on texture - 11/27/11 10:59

Thank you Ssuperku i tried it but when i used it the skin of the model i used moved to the right side
Posted By: Superku

Re: Draw var on texture - 11/27/11 22:36

I'm sorry, I don't understand your problem. Try the following code (tested) with your own model:
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////

PANEL* panel =
{
	digits(20,20,"Frames: %f",*,1,total_frames);
	flags = SHOW | SHADOW;
}

void main()
{
	fps_max = 60;
	video_mode = 9;
	level_load(NULL);
	you = ent_create("object.mdl",vector(200,0,0),NULL);
	panel.target_map = bmap_for_entity(you,0);
}



The panel is updated and painted every frame but the entity's texture won't be cleared/ reloaded automatically, thus you will see old values "below" the current value. You can either reload the texture every frame (could be slow, I guess), render a background panel (again with target_map, lower layer value) into the same bitmap or simply set panel's bmap to a background image.
Posted By: sukseed

Re: Draw var on texture - 12/07/11 08:17

Yes I like all comment !!
__________________________
&#3612;&#3621;&#3610;&#3629;&#3621;-sbobet-&#3588;&#3634;&#3626;&#3...609;&#3660;-gclub
© 2024 lite-C Forums