Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

SDL BOOKS?!

Name: Anonymous 2007-05-19 14:22 ID:31bUIYp/

I want to start up with SDL but i need to order a book about it first. Which books helped you when you were starting out with SDL?

Name: Anonymous 2007-05-19 14:24 ID:Heaven

There are no books about SDL.

Name: Anonymous 2007-05-19 14:29 ID:31bUIYp/

http://libsdl.org/books.php

There are but most are for c++ and Linsux. Not that there is much difference but i only write for BSD.

Shouldn't be a huge problem, basically i just need something to get me rolling. Something to show me an example how what functions you get started with.

Internet tutorials could work to but i like books better, i hate reading large pieces of text from the monitor.

Name: Anonymous 2007-05-19 16:19 ID:rz33IUkX

>>3
That's why they invented the printer.

Name: Anonymous 2007-05-19 17:53 ID:6HjyylfN

>>3
i hate reading large pieces of text from the monitor.
Lol loser

Also, if you're using a CRT, discover frequency, and adjust it.

Name: Anonymous 2007-05-19 18:04 ID:EVWdaqOX

There's only like 20 SDL functions. Get over it.

Name: Anonymous 2007-05-19 18:19 ID:EVWdaqOX

Here's the code for a simple window (it also uses GLEW). Next step: learn OpenGL.


#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#include "GL/glew.h"
#include "SDL.h"
//#include "SDL_opengl.h" // -- glew does this
#include "SDL_timer.h"

void show_normal_error (const char *const msg, const bool fatal);
void show_error (const char *const msg, const bool fatal);
void initialize ();
int main (int argc, char *argv[]);
void resize(int w, int h);

void
show_normal_error (const char *const msg, const bool fatal)
{
  fprintf (stderr, "%s\n", msg);
  if (fatal)
    exit (EXIT_FAILURE);
}

void
show_sdl_error (const char *const msg, const bool fatal)
{
  fprintf (stderr, "%s:\n\t%s\n", msg, SDL_GetError ());
  if (fatal)
    exit (EXIT_FAILURE);
}

void
resize (int w, int h)
{
  SDL_Surface * screen = SDL_SetVideoMode( w, h, 0, SDL_OPENGL | SDL_RESIZABLE);
  /* shouldn't free this screen, done by SQL_Quit */
  if ( screen == NULL )
    show_sdl_error("Could not set video mode", true);
}

void
initialize ()
{

  //Initialize SDL:
  if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1)
    show_sdl_error ("Could not initialize SDL", true);
  else if (atexit (SDL_Quit) != 0 )
    show_normal_error ("Could not register atexit function.", true);

  //Open a window:
  if ( SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ) == -1  )
    show_sdl_error("Couldn’t set GL mode", true);
  resize(800,600);

  //Initialize GLEW: (must have a GL context)
  GLenum glew_err = glewInit();
  if ( glew_err != GLEW_OK  ) {
    char errmsg[256] = "";
    snprintf( errmsg, 256, "Error initializing GLEW: %s", glewGetErrorString(glew_err));
    show_normal_error(errmsg, true);
  }

  if (!GLEW_VERSION_1_5) {
    show_normal_error("This program requires support for at least OpenGL 1.5.", true);
  }
}

int
main (int argc, char *argv[])
{
  initialize ();

  SDL_WM_SetCaption("plox", NULL);
 
  SDL_Event event;
  while (SDL_WaitEvent(&event)) {
    switch(event.type) {
      case SDL_VIDEORESIZE:
        resize(event.resize.w, event.resize.h);
        break;
      case SDL_QUIT:
        exit(EXIT_SUCCESS);
        break;
    }
  }
  show_sdl_error("PollEvent failed", true);
}

Name: Anonymous 2007-05-19 18:20 ID:EVWdaqOX

And of course, that prototype is wrong.

Name: Anonymous 2007-05-20 4:18 ID:lfhX+tZ/

>>7
actually i just needed it for a simple 2d game and i've already started writing it with libsdl, i found the examples you could download for the plg book really helpful, after that i just read manuals

like someone else said, it's not a lot of functions, it's kinda like learning libpcap, curses or any other lib, just that my first instinct to learning something new is always to order a book about it but for what i'm doing right now it's not required

Name: Anonymous 2007-05-20 16:56 ID:66X39L0m

"Programming Linux Games" is an excellent book for SDL programming. I'm using it to aid in helping me write my own 2D game.

You can even find the book at just about every book warez source there is, in case you want to "try it" before you buy it.

Name: Anonymous 2007-05-20 17:04 ID:wgyAkHfN

"Programming Faggot Games" is an excellent book for SDL programming. I'm using it to aid in helping me write my own 1D game.

Name: Anonymous 2007-05-20 18:08 ID:LLyicsEm

>>11
1D? You're going for the most boring Snake clone ever!

Name: Anonymous 2007-05-20 20:29 ID:bnUE65gk

>>11

Is it Touring Complete?

Name: Anonymous 2007-05-20 21:52 ID:wI8l0wtk

"Programming Games >>11's Mom Really Likes" is an excellent book for SDL programming. I'm using it to aid in helping me write my own 0D game.

Name: Anonymous 2007-05-20 22:12 ID:tXox4mHr

>>13
FOR THE LAST FUCKING TIME: IT IS TURING!

Name: Anonymous 2007-05-20 22:56 ID:LW/+yVMA

NO ONE CARES ABOUT YOUR FRACKING TOE RING YOU MORANS

Name: Anonymous 2007-05-21 2:13 ID:Heaven

>>15
lurk moar.

Name: Anonymous 2007-05-21 4:17 ID:cn4E1vnb

>>15
Stop trolling

Name: Anonymous 2007-05-21 5:38 ID:VeasaLxE

>>17, >>18, >>19 trolls

Name: Anonymous 2007-05-21 7:25 ID:maQPQe44

>>19
Shut up, non-troll.

Name: Anonymous 2007-05-21 16:32 ID:sJn7fVp3

>>20
Shut down, troll

Name: Anonymous 2007-05-21 17:03 ID:tsYK39i4

>>21
Shut left, non-troll.

Name: Anonymous 2007-05-21 17:14 ID:MGJCAO7L

>>22
Shut right, troll

Name: Anonymous 2007-05-21 18:27 ID:LraqA9ln

>>23
Shut forward, non-troll

Name: Anonymous 2007-05-22 0:47 ID:BpKPcLGI

what do you want to do with SDL? -_-

Name: Anonymous 2011-04-12 17:23

We live in such advanced days, that now we can shut diagonals and stuff.

Name: Sgt.Kabu藵ㄭkiman첗㦹 2012-05-29 1:56

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List