Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 24th, 2006, 9:30 PM   #1
KTiger
Newbie
 
KTiger's Avatar
 
Join Date: May 2006
Location: Narvik, Norway
Posts: 22
Rep Power: 0 KTiger is on a distinguished road
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
KTiger is offline   Reply With Quote
Old May 25th, 2006, 4:16 PM   #2
Benoit
Expert Programmer
 
Benoit's Avatar
 
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 574
Rep Power: 5 Benoit is on a distinguished road
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
Benoit is offline   Reply With Quote
Old May 28th, 2006, 12:57 AM   #3
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
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.
Harakim is offline   Reply With Quote
Old May 28th, 2006, 1:08 AM   #4
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
This should help you.

http://www.google.com

More specifically:

http://www.gamedev.net/reference/art...rticle1960.asp

Hope this helps.
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
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!
jayme is offline   Reply With Quote
Old May 28th, 2006, 5:38 AM   #5
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 223
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
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
Mocker is offline   Reply With Quote
Old May 28th, 2006, 7:56 PM   #6
KTiger
Newbie
 
KTiger's Avatar
 
Join Date: May 2006
Location: Narvik, Norway
Posts: 22
Rep Power: 0 KTiger is on a distinguished road
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
KTiger is offline   Reply With Quote
Old May 28th, 2006, 10:17 PM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Jun 2nd, 2006, 11:14 AM   #8
KTiger
Newbie
 
KTiger's Avatar
 
Join Date: May 2006
Location: Narvik, Norway
Posts: 22
Rep Power: 0 KTiger is on a distinguished road
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
KTiger is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:13 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC