Reading an array through a pointer...
Posted: Sun Jan 04, 2009 6:56 pm
Ok I have the problem that I need to use an array inside of a class pointer but I want to pass the whole array and make it into a temp array to render.
so here is what i have for main...
this is my level class
I hope you guys understand what I'm doing lol if not i will try to explain more :P
so here is what i have for main...
Code: Select all
#include <iostream>
#include "SDL.h"
#include "level.h"
//game loop stuff
//rendering tiles and player
void render();
//handle controller
void handleEvents();
//handle moving tiles and characters
void update();
//switch current level with new level
void changeLevel(level* newLevel);
//initialization
void init();
// is game running
bool isRunning = 0;
//current playing level
level* currentLevel;
int main( int argc, char* args[] )
{
isRunning = true;
//main game loop
while (isRunning)
{
handleEvents();
update();
render();
}
return 0;
}
//rendering tiles and player
void render()
{
currentLevel->
}
//handle controller
void handleEvents()
{
}
//handle moving tiles and characters
void update()
{
}
void changeLevel(level* newLevel)
{
currentLevel = newLevel;
}
void init()
{
level firstLevel;
changeLevel(&firstLevel);
}
Code: Select all
#pragma once
#include <string>
class level
{
public:
level(void);
virtual ~level(void);
void loadmap(std::string filname);
private:
int map[10][10];
};