/* 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 <stdlib.h>
#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"
#include "Pong.h"
#include "Time.h"
#include "TimeCallee.h"
namespace Blinker {
/**
* @brief constructor
* @param[in] name module name
* @param[in] mgrs managers
* @param[in] dirBase base directory
*/
Pong::Pong(const std::string &name, Mgrs &mgrs, const Directory &dirBase):
Game(name, mgrs, dirBase),
m_fileBallColor(dirBase.getFile("ballColor")),
m_fileLineColor(dirBase.getFile("lineColor")),
m_filePadColor(dirBase.getFile("padColor")),
m_ballColor(), m_lineColor(), m_padColor(),
m_ballPosX(-1), m_ballPosY(-1), m_ballDirX(0), m_ballDirY(0),
m_padSize(0), m_leftPosY(0), m_rightPosY(0)
{
// FIXME: activate at begin for initial development only
activate();
}
/// virtual destructor
Pong::~Pong()
{
// cancel time callback request
m_mgrs.m_callMgr.cancelTimeCall(this);
}
/// check for update of configuration (derived game), return true on update