public inbox for xconq7@sourceware.org
 help / color / mirror / Atom feed
* SDL tutorials?
@ 2004-11-16  1:56 Lincoln Peters
  2004-11-17  4:48 ` Eric McDonald
  0 siblings, 1 reply; 5+ messages in thread
From: Lincoln Peters @ 2004-11-16  1:56 UTC (permalink / raw)
  To: Xconq list

I've been trying to learn SDL so that I can pitch in on the SDL
interface, but every SDL tutorial I've found on the Internet fails to
compile on my computer.  And I'm fairly sure that the problem isn't my
computer, because I have no difficulty compiling Xconq with the SDL
interface, and I can't quite figure out why.

Any recommended websites or other sources for learning SDL?

---
Lincoln Peters
<sampln@sbcglobal.net>

BOFH excuse #40:

not enough memory, go get system upgrade

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SDL tutorials?
  2004-11-16  1:56 SDL tutorials? Lincoln Peters
@ 2004-11-17  4:48 ` Eric McDonald
  2004-11-19 23:36   ` Lincoln Peters
  0 siblings, 1 reply; 5+ messages in thread
From: Eric McDonald @ 2004-11-17  4:48 UTC (permalink / raw)
  To: Lincoln Peters; +Cc: Xconq list

Lincoln Peters wrote:
> I've been trying to learn SDL so that I can pitch in on the SDL
> interface, but every SDL tutorial I've found on the Internet fails to
> compile on my computer.  And I'm fairly sure that the problem isn't my
> computer, because I have no difficulty compiling Xconq with the SDL
> interface, and I can't quite figure out why.
> 
> Any recommended websites or other sources for learning SDL?

The source code of various programs can be instructive. For example, if 
you download the ParaGUI tarball, there are sources for the test 
programs in the 'test' directory. Most of these are simple little apps, 
but can give you a good feel for ParaGUI. I am sure that you can 
probably find similar examples for pure SDL; I would try the sources of 
some of the programs here:
   http://www.libsdl.org/games.php

Also, what sort of troubles are you having wrt compiling the tutorials?

Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SDL tutorials?
  2004-11-17  4:48 ` Eric McDonald
@ 2004-11-19 23:36   ` Lincoln Peters
  2004-11-20  0:38     ` Eric McDonald
  0 siblings, 1 reply; 5+ messages in thread
From: Lincoln Peters @ 2004-11-19 23:36 UTC (permalink / raw)
  To: Eric McDonald; +Cc: Xconq list

On Mon, 2004-11-15 at 19:02, Eric McDonald wrote:
> Lincoln Peters wrote:
> > I've been trying to learn SDL so that I can pitch in on the SDL
> > interface, but every SDL tutorial I've found on the Internet fails to
> > compile on my computer.  And I'm fairly sure that the problem isn't my
> > computer, because I have no difficulty compiling Xconq with the SDL
> > interface, and I can't quite figure out why.
> > 
> > Any recommended websites or other sources for learning SDL?
> 
> The source code of various programs can be instructive. For example, if 
> you download the ParaGUI tarball, there are sources for the test 
> programs in the 'test' directory. Most of these are simple little apps, 
> but can give you a good feel for ParaGUI. I am sure that you can 
> probably find similar examples for pure SDL; I would try the sources of 
> some of the programs here:
>    http://www.libsdl.org/games.php

I'll look at the 'test' directory and see if I can figure out how it
works.

> 
> Also, what sort of troubles are you having wrt compiling the tutorials?

The code I've included below generates the following errors:

main.o(.text+0x6d):/home/lincoln/test/main.cpp:44: undefined reference to `SDL_SetVideoMode' 
main.o(.text+0xa8):/home/lincoln/test/main.cpp:57: undefined reference to `SDL_Quit' 
collect2: ld returned 1 exit status 

The code itself is (in C++):

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>

//using namespace std;

//void DrawPixel(SDL_Surface *screen, int x, int y,
//                                    Uint8 R, Uint8 G, Uint8 B);
//void Slock(SDL_Surface *screen);
//void Sulock(SDL_Surface *screen);

int main( /*int argc, char *argv[] */ )
{
  if ( SDL_Init( SDL_INIT_VIDEO ) != 0 ) {
    cout << "Unable to initialize video" << endl;
    return 1;
  }

  SDL_Surface *screen;

  screen = SDL_SetVideoMode( 640, 480, 32, SDL_HWSURFACE|SDL_DOUBLEBUF );

  if ( screen == NULL ) {
    cout << "Unable to set up window" << endl;
    return 2;
  }

  // Slock( screen );

  // Nothing to do, yet.

  // Sulock( screen );

  SDL_Quit();
  return EXIT_SUCCESS;
}

[End of code]

---
Lincoln Peters
<sampln@sbcglobal.net>

Every program has (at least) two purposes:
	the one for which it was written and another for which it wasn't.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SDL tutorials?
  2004-11-19 23:36   ` Lincoln Peters
@ 2004-11-20  0:38     ` Eric McDonald
  2004-11-21 10:44       ` Lincoln Peters
  0 siblings, 1 reply; 5+ messages in thread
From: Eric McDonald @ 2004-11-20  0:38 UTC (permalink / raw)
  To: Lincoln Peters; +Cc: Xconq list

On Fri, 19 Nov 2004, Lincoln Peters wrote:

> The code I've included below generates the following errors:
> 
> main.o(.text+0x6d):/home/lincoln/test/main.cpp:44: undefined reference to `SDL_SetVideoMode' 
> main.o(.text+0xa8):/home/lincoln/test/main.cpp:57: undefined reference to `SDL_Quit' 
> collect2: ld returned 1 exit status 

Did you remember to link in the SDL libraries?
  g++ main.cpp -o test -lSDL -lSDLmain
or something similar....

Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SDL tutorials?
  2004-11-20  0:38     ` Eric McDonald
@ 2004-11-21 10:44       ` Lincoln Peters
  0 siblings, 0 replies; 5+ messages in thread
From: Lincoln Peters @ 2004-11-21 10:44 UTC (permalink / raw)
  To: Eric McDonald; +Cc: Xconq list

On Fri, 2004-11-19 at 15:36, Eric McDonald wrote:
> Did you remember to link in the SDL libraries?
>   g++ main.cpp -o test -lSDL -lSDLmain

Apparently not.  It compiled successfully when I added that.

---
Lincoln Peters
<sampln@sbcglobal.net>

May you have many handsome and obedient sons.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-11-20  0:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-16  1:56 SDL tutorials? Lincoln Peters
2004-11-17  4:48 ` Eric McDonald
2004-11-19 23:36   ` Lincoln Peters
2004-11-20  0:38     ` Eric McDonald
2004-11-21 10:44       ` Lincoln Peters

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).