symbols as font
#1
Posted 09 August 2012 - 02:06 PM
#2
Posted 09 August 2012 - 02:20 PM
The easiest thing to do would be to substitue an unused ANSI charcter for whatever character you need. If you're using a font then you'd need some font editing software... if you're using a sprite font then changing it is simple. So for example, if you wanted "√(x)" you could make frame 0 the square root symbol "√", then when you go to make the string do chr(0)+"(x)"
The other option is to use sprites, but not with GameMaker's built-in "sprite font" / draw_text()... instead write your own script to draw the text using sprites. This would allow practically limitless characters.
#3
Posted 09 August 2012 - 02:22 PM
I'd like to add that it's probably a bad idea to use the null character (ASCII 0x00) for that. I don't know if it makes a difference in GM, but in many other languages, the null character has significance internally in strings that should not be tampered with. For instance, in C/C++, placing a null character in a string terminates the string immediately.It's impossible... it's a limitation to GameMaker (unless there's some sort of DLL that can do it... I don't know). GameMaker only supports the ANSI (or is it ASCII?) characters.
The easiest thing to do would be to substitue an unused ANSI charcter for whatever character you need. If you're using a font then you'd need some font editing software... if you're using a sprite font then changing it is simple. So for example, if you wanted "√(x)" you could make frame 0 the square root symbol "√", then when you go to make the string do chr(0)+"(x)"
The other option is to use sprites, but not with GameMaker's built-in "sprite font" / draw_text()... instead write your own script to draw the text using sprites. This would allow practically limitless characters.
#4
Posted 09 August 2012 - 02:29 PM
It's impossible... it's a limitation to GameMaker (unless there's some sort of DLL that can do it... I don't know). GameMaker only supports the ANSI (or is it ASCII?) characters.
The easiest thing to do would be to substitue an unused ANSI charcter for whatever character you need. If you're using a font then you'd need some font editing software... if you're using a sprite font then changing it is simple. So for example, if you wanted "√(x)" you could make frame 0 the square root symbol "√", then when you go to make the string do chr(0)+"(x)"
The other option is to use sprites, but not with GameMaker's built-in "sprite font" / draw_text()... instead write your own script to draw the text using sprites. This would allow practically limitless characters.
hey dannyjenn, nice to see you again hepling me.
I thing your solution is what i want.
1. I create a sprite font with only this 2 simbols
2. then i can call it with chr(0) adn chr(1) ??????
#5
Posted 09 August 2012 - 03:21 PM
Edited by tomasart, 09 August 2012 - 03:23 PM.
#6
Posted 09 August 2012 - 07:19 PM
I see... didn't realize that. Also I believe that chr(10) and chr(13) are treated as newline characters in GameMaker so you shouldn't use those unless you're writing your own script to display them.I'd like to add that it's probably a bad idea to use the null character (ASCII 0x00) for that. I don't know if it makes a difference in GM, but in many other languages, the null character has significance internally in strings that should not be tampered with. For instance, in C/C++, placing a null character in a string terminates the string immediately.
Your normal font is a sprite font, right?hey dannyjenn, nice to see you again hepling me.
I thing your solution is what i want.
1. I create a sprite font with only this 2 simbols
2. then i can call it with chr(0) adn chr(1) ??????
What I do is make my sprite font exactly 128 frames long (so that " " is on frame 32, "!" is on frame 33, etc.) and then there'll be 32 characters before the " " that haven't been used for anything (they're normally non-printing characters). If what Mercenaries said applies to GameMaker then you might want to be careful but I've never had a problem (except you can't use chr(10) and chr(13) because GameMaker handles them as newline characters)
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











