Changing the font?
-
Currently the way to create custom fonts is to create a tiled image, add a tile for each character that you want in your font and then use draw routines to draw the relevent tile for the desired ascii character. It's actually pretty simple once you get the hang of it. Initially it obviously takes a while to draw the images but once you get going it's OK and of course you only need to draw the characters you actually want. Be sure to draw them in order though to make the drawing code simpler.
Like @SteveZX81 says, I'm pretty sure there are already examples out there. I could put one together at some point too if people are still struggling.
My game is called YASS and I'm pretty sure there is a share code for it in the long share code thread (maybe in it's own thread too). That has a custom font and the code to display it.
-
In my solitaire game, I have written a function called
init_fuzify(text, boxSize, margin)
it creates an image of the text argument, using a fuze-style font (white capital letters with red squares, like the FUZE ARENA title on the forum). TheboxSize
is the size of the boxes in pixels, and the margin, the amount of pixels between the boxes. It returns an image that has the text printed on it. So if you where to call it for example as:init_fuzify("Fuze Arena", 65, 10)
then it would return an image with the site logo (pixel values are rough estimates here, since it's only an example). It does use rounded corners for the first and last character of a word, for any word that has 2 characters or more. In case that's of any help... -
@Martin I’m using your custom font coding from Y.A.S.S, hope that’s OK. Crediting you in the annotations of course! It’s brilliantly simple and it’s taught me a lot 😊
-
Of course @AndyG1985 that’s the whole point of having such an open system.
-
I’m afraid I’ve hit a bit of a snag with this coding. Is there a way of starting a new line? The usual “text \n text” doesn’t work.
Edit: what it does do is create some spaces.
-
-
Strange, that doesn’t work for me. I’ll have a play and see if I can work it out :)
-
@AndyG1985 I assume you are using @martin 's code for the font. If you are just retype it e.g
x = 0
y = 0printText(x, y, "this is line one")
printText(x, y+20, "this is line 2")but use the actual function name and parameters as those were just an example
-
My code was never written to take "\n" into account so yeah, I'm afraid if using mine, you'll have to split it up manually as per what @Gameboy is saying.
-
That’s what I suspected. Thanks a lot both, I’ll have a fiddle :)