![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Location: Narvik, Norway
Posts: 22
Rep Power: 0
![]() |
Game progging with SDL
I've managed to get a SDL program to run, but I have a little problem with finding right lib. for showing text, does someone got some experience with this, I'd love to know about it.
I'm using this as base-code: http://arnold.4950.net/progn/opengl/sdl/test/sdlmove/ and I would be happy if someone for example could add text support from this code. :banana:
__________________
To sell your own books it's like selling a piece of your soul. Kim |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 574
Rep Power: 5
![]() |
For a start, check out SDL_TTF
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4 |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
I won't lie, I don't know what you're talking about, but...
SDL API Installation Guide The first one is pretty helpful to me. The second one is because you mentioned library, so no harm in posting it. |
|
|
|
|
|
#4 | |
|
Professional Programmer
|
This should help you.
http://www.google.com More specifically: http://www.gamedev.net/reference/art...rticle1960.asp Hope this helps.
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#5 |
|
Hobbyist Programmer
|
I did some quick stuff in SDL, love how easy they make some stuff. Text though.. there isn't really a quick thing for that. You need to import the SDL_ttf library to get into the text functions. Once you do that though you get a lot of options.
Check out the doc wiki which is great for showing the different functions: http://www.libsdl.org/cgi/docwiki.cgi/ Getting started with sdl_ttf: http://www.libsdl.org/cgi/docwiki.cg...ting_20Started Also, there is a pretty active IRC channel for SDL on afternet.org , #sdl
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi freelance scripts - http://ryanguthrie.com/index.html |
|
|
|
|
|
#6 |
|
Newbie
Join Date: May 2006
Location: Narvik, Norway
Posts: 22
Rep Power: 0
![]() |
another noob question
oki, so SDL_ttf is the unofficial font library.
But then is it possible to write reuseable code, ie. having a main.c and font.c where every thing conserned about all font functions like loading, set fontsize, ... is written in font.c and only to have it called from main.c: (something like this) #include "font.h" #include <sdl.h> int main() { init_sdl(); // start up SDL, change screen resolution, etc.. init_sdl_ttf(); // fire up ttf functions // A: make this font number 1 with following configurations.. (see: USEFONT) // B: using courier.ttf // C: set size to 12 // D: mode: 0=normal, 1=bold, 2=italic // E: fontcolor: rgb() or rgba() // // LoadFont( A, B, C, D, E(red,greeb,blue) ); LoadFont(1, "courier.ttf", 12, 0, rgb(50,100,200) ); //PrintText( TEXT, X, Y, USEFONT ); PrintText("This is written to the screen", 100, 200, 1); kill_sdl_ttf(); // unload fonts.. kill_sdl(); // unload sdl stuffs, change res.. return 0; }
__________________
To sell your own books it's like selling a piece of your soul. Kim |
|
|
|
|
|
#7 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
As a new member, it would be a good idea for you to read the forum's rules/FAQ and possibly the "How to Post" thread. It will give you an idea of the community's policies. For instance, had you done so, you would have put your code in tags. Not to put too fine a point on it, it's like walking into a church and farting simply because you're used to doing so everywhere else without checking mores.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 |
|
Newbie
Join Date: May 2006
Location: Narvik, Norway
Posts: 22
Rep Power: 0
![]() |
oops! I'll remember to use #CODE# next time..
After many days of preparation for my exam in circuit analysis, im back & done with the exam. But anyway, I have searced on the web and found what I was looking for,, some basic SDL sourcecodes and another lib. called FLTK... thanks for all your help. END THREAD
__________________
To sell your own books it's like selling a piece of your soul. Kim |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|