Hi guys,
I've just downloaded the trial version of GLBasic and am trying to understand it, but with difficulty! You must think this is dumb, but I have a few stupid questions that I hope someone can help me with:
1) When I'm using the GLBasic editor, I can't seem to use my "down arrow" key whereas all the other keys ("up arrow", "left arrow" and "right arrow" keys) are working - is there a bug? The "down arrow" key seems to be working perfectly in this forum and when using MSWord.
2) I tried using the inbuilt Font Creator but am not sure where to place the file created (default as "smallfont.png"). Should it be in the same folder as the xxx.gbap and xxx.gbas files, or in the xxx.app folder? When placed in the xxx.app folder, it seems to work, but in the reverse, i.e., the PRINT statement before the LOADFONT statement actually prints correctly using the new font, but the PRINT statement after the LOADFONT statement uses the default font instead.
What am I doing wrong here? Thanks!
1. This is a known bug in an old version of GLbasic. Search for the latest public released demo and you should be sorted.
2. All graphics (including fonts) and sfx and music needs to go into the Media folder of your app. When you create a program in GLB it automatically creates a folder (with the name of your project) and inside that will be a Media folder - pop everything in there. Make sure you use the SETFONT command.
:)
1. This bug should be fixed in the last release version, try "WEB" -> "Internet Update" (or how ever it is called in the English version). But you can also try the latest Beta (http://www.glbasic.com/forum/index.php?topic=8544.0), its still test phase, but i dont think that i has more bugs then last stable release.
2. Like Ian said best place for all materials is in the "Media" folder. Of cause if you store something there you should set SETCURRENTDIR to that folder.
GLBasic is not realy a demoversion...
2D is free :whistle:
Quote from: Schranz0r on 2013-May-28
GLBasic is not realy a demoversion...
2D is free :whistle:
To a point, the 2D is free on Windows/Mac/Linux & time limited demo on the other supported platforms. Also if you want to distribute your creation you have to buy the license, not sure if you need a licence to distribute Windows/Mac/Linux programs as freeware tbh.
Lee
2D on Win/Linux/Mac is free, which means that you do not need any licence. At least that's how I understand it.
That's what I thought, but if you sell your Windows/Mac/Linux program/game then the main site says.
QuoteFree for non commercial projects on Windows, Linux and Mac OSX
So I am presuming that if you give your game away as freeware no license is required.
Lee
Ah you are right, just checked the feature page (http://www.glbasic.com/main.php?lang=en&site=features), no commercial use in free version.
Thanks for your replies, everyone.
I hope that the buggy 2D version for download will be changed eventually because that may put others off from buying. My problem still persists in that the PRINT statement before the LOADFONT and SETFONT statements actually prints correctly using the new font, but the PRINT statement after the LOADFONT and SETFONT statements uses the default font instead.
Another question - where do I find help on the touch commands used by GLBasic for mobile phones? Are they the mouse commands? If so, how do you deal with multi-touch? Thanks again.
Fonts should be no problem if used right, I dont use the release V10 but the beta V11, but still there should be no problem with that. I just tested and it worked fine (be sure the SETCURRENTDIR to the correct folder before):
LOADFONT "smalfont.png", 0
SETFONT 0
Touche commands = mouse commands. If you want to get multitouch you need to check for multiple mice with the command SETACTIVEMOUSE (check for GETMOUSECOUNT). Multitouch gestures needs to get programmed by yourself, but there might be code for this in the forum.
Multi-touch is handled by checking the MOUSECOUNT value, and going through each mouse index returned - there is an example in the Showroom.
Thanks for the quick responses, guys. Glad multitouch can be implemented using GLBasic.
Perhaps my problem with the fonts has to do with the buggy version I downloaded.
I'll go ahead and purchase the full 3D version! ;)
Strange, I have used all versions of version 10 (from 1st & all subsequent updates to current 10.283) & a few of the 11 betas & can't say I have ever had font problems.
Like previous posts have said make sure your font is in the media folder where the GLB project is, make sure SETCURRENTDIR("Media") is at the top of your program code.
Then LOADFONT "myfont.png",0 followed by SETFONT 0.
All uses of PRINT after the above will use the loaded font.
Buying the full version unlocks 3d, networking, inline c/c++ plus the other platforms (rather it removes the time limit on those features as they all work in the free version plus allows you to sell your game). So basically the full version will produce the same results you are currently getting.
If you post the code you are having problems or issues with someone here will help & show you what's going wrong or if indeed it is a bug.
Lee
Sent from my HTC Wildfire using Tapatalk 2
The fonts work fine in the demo... You need to make sure that the font is loaded and set before using.
Thanks, MrTAToad. Will experiment more.
ive noticed if you create your own font using the editor but keep the default name of "smallfont.png" or "smallfont.bmp" and use LOADFONT "smallfont.png",1 / USEFONT 1 your created font wont actually be loaded, but if you rename that font to something different it works, so id further assume if we call LOADFONT "smallfont.xxx" then the actual small/default font we usually see is loaded from ram or something?
definatley not advisable using the default name, i did this at first and thought glbasic was broken or was acting weird because i'm running it via WINE/PlayOnUnix in ubuntu, once i found the default name messes things up, all has been well.
SF, I can offer some lessons I've learned when trying to create custom fonts. GLbasic has a few quirks when it comes to fonts which we all quickly learn to deal with. After a time or two, using custom fonts will be as easy as can be.
1. In the Font Creator tool, always click on the [C:\ ...] button to set your path, THEN click on the [OK, Create] button. If you think you have created a font, only to have it go missing, suspect that you forgot to set the path or click on the OK button.
2. When setting the path, be sure to locate and select the Media folder. (You may have to open a couple of folders from within the wizard to get there.)
3. Start each program with the following code. (Change "smalfont.png" to whatever you named your font. The name is cap sensitive.)
SETSCREEN 1366,768,TRUE
GLOBAL sw%,sh%;GETSCREENSIZE sw,sh
SETCURRENTDIR(GETCURRENTDIR$()+"Media")
GLOBAL fontkey% = GENFONT()
LOADFONT "smalfont.png",fontkey
SETFONT fontkey
GLOBAL fw%,fh%;GETFONTSIZE fw,fh
4. If you use the default name, realize that there is only ONE "l" in "smalfont.png".
5. Always include the ".png" extension when you load your font. If you don't include the extension, the program may not load it. I'm not sure why, just that this has been an issue for me in the past.
6. Don't add ".png" when naming your font, or you may windup with something like "name.png.png".
7. Post if you have any trouble and someone will be very happy to help. We have a good crew here.
8. Have fun!
Cheers!
-CW
I've just bought the full version.
Thanks a lot for the advice, geekpeter! Incredibly, it is now working! :D Who would have thought that renaming the filename would make such a difference?
These are the bugs/features that a newbie would be challenged with. Wish there was an FAQ section for newbies that details all these bugs/features.
Thanks again.
@geekpeter. Thanks for that info, I have always named my fonts in relation to their usage (along with sprites & sound etc) so have not ran into that problem but at least I am now aware of it for future reference :) .
Lee
Sent from my HTC Wildfire using Tapatalk 2
I can not confirm this problem with the default name, it always worked for me.
Btw. there is a better version of the font creator that offers more options: http://www.glbasic.com/forum/index.php?topic=6421.
Quote from: kanonet on 2013-May-28
I can not confirm this problem with the default name, it always worked for me.
Btw. there is a better version of the font creator that offers more options: http://www.glbasic.com/forum/index.php?topic=6421.
for such an improved font creator, is there a problem or quirk with it that has stopped it being packaged as standard?
Its not written by Gernot :)
I have had my share of ´problems´ with fonts loading. Not something I, as people said, could not solve in a couple days ::).
Media folder, font name, extension and precise loading was my key.
You also may want to be aware of BMP as it uses the transparent color(pink), against the PNG, that pushes a self transparent color (not alpha).
Take your time understanding how it works.
GLB versions did not make a difference to me, so it is not a bug my guess?
I´m using the font appended in my projects as on screen debug display. A veeeeery small cut-off-guess-what font =D
Somehow, the black background reads as transparent on GLB automatically, maybe related to how you save the file from the font editor? like what colors you choose to be transparent so it overides the settrasparency thing on a font level?
Maybe that could be called a quirk?
Anyways, mess with it a bit, printing fonts on screen is very important, getting the hang of how that goes is way cool! 8)
I don´t have a solve-all solution, post a code/font file if it gets to be a strong issue.
Like I said, I did spend a couple days figuring that out, and I´m not sure I did completely and in a good way ::)
Cheers, welcome aboard! :good:
PS: I´m using the same smalfont.png without trouble on multiple platforms.
EDIT: you can see on my font, that I have a dark blue outline, that is there cause if I used a black outline, it would be called transparent on screen.
Thanks, Erico, for the welcome.
In another language, I would usually write a subroutine/procedure myself to display proportional fonts. It's just that in GLBasic you have it built in which I find fascinating, provided it works well! :)
It does work, SFguy, it may need a little time to start and catch up.
I did build a game fully on "print" with about 5 fonts all displaying over each other similar to what a rogue like or ascii game would look like.
Fonts were done with the standard font tool.
It all worked fine.
Should you have too much trouble with it, post an example code, we will figure out. :good:
Will do, erico. Thanks!
I may have many questions over the next couple of weeks as I learn to get up to speed on GLBasic! :)
Quote from: geekpeter on 2013-May-28
... the default name of "smallfont.png"...
Note that the default is "smalfont.png" (not double L).
Thanks for all the help, guys. :)
Another newbie question - is there a built-in command in GLBasic that will allow one to detect/use the accelerometer/gyroscope in an iPhone or an Android phone?
Robert
I'd still recommend rolling your own font system, using polyvectors.
Use an external bitmap font creation tool, one that saves the character positions to a definition file (and optional kerning pairs). Load this definition file to know where to extract your characters from the bitmap.
Create a new Font TYPE with commands such as: Font.Load(fontName), Font.Print("text", 100, 100), etc.
Advantages include speed, customizable, proportional fonts ("i" thinner than "w"), kerning pairs (eg: "AW" pair is squeezed together an extra two pixels), colour effects like gradients, font effects like shadowing, underlining, etc.
Not easy sure, but fun to do (if you're a little insane maybe!).
My font system was built for speed, not simplicity. It only starts the polyvectors once per font type to keep material references / draw calls down, it caches the text string's polyvector coordinates for quick redisplaying each frame, etc. I kinda over engineered this thing, and optimized when maybe I didn't have to, but it was fun.
I can post my code if you want, but it is pretty involved (not bad commented tho) but requires other libraries I have (such as my File, Point, etc TYPES). Heck, I could even post my entire project (that 3d maze game you might have seen screen shots of in my earlier posts) if anybody dares wander through it, there is so many files and lines of code.
It is basically abandoned in GLBasic, and I've since moved the project into Unity, due to the game's complexity, and proper classes and OO programming. Here's a web player build of my latest work in progress: https://dl.dropboxusercontent.com/u/1979274/TwistedMaze/TwistedMaze.html (https://dl.dropboxusercontent.com/u/1979274/TwistedMaze/TwistedMaze.html). I still love GLBasic and the community, and my nephew is working on a 2d platformish game in GLBasic, so I still check in here once in a while.
the glbasic PRINT command is already proportional isnt it? you just put TRUE as a final argument and the font becomes proportional?
Yes, it does have a proportional option now (for at the latest few GLB versions).
Ha, I reread what I wrote, kinda sounds I was implying it didn't. (It didn't when I wrote my library, does that count!)
Well, using your own font system you have full control over the character spacing, and can adjust characters by a pixel or two if it doesn't look right.
Plus, if you edit the font definition file that was generated from the bitmap font program, you can set your numeric characters to have the same width, while your other characters are proportional. This looks better for onscreen scores and timers where otherwise a '1' in the score would cause the leading numbers to shift over, etc.
Here you go, bro. (simple project attached)
I just realized you already solved your font issue. Happened to me the first time too. What got me was that it's smalfont, not smallfont. notice the one L... not sure what's up with that. Might have been a weird german to english thing going on. Anyway, I'd be glad to help if you need any examples of anything!
Quote from: SFguy on 2013-May-29
Thanks for all the help, guys. :)
Another newbie question - is there a built-in command in GLBasic that will allow one to detect/use the accelerometer/gyroscope in an iPhone or an Android phone?
Robert
I believe joy (0) will get you gsensor on those.
What a helpful group of programmers we have here. Thanks for all the answers! :)
I should start to do some programming now!
the only thing im not too sure about yet and havent really tried is trying to find the width in pixels of a line of text when its proportional, easy enough when its fixed but i do plan to see if theres an easy way to find a pixel length for a string of proportional text when i can (my code to center text goes a bit wonky when its proportional atm), provided its not been done already ofc.
You use LEN("text",true) to get the length in pixels of proportional font. It uses the current font. To get the fixed width size (in pixels), use LEN("text",false)
ah legend, i thought it would only return the fixed width, thats a big help, and surprisingly easy \o/