Jump to content
  • Advertisement

Thursgun

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

123 Neutral

About Thursgun

  • Rank
    Newbie
  1. Hi, Im new to SDL and I was following this tutorial: http://pgdc.purdue.org/sdltutorial/sdl_setup.html And I tried to run their sample code. It compiled and ran OK (no errors), except that the "Hello SDL User!" it's not showing up. ¿Any clue?. Im using VS 2008, C++. Thanks in advance. Heres the code: /* -- Include the precompiled libraries -- */ #ifdef WIN32 #pragma comment(lib, "SDL.lib") #pragma comment(lib, "SDLmain.lib") #endif #include "SDL.h" int main(int argc, char **argv) { printf("\nHello SDL User!\n"); /* initialize SDL */ if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { fprintf( stderr, "Video initialization failed: %s\n", SDL_GetError( ) ); SDL_Quit( ); } SDL_Quit( ); return 0; }
  2. Thursgun

    What would be the best for 2D games?

    SDL it is then :D Thank you very much. WOW gapern, that tutorial looks very nice!
  3. Hi, Recently I decided to make a 2D game (a turn based strategy one) so I started to learn some win32 API and some hardware graphic theory. So far I could make a pong game (a very simple one, with C++ and win32 API). Everything went ok but the game used to blink a little, so it seemed it needed more frame buffers (at least one more). Anyway, I thought it would be better to use a proper game/graphic library instead of plain_mean_and_lean_win32, but im not interested in 3D right now, so my question basically is: What library do you recommend for 2D development (especially a strategy game)?
  4. ========================= ICPC.cpp ============================================= #include <iostream> #include <fstream> #include <cstring> #include <string> using namespace std; typedef unsigned int uint; #include "Datos.cpp" void leer() { string linea; char *palabra, *aux; uint number, flag = 0; ifstream archivo ("cows.in"); if (archivo.is_open()) { while (!archivo.eof()) { getline(archivo,linea); aux = new char [linea.size()+1]; strcpy (aux, linea.c_str()); palabra = strtok(aux," "); while (palabra) { number = atoi(palabra); if (flag == 0) { Datos pruebas = new Datos(number); flag = 1; } else cout << number << endl; palabra = strtok(NULL," "); } } archivo.close(); } else cout << "error"; } int main() { leer(); return 0; } ============================= Datos.cpp ================================================ //typedef unsigned int uint; class Datos { //atributos private: uint lineas; uint i; public: uint *PSP; //Puzzle Solving Power //constructor Datos(uint T); //destructor ~Datos(); //metodos void inserta(uint dato); uint obtener(uint i); }; Datos::Datos(uint T) { lineas = T*36; i = 0; PSP = new uint [lineas]; } Datos::~Datos() { delete[] PSP; } void Datos::inserta(uint dato) { PSP = dato; i++; } uint Datos::obtener(uint i) { uint dato; dato = PSP; return dato; } ========================================================================================== I'm trying to read an input file called "cows.in" and save every number in the PSP array using the class "Datos.cpp". This is the error I get at compile time: ICPC.cpp: In function ‘void leer()’: ICPC.cpp:34: error: invalid conversion from ‘Datos*’ to ‘uint’ ICPC.cpp:34: error: initializing argument 1 of ‘Datos::Datos(uint)’ It says that the problem is here: ... if (flag == 0) { Datos pruebas = new Datos(number); //<-ERROR HERE ... My question is: "What's the problem?". Thanks in advance.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!