Then show some code pls. I cant foresee what you've already implemented and what you are lacking or what the problem precisely is.. =/
I'm not sure if u really need code to tell me how to draw pixels, but I'll provide some relevant code as you wish.
struct TILE
{
int TileType;
bool obstructed;
};
class map
{
public:
map(int h, int w);
~map();
int getTileTexture(int x, int y);
private:
int m_height, m_width;
TILE **m_map;
};
My tile struct and map class.
class Game : public GameState
{
public:
Game(int w, int h);
~Game();
void HandleEvents();
void logic();
void render();
void loadTiles();
void scroll();
void scrollStuff();
void checkScreen();
void drawHUD();
void drawTiles();
private:
map *myMap;
int m_width;
int m_height;
float scrPosX;
float scrPosY;
float scrTilesW;
float scrTilesH;
unsigned int hud;
unsigned int *tileTextures;
bool scrMoveDown;
bool scrMoveUp;
bool scrMoveLeft;
bool scrMoveRight;
bool scrBMoveDown;
bool scrBMoveUp;
bool scrBMoveLeft;
bool scrBMoveRight;
};
My game class (all you really need to care about is the "map *myMap;")
void Game::render()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glOrtho(0, Screen_Width, Screen_Height, 0, -1, 1);
drawTiles();
drawHUD();
drawCursor();
}
The render function
void Game::drawTiles()
{
// Set i to the very left tile (in regards to the screen)
for (int i = (scrPosX - (scrTilesW / 2)); i < scrPosX + (scrTilesW / 2); i++)
{
// Set j to the very top tile (in regards to the screen)
for (int j = (scrPosY - (scrTilesH / 2)); j < scrPosY + (scrTilesH / 2); j++)
{
if (i >= 0 && i < m_width && j >= 0 && j < m_height)
{
int startX = (i - (scrPosX - (scrTilesW / 2))) * (Screen_Width / scrTilesW);
int startY = (j - (scrPosY - (scrTilesH / 2))) * (Screen_Height / scrTilesH);
// Bind tile texture
glPushMatrix(); // Start phase
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tileTextures[myMap->getTileTexture(i, j)]);
glBegin(GL_QUADS);
glTexCoord2d(0, 0); glVertex2f(startX, startY);
glTexCoord2d(1, 0); glVertex2f(startX + (Screen_Width / scrTilesW), startY);
glTexCoord2d(1, 1); glVertex2f(startX + (Screen_Width / scrTilesW), startY + (Screen_Height / scrTilesH));
glTexCoord2d(0, 1); glVertex2f(startX, startY + (Screen_Height / scrTilesH));
glEnd();
glPopMatrix(); // End phase
}
}
}
}
The function that actually draws the tiles on the screen (and only tiles u can actually see)
No idea what kinda code you really wanted, so I just provided everything that's relevant. I think I underestimated the difficulty of creating a minimap. Still, I'm waiting for a genius to solve this ;)