• Advertisement
Sign in to follow this  

code for another forum

This topic is 4503 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

because the board tags were screwing up my post on another forum, i've included my code posting here, if anyone wishes to comment on this, knock your socks off

void Map::Update()
{
    for (int i = 0; i < m_iNumLayers; ++i)
        for (int j = 0; j < m_iMapHeight; ++j)
            for (int k = 0; k < m_iMapWidth; ++k)
                m_pLayers[j][k]->Update();
}

void Map::Draw(HDC hDC)
{
    for (int i = 0; i <= m_iNumLayers; i++)
        for (int j = 0; j <= m_iMapHeight; ++j)
            for (int k = 0; k <= m_iMapWidth; ++k)
                if (m_pLayers[j][k] != NULL)
                    m_pLayers[j][k]->Draw(hDC,
                        m_pLayers[j][k]->GetWidth()*k, m_pLayers[j][k]->GetHeight()*j);
}

bool Map::AddLayer(BackgroundLayer* pLayer, int x, int y, int z)
{
    if (x < 10 || y < 10 || z < 10)
    {
        m_pLayers[z][x][y] = pLayer;
        m_iMapWidth = max(x, m_iMapWidth);
        m_iMapHeight = max(y, m_iMapHeight);
        if (x > y &&
            sizeof(*pLayer) != sizeof(*m_pLayers[z][x][y+1])    )
            m_pLayers[z][x][y+1] = NULL;
        return true;
    }
    return false;
}
again Map is publicly derived from ScrollingBackground

Share this post


Link to post
Share on other sites
Advertisement
yes, i was trying to post on a different forum and the boardtags were reacting weird to my source code paste. it all relates to a very specific game engine that poeple on that board would be familiar with. i'm trying to expand on the engine to work with smoothscrolling bigbitmap tiles. the scrolling algorithms are long (are there such things as short ones?) and to understand how everything works i would need to post a lot more code here than anyone i'm sure would be willing to read through

Share this post


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

  • Advertisement