Jump to content
  • Advertisement
Sign in to follow this  
Si0n

I'm really confused!

This topic is 5050 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...
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);

}  


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]

Share this post


Link to post
Share on other sites
Advertisement
Just a guess, since I have no idea what API that is, but in:
WriteConsoleOutput(out_handle, m_ScreenBuffer, scrSize, zerZero, &drawRect);


Are you sure the two coordinates shouldn't be the other way around (..., zerZero, scrSize, ...)?

Share this post


Link to post
Share on other sites
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>

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Yes, that is exactly what it is... :( The function is returning false.
How can I change my windows size then?

btw,
const int MAP_WIDTH = 80, MAP_HEIGHT = 50;
const int EDITOR_HEIGHT = 5;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!