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.

Newcomers AppGameKit Corner / Need Custom Text and other image-related help

Author
Message
Hiddenworlds225
6
Years of Service
User Offline
Joined: 16th Jul 2017
Location:
Posted: 26th Jul 2017 01:23
So I'm building a 2D Minecraft because I'm just looking for an quick game to build with all of what i know, Which is quite a lot. It is still in the scratch version (which means (if you dot realize) it is not playable). I believe this would be a very fun experience for me but i do need some help in the process. Now before i start, even though this is the starter help page, i would like to say that this is my first post, and usually i tend to screw them up. Anyway back to the problem, I want to add the normal Minecraft text .png file..... which requires the ASCII code standard. Now i would like to do this myself but I don't think I would do this quick enough (I'm in a time crunch). I will provide the .png file and the text file for it. My second question is how do you load more than one image from the same file? There are no documents (that I can find) relating towards it. Plus if you need to know, The .png file was ripped from an Minecraft Default Texture Pack.

Thanks for the Help!

Attachments

Login to view attachments
Dybing
12
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 27th Jul 2017 03:34 Edited at: 27th Jul 2017 03:38
If working with bitmap fonts, you need two files - the .png bitmap *AND* an accompanying text file named <fontName> + subimages.txt - if using a font-tool like Fontforge or BitmapFontMaker it'll generate the accompanying text file for you. This text file follows the format: ascii ID:startX:startY:endX:endY newline and for each character it needs such an entry. Doing that yourself, whilst possible is very tedious.

Luckily, with AppGameKit (for windows at least) a bitmap font creator is included.

Next up, in AppGameKit you import the font as per usual - loadImage(fontID, "<fontName>.png") - and that is pretty much it. It'll auto-load the subImages file. To use the font, just reference it when creating text, like so:

CreateText(textID, "hello, world!")
SetTextFontImage(textID, fontID)
SetTextSize(textID, 24)
SetTextPosition(textID, 50, 50)
SetTextVisible(textID, 1)

...and on next call to sync() it'll draw your text.

Though using bitmap fonts is a bit passe these days - your much better off using true-type fonts, which is much the same procedure in code, however you do not then need the subImages file. Just copy the font to your media folder, and import using loadFont(fontID, "<fontName>.ttf")
Hiddenworlds225
6
Years of Service
User Offline
Joined: 16th Jul 2017
Location:
Posted: 30th Aug 2017 22:42
Thanks! i forgot about this post so thats why it took me so long to see. Ill see what I can Do!
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 30th Aug 2017 22:59 Edited at: 30th Aug 2017 23:06
Quote: "Luckily, with AppGameKit (for windows at least) a bitmap font creator is included."


Not included but available here>>http://www.warriorsofthecucumber.com/applications/bitmapfontcreator/

Quote: "The .png file was ripped from an Minecraft Default Texture Pack. "


That image is a copyright and a trademark, I would be very cautious is using it in a game!
Hiddenworlds225
6
Years of Service
User Offline
Joined: 16th Jul 2017
Location:
Posted: 2nd Sep 2017 17:41
True plus i made my own Text but its a ttf and im a novice, But i should be able to use it.
Hiddenworlds225
6
Years of Service
User Offline
Joined: 16th Jul 2017
Location:
Posted: 2nd Sep 2017 17:44
But also i'm on a pi so...

Login to post a reply

Server time is: 2024-04-19 22:26:02
Your offset time is: 2024-04-19 22:26:02