Skipping Over a Function
Jan 19, 2011 at 2:18am UTC
So I am using SDL and I am refrencing a function that renders a image. But when I run the program it skips over the function and I am completely lost. I am using Visual 2010 and Any help would be greatly appreciated
here is main.cpp the main file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
using namespace std;
#include <SDL.h>
#include <string>
#include <fstream>
#include <conio.h>
#include "Screen_Global.h"
#include "Render.h"
#include "inti.h"
//map index
int mapIndex = 0;
int main( int argc, char * args[] )
{
//intitilize SDL
if (init() == false )
{
return 1;
}
// quitting enabler
bool quit = false ;
//main loop
while (quit==false )
{
//rending function
rendUpdate(mapIndex);
//debug point
system("pause" );
break ;
}
return 0;
}
And here is the file function that renders
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <SDL.h>
#include "Render.h"
#include "Screen_Global.h"
using namespace std;
void rendUpdate(int mapIndex)
{
if (mapIndex = 0)
{
SDL_Surface *message = NULL;
message = load_image("\\image\\text.bmp" );
apply_surface(0, 0, message, screen);
}
else if (mapIndex = 1)
{
}
}
And here is its header
1 2 3 4 5 6
using namespace std;
#include <SDL.h>
#include <string>
void rendUpdate(int mapindex);
void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination);
SDL_Surface *load_image(string filename);
Jan 19, 2011 at 2:45am UTC
if (mapIndex = 0)
That's assignment, not comparison.
Don't put using namespace std;
in headers, it's dangerous.
Use headers guards.
Topic archived. No new replies allowed.