Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Texting different font sizes problem...

Author
Message
Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 20th Sep 2009 02:39
Writing a footy sim in DB but cant seem to achieve writing text in different font sizes. I know that simply texting in different font sizes in the same sync loop wont work but was hoping to get round it by doing a 'get image ' approach on the larger font size, then texturing a plain (all prior to the main loop), then within the loop the usual text command to do the small font size. This works, until I need to update the big font size when a goal is scored (big font size contains team names and plus the score between them)

Doing...

cls
set font size 30
text 0,0,Team1$+score$+Team$
get image 1,top,left,bottom,right
texture plain 1,1
etc

causes a flickering effect (presumably the cls statement does this)

Is there other way to achieve what I'm trying to do?

Thanks in advance
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 20th Sep 2009 05:18
Quote: "causes a flickering effect (presumably the cls statement does this)"


try cls after the sync; also make sure at the start of your code you have sync on

and

sync rate 60 or what you need.

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Sep 2009 11:39 Edited at: 20th Sep 2009 11:46
@Hanger
1. Make sure that whenever you change the font style you include the character set after it:

set font "arial",1 (1 is the English character set)

2. Whenever you change the font size, you might have to include a sync after each font size adjustment

set text size 50
sync

do stuff

set text font size 20
sync

Even though this may not be necssary for display purposes, it adjusts the sizes reported back in Text Width() and Text Height() commands.

3. Make sure you are not using the Print command to display your text as setting font or text sizes won't behave as you expect. Use the Text command.

Enjoy your day.
Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 20th Sep 2009 15:52
@dark dragon: was already doing this but no luck

@latch: the problem of having a 2 syncs in 1 loop is it slows things down, unless thats not what you meant. I need to have say

the score of say

ITALY 2 - 1 CROATIA (in big size 26 text)

plus commentary of say

Conte passes to Manchini (in smaller size 12 text)

all within the one loop.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Sep 2009 16:46 Edited at: 20th Sep 2009 16:46
You could just load the alphabet as images, and replace the strings with the textured images on plains. Your way is easier, but my way, you can have better font designs.

Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 20th Sep 2009 23:49
@Pincho: Thanks, I was hoping to avoid this approach but as you say it does allow better font designs. One question - how do you design your fonts ie do you know of any good techniques in PSP or Photoshop for designing nice fonts?

Cheers
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Sep 2009 10:52 Edited at: 21st Sep 2009 10:55
In Photoshop make a new file with a black background. Now type the letter A in white using a font (you don't want too much space at the sides, else the letter will not align easily). New Layer 'B' new layer 'C' etc...
Now they are all in a row on the layer menu.....

Click the top one, and hold shift, and click the bottom one. This selects all of the layers in one go. Now right click the layers, and select Rasterize Type.

Click the right hand side of one of the layers, to bring up the Layer effects. Click Bevel, and Emboss, and mess around with it, until you have a nice 3D sort of look. Changing the flat effect to a round style looks best. Move the light around to see what looks good.

Now go down to gradient overlay. Lots of gradients to choose from, also you can change the colours quite easily.

Once you have 1 letter done you can click OK, and then see it in the layers. Now right click on it, and choose copy layer style. You can copy it to all of your other letters. Then save them all with a name that ends with a number 1 to 26 (or 52 if you want capitals, and small letters). It is then easier to load them all in a loop which appends the number to a string.

Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 21st Sep 2009 11:10 Edited at: 21st Sep 2009 11:10
Thanks for this! I probably should have stated I only have PSP (paint shop pro) but PSP has similar features to photoshop and broadly following what you said above I have been able to get some cool effects.

Thanks again.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Sep 2009 02:44
Quote: "Conte passes to Manchini"

How long ago did you start making this game?

Glad to see someone trying this type of game, I have also been plotting a football management game but haven't coded anything yet because quite frankly it scares me! The AI involved to control 22 players on a football pitch is way beyond me at this point.

I did come up with a way to simplify this though; the pitch is divided into twelve sections, each player has a positional score for each section that states the likelyhood of them being in that section, the factors that make up this score are their playing position, tactical behaviours (assigned by manager i.e. defenders told to go up for corners) and their speed and awareness. The position of the ball would also effect these scores; i.e. if the ball is on the right side of the pitch most players will gravitate towards that side.

I'd like to hear how you plan to simulate the in-game action and maybe we can exchange ideas.

TGC Forum - converting error messages into sarcasm since 2002.

Login to post a reply

Server time is: 2024-05-09 09:28:18
Your offset time is: 2024-05-09 09:28:18