Files
OpenRCT2-Web/src/drawing/NewDrawing.cpp
T

85 lines
2.2 KiB
C++
Raw Normal View History

#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
2016-06-04 03:20:01 +01:00
#include "IDrawingContext.h"
#include "IDrawingEngine.h"
extern "C"
{
#include "../platform/platform.h"
}
static IDrawingEngine * _drawingEngine = nullptr;
extern "C"
{
void drawing_engine_init()
{
assert(_drawingEngine == nullptr);
_drawingEngine = DrawingEngineFactory::CreateSoftware();
_drawingEngine->Initialise(gWindow);
}
void drawing_engine_resize()
{
if (_drawingEngine == nullptr)
{
drawing_engine_init();
}
_drawingEngine->Resize(gScreenWidth, gScreenHeight);
}
void drawing_engine_set_palette(SDL_Color * colours)
{
_drawingEngine->SetPalette(colours);
}
void drawing_engine_draw()
{
_drawingEngine->Draw();
}
void drawing_engine_dispose()
{
delete _drawingEngine;
_drawingEngine = nullptr;
}
void gfx_set_dirty_blocks(sint16 left, sint16 top, sint16 right, sint16 bottom)
{
if (_drawingEngine != nullptr)
{
_drawingEngine->Invalidate(left, top, right, bottom);
}
}
void gfx_draw_all_dirty_blocks()
{
2016-06-04 03:20:01 +01:00
}
/**
* Clears the screen with the specified colour.
* rct2: 0x00678A9F
*/
void gfx_clear(rct_drawpixelinfo * dpi, int colour)
{
if (_drawingEngine != nullptr)
{
IDrawingContext * dc = _drawingEngine->GetDrawingContext(dpi);
dc->Clear(colour);
}
}
}