/* Blinker
Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
a blinkenarea.org project */
#include <string>
#include <vector>
#include <BlinkenLib/BlinkenFrame.h>
#include "File.h"
#include "Format.h"
#include "FormatFile.h"
#include "Game.h"
#include "Mgrs.h"
#include "Module.h"
#include "OutStreamFile.h"
namespace Blinker {
/**
* @brief constructor
* @param[in] name module name
* @param[in] mgrs managers
* @param[in] dirBase base directory
*/
Game::Game(const std::string &name, Mgrs &mgrs, const Directory &dirBase):
Module(name, mgrs, dirBase),
m_fileFormat(dirBase.getFile("format")),
m_fileBackgroundColor(dirBase.getFile("backgroundColor")),
m_fileOutStream(dirBase.getFile("outstream"), mgrs.m_streamMgr),
m_height(0), m_width(0), m_channels(0), m_imgBuf(), m_backgroundColor()
{
}
/// virtual destructor
Game::~Game()
{
// clean up
deactivate();
}
/// check for update of configuration
void Game::updateConfig()
{
bool doReinit = false;
bool doRedraw = false;
// format file was modified -> re-create canvas and schedule redraw
if (m_fileFormat.checkModified()) {
m_fileFormat.update();