2 registered members (AndrewAMD, alibaba),
1,426
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: variable width bitmap font renderer - free (A6
[Re: HeelX]
#152388
10/15/07 03:01
10/15/07 03:01
|
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B
Expert
|
Expert
Joined: Feb 2006
Posts: 2,185
|
. . . :[___
- aka Manslayer101
|
|
|
Re: variable width bitmap font renderer - free (A6
[Re: mpdeveloper_B]
#152389
10/15/07 11:09
10/15/07 11:09
|
Joined: Jul 2001
Posts: 6,904
HeelX
OP
Senior Expert
|
OP
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
|
|
|
Re: variable width bitmap font renderer - free (A6
[Re: mpdeveloper_B]
#152390
10/15/07 11:12
10/15/07 11:12
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
User
|
User
Joined: Mar 2006
Posts: 752
Portugal
|
Thanks HeelX, but im having some problems to make the inkey function works, maybe because i have so many things to do at same time, and im not paying the needed attention. So, please could you make a simple example how to implement it ? I really appreciate it. Of course we will give you credits when Xtreme Paintball is done, because of this great tool we are using here. Code:
if (connection > 1) { while (!str_len(playerName)) { p_insertName.visible = on; p_background.visible = on; p_build.visible = on; p_logo.visible = on; str_cpy (playerName, "new player "); RF_setFontRenderSettings(RF_CONSTANTS_CENTER, 0); RF_pnlRenderString(show_name, paintballFont, playerName); inkey (playerName); } }
Thanks, Jorge
Last edited by demiGod; 10/15/07 11:18.
|
|
|
Re: variable width bitmap font renderer - free (A6
[Re: demiGod]
#152391
10/15/07 12:05
10/15/07 12:05
|
Joined: Jul 2001
Posts: 6,904
HeelX
OP
Senior Expert
|
OP
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
You have to update the string-bitmap while inkey is active. Unfortunately, inkey pauses the running function. So, you have to start a coroutine BEFORE you execute inkey which runs as long as inkey is active. Make a new WDL file called "demo_inkey.wdl" and start it in the sample folder with the sample font to see how it works. Code:
include "fontRender.wdl";
PANEL pleaseEnterName { flags = visible; pos_x = 10; pos_y = 10; layer = 999; }
PANEL userName { flags = visible; pos_x = 280; pos_y = 10; layer = 999; }
var fontArial[256]; string tempStr; string userNameStr;
function inkeyRefresh (pnl, &fnt, strInkey);
function main () { vec_set(screen_color, vector(128,128,128));
RF_createFont(fontArial, "arial.tga");
RF_pnlRenderString(pleaseEnterName, fontArial, "Please enter your name:");
inkeyRefresh(userName, fontArial, userNameStr); inkey(userNameStr); //function will be paused until inkey is over userName.visible = off;
//say hello to the user RF_pnlRenderString(pleaseEnterName, fontArial, str_cat(str_cat(str_cpy(tempStr, "Hello, "), userNameStr), "!")); }
function inkeyRefresh (pnl, &fnt, strInkey) { wait(1); //wait to let inkey start (proc_late doesn't work for this)
//wait until inkey is finished while (inkey_active) {
//update text rendering RF_pnlRenderString(pnl, fnt, strInkey);
wait(1); } } Cheers, Christian
Last edited by HeelX; 10/15/07 12:05.
|
|
|
|