X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ABM2%2FPlayground.cpp;h=38c905f9907d117325c924dfadf071b1888c7440;hb=HEAD;hp=5491025cf0c50f8c819d264fe6fd54b47843aee1;hpb=4e3305a825026b6d0574b852421c8dbf31eb925e;p=matthijs%2FABM2.git diff --git a/ABM2/Playground.cpp b/ABM2/Playground.cpp index 5491025..38c905f 100755 --- a/ABM2/Playground.cpp +++ b/ABM2/Playground.cpp @@ -4,71 +4,10 @@ #include "Engine/VideoUpdate.h" #include "SchemeReader.h" -#if WIN32 -LPD3DXSPRITE d3dspt; -LPD3DXFONT font; - -#endif - Playground::Playground(CKernel* kernel) : ITask(kernel) { } bool Playground::Start() { - #if WIN32 - background = NULL; - foreground = NULL; - font = NULL; - HRESULT res; - - D3DXCreateSprite(d3ddev, &d3dspt); // create the Direct3D Sprite object - res = D3DXCreateFont(d3ddev, 15, 10, 0, 1, false, 0, OUT_TT_ONLY_PRECIS, 0, 0, L"times new roman", &font); - if (res != S_OK) - { - switch (res) - { - case D3DERR_INVALIDCALL: - foreground = NULL; - break; - case D3DXERR_INVALIDDATA: - foreground = NULL; - break; - case E_OUTOFMEMORY: - foreground = NULL; - break; - default: - foreground = NULL; - } - } - - res = D3DXCreateTextureFromFile(d3ddev, L"data/field0.png", &background); - //res = D3DXCreateTextureFromFile(d3ddev, L"data/tiles0.png", &foreground); - res = D3DXCreateTextureFromFileEx(d3ddev, L"data/tiles0.png", D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_UNKNOWN, - D3DPOOL_DEFAULT ,D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_ARGB(0, 248, 0, 248), NULL, NULL, &foreground); - if (res != D3D_OK) - { - switch (res) - { - case D3DERR_NOTAVAILABLE: - foreground = NULL; - break; - case D3DERR_OUTOFVIDEOMEMORY: - foreground = NULL; - break; - case D3DERR_INVALIDCALL: - foreground = NULL; - break; - case D3DXERR_INVALIDDATA: - foreground = NULL; - break; - case E_OUTOFMEMORY: - foreground = NULL; - break; - default: - foreground = NULL; - } - } - - #endif // init playing field SchemeReader *scheme = new SchemeReader("Data/schemes/BASIC.SCH"); @@ -128,7 +67,7 @@ void Playground::Update() { CMMPointer s = this->getKernel()->getSpriteManager()->getSprite(SPR_FIELD); - s->blit(0, 0, 1.0, 1.0, 0, 0, COLOUR_RGBA(0, 0, 255, 255)); + s->blit(0, 0, 1.0, 1.0, 0, 0, COLOUR_RGBA(255, 255, 255, 255)); for (int i=0; iRelease(); - if (foreground != NULL) foreground->Release(); - if (d3dspt != NULL) d3dspt->Release(); - if (font != NULL) font->Release(); - #endif // WIN32 } void Playground::move_down() @@ -505,13 +438,7 @@ void Tile::Draw() this->sprite->blit( PLAYGROUND_BORDER_LEFT + this->col * FIELD_UNIT_WIDTH, PLAYGROUND_BORDER_TOP + this->row * FIELD_UNIT_HEIGHT, - 1.0, 1.0, this->subsprite, 0, COLOUR_RGBA(0, 0, 0, 255) + 1.0, 1.0, this->subsprite, 0, COLOUR_RGBA(255, 255, 255, 255) ); -#ifdef WIN32 - D3DXVECTOR3 center(0.0f, 0.0f, 0.0f); // center at the upper-left corner - D3DXVECTOR3 position((FLOAT)PLAYGROUND_BORDER_LEFT+subitem_width*col, (FLOAT)PLAYGROUND_BORDER_TOP+subitem_height*row, 0.0f); // position at 50, 50 with no depth - RECT rect = {tex_num*subitem_width,0,(tex_num+1)*subitem_width,subitem_height}; - d3dspt->Draw(texture, &rect, ¢er, &position, D3DCOLOR_ARGB(255, 255,255,255)); -#endif // WIN32 }