mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-13 18:30:44 +00:00
Move refresh task control to VideoCtrlBase.
This commit is contained in:
parent
6fa6b4d4dc
commit
7b2e1d90e6
@ -21,6 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
/** @file Video Conroller base class implementation. */
|
/** @file Video Conroller base class implementation. */
|
||||||
|
|
||||||
|
#include <core/timermanager.h>
|
||||||
#include <devices/video/videoctrl.h>
|
#include <devices/video/videoctrl.h>
|
||||||
#include <loguru.hpp>
|
#include <loguru.hpp>
|
||||||
#include <memaccess.h>
|
#include <memaccess.h>
|
||||||
@ -149,6 +150,22 @@ void VideoCtrlBase::update_screen()
|
|||||||
SDL_RenderPresent(this->renderer);
|
SDL_RenderPresent(this->renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoCtrlBase::start_refresh_task() {
|
||||||
|
uint64_t refresh_interval = static_cast<uint64_t>(1.0f / refresh_rate * NS_PER_SEC + 0.5);
|
||||||
|
this->refresh_task_id = TimerManager::get_instance()->add_cyclic_timer(
|
||||||
|
refresh_interval,
|
||||||
|
[this]() {
|
||||||
|
this->update_screen();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoCtrlBase::stop_refresh_task() {
|
||||||
|
if (this->refresh_task_id) {
|
||||||
|
TimerManager::get_instance()->cancel_timer(this->refresh_task_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VideoCtrlBase::get_palette_colors(uint8_t index, uint8_t& r, uint8_t& g,
|
void VideoCtrlBase::get_palette_colors(uint8_t index, uint8_t& r, uint8_t& g,
|
||||||
uint8_t& b, uint8_t& a)
|
uint8_t& b, uint8_t& a)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,9 @@ public:
|
|||||||
void blank_display();
|
void blank_display();
|
||||||
void update_screen(void);
|
void update_screen(void);
|
||||||
|
|
||||||
|
void start_refresh_task();
|
||||||
|
void stop_refresh_task();
|
||||||
|
|
||||||
void get_palette_colors(uint8_t index, uint8_t& r, uint8_t& g, uint8_t& b,
|
void get_palette_colors(uint8_t index, uint8_t& r, uint8_t& g, uint8_t& b,
|
||||||
uint8_t& a);
|
uint8_t& a);
|
||||||
void set_palette_color(uint8_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
void set_palette_color(uint8_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user