Pages: 1
CreativiPie |
Posted on 06-17-13, 12:44 pm
|
Pokey
me some orange juice my hand Karma: 674 Posts: 280/699 Since: 09-24-12 |
Well, I am working on a RPG in Python called "The Diamond Rocks". It's on github (while I'm talking of it, the URL: https://github.com/Py-hacker/The-Diamond-Rocks) I want to get sprites for the text, but making images of each time the text is used won't be enough: you can give custom names to your characters! So, how could this possible? Make sprites of each letter? Sorry if the post is unclear. |
Dirbaio |
Posted on 06-17-13, 01:52 pm
|
Super Mario
( ͡° ͜ʖ ͡°) Karma: 10021 Posts: 3419/4458 Since: 06-08-11 |
There are libraries that let you load a font file (.ttf or other formats) and draw text on screen... That would be the easiest way to go IMO. Maybe PyGame itself supports it.
Otherwise yes, you would need to get a sprite sheet with each letter, and code text drawing yourself. And if you want variable-width fonts then you have to store the width of each character too Lol. Actually that's what I did when I coded nds homebrew. I made a small java program ti generate the sprite sheets for me or make it easier though. Its cool to see people programming stuff in here |
Arisotura |
Posted on 06-17-13, 02:18 pm
|
☭ coffee and cream
Karma: 10416 Posts: 979/2769 Since: 06-26-11 |
Posted by Dirbaio Otherwise yes, you would need to get a sprite sheet with each letter, and code text drawing yourself. And if you want variable-width fonts then you have to store the width of each character too Lol. An alternative to that would be calculating the character's width based on the pixels, which is possible in the case of a monochrome font image (or an image with a clearly distinguishable background color). I did that for a programming project for university and it worked quite well. You just need to add a special case for the space character. _________________________ Kuribo64 - zrghij |
CreativiPie |
Posted on 06-17-13, 08:55 pm (rev. 1 by CreativiPie on 06-17-13, 10:21 pm)
|
Pokey
me some orange juice my hand Karma: 674 Posts: 281/699 Since: 09-24-12 |
Posted by Dirbaio There are libraries that let you load a font file (.ttf or other formats) and draw text on screen... That would be the easiest way to go IMO. Pygame has one, but I find the text ugly for the game lol. So, just HOW do get Pygame/Python to load only part of an image file? EDIT: Wait, I thought you meant something else. How do you make a .ttf? |
Dirbaio |
Posted on 06-18-13, 03:13 am (rev. 1 by Dirbaio on 06-18-13, 03:14 am)
|
Super Mario
( ͡° ͜ʖ ͡°) Karma: 10021 Posts: 3420/4458 Since: 06-08-11 |
You don't make them. You search the internet for fonts and find one you like and download it and put it in.
(Well you can make them too. But its jot necessary) |
SaturnYoshi |
Posted on 06-21-13, 01:15 am
|
Giant Red Koopa
Karma: 886 Posts: 328/1315 Since: 11-12-12 |
Posted by Dirbaio Its cool to see people programming stuff in here Oh. I wish I knew that when I was working on my game witch was cancled from bugs |
CreativiPie |
Posted on 06-29-13, 03:40 am
|
Pokey
me some orange juice my hand Karma: 674 Posts: 309/699 Since: 09-24-12 |
I did some research and eventually found how to blit text (and load fonts) with Pygame. I also found some website (fontstruct) to make .ttf's. So I'm currently making some custom .ttf And thanks for the help. |
SaturnYoshi |
Posted on 06-29-13, 03:39 pm
|
Giant Red Koopa
Karma: 886 Posts: 377/1315 Since: 11-12-12 |
Fontstruct is a good ste I use it to
|
Pages: 1