void rpg::Map::setDefault()
{
SMALL_RECT drawRect = { 0, 0, MAP_WIDTH - 1, MAP_HEIGHT - 1 };
HANDLE out_handle = GetStdHandle(STD_OUTPUT_HANDLE),
in_handle = GetStdHandle(STD_INPUT_HANDLE);
SetConsoleWindowInfo(out_handle, true, &drawRect);
SetConsoleMode(in_handle, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
m_MapName.clear();
m_Tiles.clear();
m_Items.clear();
m_NPCs.clear();
m_Enemies.clear();
m_Exits.clear();
Tile defaultTile;
CHAR_INFO dTile = { '#', FOREGROUND_GREEN };
defaultTile.setCharInfo(dTile);
for (int h = 0; h < MAP_HEIGHT - EDITOR_HEIGHT; h++)
{
for (int w = 0; w < MAP_WIDTH; w++)
{
defaultTile.setLoc(w, h);
m_Tiles.push_back(defaultTile);
m_ScreenBuffer[w + h * MAP_WIDTH] = dTile;
}
}
COORD zerZero = { 0, 0 }, scrSize = { MAP_WIDTH, MAP_HEIGHT };
WriteConsoleOutput(out_handle, m_ScreenBuffer, scrSize, zerZero, &drawRect);
}
I'm really confused!
I'm in GameTutorials.com's AsciiMapEditor Tutorial numero Uno, and Ihave a question
Why when I call the setDefault function, itdoesn't display anything on the screen...
Suppose that in the main I create a new Map and call Map.setDefault();
If my code confuses the hell out of you guyts, you can take a look at GameTutorial's (just look at Tiles.cpp)
thanks =)
[Edited by - superpig on November 27, 2004 10:51:57 AM]
Just a guess, since I have no idea what API that is, but in:
Are you sure the two coordinates shouldn't be the other way around (..., zerZero, scrSize, ...)?
WriteConsoleOutput(out_handle, m_ScreenBuffer, scrSize, zerZero, &drawRect);
Are you sure the two coordinates shouldn't be the other way around (..., zerZero, scrSize, ...)?
No, it is supposed to be the wrong way, and I don't know why I used to get it wrong all the time.
Btw, thsoe are teh standard DOS functions that come in <windows.h>
Btw, thsoe are teh standard DOS functions that come in <windows.h>
The only thing I can think of is that EDITOR_HEIGHT would be more than MAP_HEIGHT (if it is the size of the editor and the map together), so your loop would never be run. Other than that, nothing jumps out at me.
EDITOR_HEIGHT = 5
MAP_HEIGHT = 50
MAP_WIDTH = 80
I don't think it's that... damn, that really annoys me and I don't know why. =P =D
MAP_HEIGHT = 50
MAP_WIDTH = 80
I don't think it's that... damn, that really annoys me and I don't know why. =P =D
Also, the other stuff like liek the Editor itself just don't show (even in the Tutorials that I d/led)
My bestguess is taht "SetConsoleWindowInfo(out_handle, true, &drawRect);"
is not making the windows 80 x 50 for soem reason...
My bestguess is taht "SetConsoleWindowInfo(out_handle, true, &drawRect);"
is not making the windows 80 x 50 for soem reason...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement