GLBasic forum

Main forum => GLBasic - en => Topic started by: MrTAToad on 2008-Oct-09

Title: Reverting to standard font
Post by: MrTAToad on 2008-Oct-09
Is it possible to get SETFONT to revert back to the standard/default font (ie the one used by the LOADING text) ?

I've tried using SETFONT -1 and I get some strange small font...
Title: Re: Reverting to standard font
Post by: Kitty Hello on 2008-Oct-09
No, this font is no real font. It's just to show you, that you need to load a font.
You can load your font to bank 1, so 0 is untouched, though.
Title: Re: Reverting to standard font
Post by: Hemlos on 2008-Oct-09
Quote from: MrTAToad on 2008-Oct-09
Is it possible to get SETFONT to revert back to the standard/default font (ie the one used by the LOADING text) ?

I've tried using SETFONT -1 and I get some strange small font...


This might be offtopic, or maybe it will be handy?
You can change the loading message by loading a font and printing before the actual load call..
Here is a method of making your own loading message...it is a complete working program example:

Code (loading messages:) Select


LIMITFPS -1 //make it fast load
AUTOPAUSE FALSE //force to load even if window focus lost

CENTERPRINT("Loading Images..")

LOADSPRITE "mouse.bmp",0
LOADSPRITE "colormap2.bmp",1

CENTERPRINT("Loading Objects..")

X_LOADOBJ "obj0.ddd",0
X_LOADOBJ "obj1.ddd",1

CENTERPRINT("Loading System..")

LOCAL mx,my,mb1,mb2,color
SETTRANSPARENCY RGB(0,0,0)
SYSTEMPOINTER TRUE
AUTOPAUSE TRUE
LIMITFPS 60

WHILE TRUE
CENTERPRINT("Main Loop")
WEND

FUNCTION CENTERPRINT: TEXT$

//function remembers font/screen stuff here
STATIC fx,fy,sx,sy,INIT_FONT
IF INIT_FONT=FALSE //only load this once and is remembered in function static memory
INIT_FONT=TRUE //prevent doing all this stuff more than once
LOADFONT "smalfont.png",1
SETFONT 1
GETFONTSIZE fx,fy
GETSCREENSIZE sx, sy
ENDIF

LOCAL MsgCenX,MsgCenY
MesCenX=(sx/2)-(LEN(TEXT$)*fx/2)
MesCenY=(sy/2)-(fy/2)
PRINT TEXT$,MesCenX,MesCenY
SHOWSCREEN //move this to the program main body if you want to use the function elsewhere
SLEEP 500  //remove this if you want loading to move faster(this is just to see it working)

ENDFUNCTION

Title: Re: Reverting to standard font
Post by: MrTAToad on 2008-Oct-09
QuoteThis might be offtopic, or maybe it will be handy?
Thanks for that.  Might come in useful later on :)

QuoteYou can load your font to bank 1, so 0 is untouched, though.
Will probably have to do that.
Title: Re: Reverting to standard font
Post by: Hemlos on 2008-Oct-09
Quote from: MrTAToad on 2008-Oct-09
Thanks for that.  Might come in useful later on :)

Aye, i had to make something like this for my own programs as they grew in size.
Title: Re: Reverting to standard font
Post by: Kitty Hello on 2008-Oct-09
did you try LOADFONT "", 0 ??
Title: Re: Reverting to standard font
Post by: MrTAToad on 2008-Oct-09
Yes, I get some small font - its just about readable

(http://www.nicholaskingsley.co.uk/MiscThings/untitled.jpg)