El problema es con la libreria csprite.h del tutorial http://www.losersjuegos.com.ar/referenc ... %20SDL.pdf
el codigo se encuentra a partir de la pagina 83.
Copio todo tal cual el tutorial peor al querer compilar con el dev-c++ me salta este error
- Código: Seleccionar todo
9 C:\Documents and Settings\Exequiel\My Documents\PROG DE JUEGOS\Ejemplo 3.1 del libro\eje51.cpp In file included from C:/Documents and Settings/Exequiel/My Documents/PROG DE JUEGOS/Ejemplo 3.1 del libro/eje51.cpp
He resolvido ese problema pero me ha surgido otro, cuando ejecuto el proyecto me sale este error:
- Código: Seleccionar todo
Compilador: Default compiler
Building Makefile: "C:\Documents and Settings\Exequiel\Desktop\fuentes\ejemplo7_1\Makefile.win"
Ejecutando make...
make.exe -f "C:\Documents and Settings\Exequiel\Desktop\fuentes\ejemplo7_1\Makefile.win" all
g++.exe -D__DEBUG__ main.o -o "main.exe" -L"C:/Dev-Cpp/lib" -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -mwindows csprite.a -g3
csprite.a(csprite.o.b)(.text+0x1d):csprite.cpp: undefined reference to `SDL_RWFromFile'
csprite.a(csprite.o.b)(.text+0x2d):csprite.cpp: undefined reference to `SDL_LoadBMP_RW'
csprite.a(csprite.o.b)(.text+0x57):csprite.cpp: undefined reference to `SDL_MapRGB'
csprite.a(csprite.o.b)(.text+0x70):csprite.cpp: undefined reference to `SDL_SetColorKey'
csprite.a(csprite.o.b)(.text+0x80):csprite.cpp: undefined reference to `SDL_DisplayFormat'
csprite.a(csprite.o.b)(.text+0x9b):csprite.cpp: undefined reference to `SDL_FreeSurface'
csprite.a(csprite.o.b)(.text+0x251):csprite.cpp: undefined reference to `SDL_UpperBlit'
make.exe: *** [main.exe] Error 1
Ejecución Terminada
este es el codigo de csprite.cpp:
- Código: Seleccionar todo
/***************************************************************************
csprite.cpp - description
-------------------
begin : Mon Sep 2 2002
copyright : (C) 2002 by Alberto Garcia Serrano
email : albgarse@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <SDL/SDL.h>
#include "csprite.h"
// Sprite Class implementation
void CFrame::load(char *path) {
img=SDL_LoadBMP(path);
// Asignamos el color transparente al color rojo.
SDL_SetColorKey(img,SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(img->format,255,0,0));
img=SDL_DisplayFormat(img);
}
void CFrame::unload(){
SDL_FreeSurface(img);
}
CSprite::CSprite(int nf) {
sprite=new CFrame[nf];
nframes=nf;
cont=0;
}
CSprite::CSprite() {
int nf=1;
sprite=new CFrame[nf];
nframes=nf;
cont=0;
}
void CSprite::finalize() {
int i;
for (i=0 ; i<=nframes-1 ; i++)
sprite[i].unload();
}
void CSprite::addframe(CFrame frame) {
if (cont<nframes) {
sprite[cont]=frame;
cont++;
}
}
void CSprite::selframe(int nf) {
if (nf<=nframes) {
estado=nf;
}
}
void CSprite::draw(SDL_Surface *superficie) {
SDL_Rect dest;
dest.x=posx;
dest.y=posy;
SDL_BlitSurface(sprite[estado].img,NULL,superficie,&dest);
}
int CSprite::colision(CSprite sp) {
int w1,h1,w2,h2,x1,y1,x2,y2;
w1=getw(); // ancho del sprite1
h1=geth(); // altura del sprite1
w2=sp.getw(); // ancho del sprite2
h2=sp.geth(); // alto del sprite2
x1=getx(); // pos. X del sprite1
y1=gety(); // pos. Y del sprite1
x2=sp.getx(); // pos. X del sprite2
y2=sp.gety(); // pos. Y del sprite2
if (((x1+w1)>x2)&&((y1+h1)>y2)&&((x2+w2)>x1)&&((y2+h2)>y1)) {
return TRUE;
} else {
return FALSE;
}
}
por lo que puedo entender el error es q no estan declaradas las funciones de la libreria SDL pero no se porq pasa esto si esta ya esta incluida
Espero q puedan ayudarme a resolver el problema.