auto-add background when creating new map. Closes #50

This commit is contained in:
oy 2010-06-22 01:15:12 +02:00
parent c40bc9af3e
commit d01776bf3f

View file

@ -2891,6 +2891,28 @@ void CEditorMap::Clean()
void CEditorMap::CreateDefault(int EntitiesTexture)
{
// add background
CLayerGroup *pGroup = NewGroup();
pGroup->m_ParallaxX = 0;
pGroup->m_ParallaxY = 0;
CLayerQuads *pLayer = new CLayerQuads;
pLayer->m_pEditor = m_pEditor;
CQuad *pQuad = pLayer->NewQuad();
const int Width = 800000;
const int Height = 600000;
pQuad->m_aPoints[0].x = pQuad->m_aPoints[2].x = -Width;
pQuad->m_aPoints[1].x = pQuad->m_aPoints[3].x = Width;
pQuad->m_aPoints[0].y = pQuad->m_aPoints[1].y = -Height;
pQuad->m_aPoints[2].y = pQuad->m_aPoints[3].y = Height;
pQuad->m_aColors[0].r = pQuad->m_aColors[1].r = 94;
pQuad->m_aColors[0].g = pQuad->m_aColors[1].g = 132;
pQuad->m_aColors[0].b = pQuad->m_aColors[1].b = 174;
pQuad->m_aColors[2].r = pQuad->m_aColors[3].r = 204;
pQuad->m_aColors[2].g = pQuad->m_aColors[3].g = 232;
pQuad->m_aColors[2].b = pQuad->m_aColors[3].b = 255;
pGroup->AddLayer(pLayer);
// add game layer
MakeGameGroup(NewGroup());
MakeGameLayer(new CLayerGame(50, 50));
m_pGameGroup->AddLayer(m_pGameLayer);
@ -3028,4 +3050,4 @@ void CEditor::UpdateAndRender()
Input()->ClearEvents();
}
IEditor *CreateEditor() { return new CEditor; }
IEditor *CreateEditor() { return new CEditor; }