Sign in to follow this  
zappernapper

code for another forum

Recommended Posts

zappernapper    186
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
[code]
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[i][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[i][j][k] != NULL)
                    m_pLayers[i][j][k]->Draw(hDC,
                        m_pLayers[i][j][k]->GetWidth()*k, m_pLayers[i][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
zappernapper    186
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this