BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
d3cb8b3
Branches
Tags
master
Blinker
src
common
Pong.cpp
begin of Pong game
Stefan Schuermans
commited
d3cb8b3
at 2019-06-10 11:34:12
Pong.cpp
Blame
History
Raw
/* 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" #include "Pong.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_ballColor() { // FIXME: activate at begin for initial development only activate(); } /// virtual destructor Pong::~Pong() { } /// check for update of configuration (derived game), return true on update bool Pong::updateConfigGame() { bool ret = false; // color file was modified -> convert color, return true for update if (colorUpdate(m_fileBallColor, m_ballColor)) { ret = true; } return ret; } /// re-initialize game (e.g. due to config change) void Pong::reinitialize() { // TODO // convert colors color2data(m_fileBallColor, m_ballColor); } /// redraw current game image, expected to call sendFrame() at end void Pong::redraw() { // set image buffer to background color rectFill(0, m_height, 0, m_width, m_backgroundColor); // FIXME: draw ball pixel(m_height / 2, m_width / 2, m_ballColor); // send updated image buffer as frame sendFrame(); } } // namespace Blinker