• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

haraiza

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

122 Neutral

About haraiza

  • Rank
    Newbie

Personal Information

  • Location
    México
  1. ISDCaptain01: Thanks. A friend will lead me te book but until the next month... right now he´s on vacations in Cuba.   superman3275: Here´s the whole file. My IDE doesnt show any sisntax error but maybe you will see more than I do.  Any help will be very appreciate    https://dl.dropbox.com/u/3679069/Pruebas%20con%20SDL.rar
  2. I followed your advice. Now the error its different and as always I'm clueless. Who else but Superman can help me :)       1>------ Build started: Project: Pruebas con SDL, Configuration: Debug Win32 ------ 1>  timer.cpp 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Timer' followed by 'signed' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Timer' followed by '__int8' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_stdinc.h(126): error C2118: negative subscript 1>  functions_SDL.cpp 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\globals.h(7): error C2146: syntax error : missing ';' before identifier 'event' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\globals.h(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\constants.h(5): error C2628: 'Timer' followed by 'int' is illegal (did you forget a ';'?) 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\constants.h(5): error C2440: 'initializing' : cannot convert from 'int' to 'Timer' 1>          No constructor could take the source type, or constructor overload resolution was ambiguous 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\functions_sdl.cpp(45): error C2572: 'apply_surface' : redefinition of default parameter : parameter 5 1>          c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\functions_sdl.h(12) : see declaration of 'apply_surface' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\functions_sdl.cpp(66): error C2664: 'SDL_SetVideoMode' : cannot convert parameter 1 from 'const Timer' to 'int' 1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called 1>  dot.cpp 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Dot' followed by 'signed' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Dot' followed by '__int8' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_stdinc.h(126): error C2118: negative subscript 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(10): error C2533: 'Dot::{ctor}' : constructors not allowed a return type 1>  General.cpp 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\globals.h(7): error C2146: syntax error : missing ';' before identifier 'event' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\globals.h(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\constants.h(5): error C2628: 'Dot' followed by 'int' is illegal (did you forget a ';'?) 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\constants.h(5): error C2440: 'initializing' : cannot convert from 'int' to 'Dot' 1>          No constructor could take the source type, or constructor overload resolution was ambiguous 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(54): error C2664: 'SDL_PollEvent' : cannot convert parameter 1 from 'int *' to 'SDL_Event *' 1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(61): error C2228: left of '.type' must have class/struct/union 1>          type is 'int' 1>  Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========             Here´s my source code. 
  3. dmreichard: You´re right, I didn´t specify about my problem. I am following the tutorials in lazyfoo.net/SDL_tutorials/index.php   I was writtting the lesson 16, downloaded the source code (at the bottom of the page) to rewrite it and separate the interface from the implementation. After rewrite all the source code the class Dot didnt have access to the  global variables declarated in the file with the main.cpp.    Im pretty shure this its a really dumb problem but since Im noob with de SDL library it´s very hard to me.    superman3275: Didnt know about that.. its a sweet deal. I will try to do that, thanks //main.cpp #include "SDL_image.h" #include "timer.h" #include "dot.h" #include <string> //Screen attributes const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; const int SCREEN_BPP = 32; //The frame rate const int FRAMES_PER_SECOND = 20; //The dimensions of the dot const int DOT_WIDTH = 20; const int DOT_HEIGHT = 20; //The surfaces SDL_Surface *dot = NULL; SDL_Surface *screen = NULL; //The event structure SDL_Event event; SDL_Surface *load_image( std::string filename ) { //The image that's loaded SDL_Surface* loadedImage = NULL; //The optimized surface that will be used SDL_Surface* optimizedImage = NULL; //Load the image loadedImage = IMG_Load( filename.c_str() ); //If the image loaded if( loadedImage != NULL ) { //Create an optimized surface optimizedImage = SDL_DisplayFormat( loadedImage ); //Free the old surface SDL_FreeSurface( loadedImage ); //If the surface was optimized if( optimizedImage != NULL ) { //Color key surface SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( optimizedImage->format, 0xFF, 0, 0xFF ) ); } } //Return the optimized surface return optimizedImage; } void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL) { //Holds offsets SDL_Rect offset; //Get offsets offset.x = x; offset.y = y; //Blit SDL_BlitSurface (source, clip, destination, &offset); } bool init() { //Initialize all SDL subsystems if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) { return false; } //Set up the screen screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); //If there was an error in setting up the screen if( screen == NULL ) { return false; } //If everything initialized fine return true; } bool load_files() { //Load the image dot = load_image("dot.bmp"); //If there was a problem in loading the dot if(dot == NULL) return false; //If everything loaded fine return true; } void clean_up() { SDL_FreeSurface( dot ); //Quit SDL SDL_Quit(); } int main( int argc, char* args[] ) { //Quit flag bool quit = false; //The dot that will be used Dot myDot; //The frame rate regulator Timer fps; //Initializate if( init() == false ) return 1; //Load the files if( load_files() == false ) return 1; //While the user hasn´t quit while( quit == false ) { //If there´s events to handle if( SDL_PollEvent ( &event ) ) { //Handle events for the dot myDot.handle_input(); //If Xed was press if(event.type == SDL_QUIT) { //Close the window quit = true; } }//PollEvent //Move the dot myDot.move(); SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF) ); //Show the dot on the screen myDot.show(); //Update the screen if( SDL_Flip( screen ) == -1) return 1; //Cap the frame rate if(fps.get_ticks() < 1000/FRAMES_PER_SECOND) { SDL_Delay( (1000/FRAMES_PER_SECOND)-fps.get_ticks() ); } }//while //Clean up clean_up(); return 0; }   //dot.h #ifndef DOT_H #define DOT_H class Dot { public: Dot(); void handle_input(); void move(); void show(); private: int x; int y; int xVel; int yVel; } #endif     //dot.cpp #include "dot.h" #include "SDL.h" #include "SDL_image.h" Dot::Dot() { x = 0; y = 0; xVel = 0; yVel = 0; } void Dot::handle_input() { if(event.type == SDL_KEYDOWN) { //Adjust the velocity switch(event.key.keysym.sym) { case SDLK_UP: yVel -= DOT_HEIGHT /2; break; case SDLK_DOWN: yVel += DOT_HEIGHT /2; break; case SDLK_LEFT: xVel -= DOT_HEIGHT /2; break; case SDLK_RIGHT: xVel += DOT_HEIGHT /2; break; } } //If a key was released else if(event.type == SDL_KEYUP) { switch(event.key.keysym.sym) { case SDLK_UP: yVel += DOT_HEIGHT /2; break; case SDLK_DOWN: yVel -= DOT_HEIGHT /2; break; case SDLK_LEFT: xVel += DOT_HEIGHT /2; break; case SDLK_RIGHT: xVel -= DOT_HEIGHT /2; break; } } } void Dot::move() { //Move the dot right or left x += xVel; //If the dot went too far to the left or right if( (x < 0) || (x + DOT_WIDTH > SCREEN_WIDTH) ) { //move back x -= xVel; } //Move the dot up or down y += yVel; //If the dot went too far to the left or right if( (y < 0) || (x + DOT_HEIGHT > SCREEN_HEIGHT) ) { //move back y -= yVel; } } void Dot::show() { apply_surface(x, y, dot, screen); } //timer.h #ifndef TIMER_H #define TIMER_H class Timer { public: Timer(); //Initialize the class void start(); void stop(); void pause(); void unpause(); int get_ticks(); bool is_started(); bool is_paused(); private: int startTicks; //The clock time when the time start int pausedTicks; //The clock stored when the timer was paused bool paused; // The timer status bool started; // The timer status } #endif //timer.cpp #include "timer.h" #include "SDL_image.h" Timer::Timer() { startTicks = 0; pausedTicks = 0; paused = false; started = false; } void Timer::start() { started = true; paused = false; startTicks = SDL_GetTicks(); } void Timer::stop() { started = false; paused = false; } void Timer::pause() { if( (started == true) && (paused == false) ) { paused = true; pausedTicks = SDL_GetTicks() - startTicks; } } void Timer::unpause() { if(paused == true) { paused = false; startTicks = SDL_GetTicks() - pausedTicks; pausedTicks = 0; } } int Timer::get_ticks() { if(started == true) { if(paused == true) return pausedTicks; else return SDL_GetTicks() - startTicks; } return 0; } bool Timer::is_started() { return started; } bool Timer::is_paused() { return paused; }   At the end, the Output says:   1>------ Build started: Project: Pruebas con SDL, Configuration: Debug Win32 ------ 1>  timer.cpp 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Timer' followed by 'signed' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Timer' followed by '__int8' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_stdinc.h(126): error C2118: negative subscript 1>  dot.cpp 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Dot' followed by 'signed' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_config_win32.h(33): error C2628: 'Dot' followed by '__int8' is illegal (did you forget a ';'?) 1>c:\sdl-1.2.15\include\sdl_stdinc.h(126): error C2118: negative subscript 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(15): error C2065: 'event' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(15): error C2228: left of '.type' must have class/struct/union 1>          type is ''unknown-type'' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(18): error C2065: 'event' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(18): error C2228: left of '.key' must have class/struct/union 1>          type is ''unknown-type'' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(18): error C2228: left of '.keysym' must have class/struct/union 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(18): error C2228: left of '.sym' must have class/struct/union 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(20): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(21): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(22): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(23): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(27): error C2065: 'event' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(27): error C2228: left of '.type' must have class/struct/union 1>          type is ''unknown-type'' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(29): error C2065: 'event' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(29): error C2228: left of '.key' must have class/struct/union 1>          type is ''unknown-type'' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(29): error C2228: left of '.keysym' must have class/struct/union 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(29): error C2228: left of '.sym' must have class/struct/union 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(31): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(32): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(33): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(34): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(45): error C2065: 'DOT_WIDTH' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(45): error C2065: 'SCREEN_WIDTH' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(55): error C2065: 'DOT_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(55): error C2065: 'SCREEN_HEIGHT' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(64): error C2065: 'dot' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(64): error C2065: 'screen' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.cpp(64): error C3861: 'apply_surface': identifier not found 1>  General.cpp 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.h(5): error C2236: unexpected 'class' 'Dot'. Did you forget a ';'? 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.h(5): error C2143: syntax error : missing ';' before '{' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\dot.h(5): error C2447: '{' : missing function header (old-style formal list?) 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(139): error C2065: 'Dot' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(139): error C2146: syntax error : missing ';' before identifier 'myDot' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(139): error C2065: 'myDot' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(160): error C2065: 'myDot' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(160): error C2228: left of '.handle_input' must have class/struct/union 1>          type is ''unknown-type'' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(172): error C2065: 'myDot' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(172): error C2228: left of '.move' must have class/struct/union 1>          type is ''unknown-type'' 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(177): error C2065: 'myDot' : undeclared identifier 1>c:\users\humberto\dropbox\programas en c++\pruebas con sdl\pruebas con sdl\general.cpp(177): error C2228: left of '.show' must have class/struct/union 1>          type is ''unknown-type'' 1>  Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  4. Im trying to program a game with Visual C++ and SDL but without success. Do you know where find ebook about those themes?