// Filename : vga_controller.h
//
// This file was initially generated by SpaceStudio but is meant to be modified
// by the user.
#ifndef VGA_CONTROLLER_H
#define VGA_CONTROLLER_H

#include "spacecomp.h"
#include "sdevice.h"
#include "application_definitions.h"

#include "basic_vga_controller.h"

class vga_controller: public sdevice {
	SPACECOMP_START(vga_controller, INDEX, vga_controller);

public:
	vga_controller(SPACECOMP_CTOR_PARAMS(vga_controller, INDEX));
	~vga_controller();

	virtual void access(tlm::tlm_generic_payload& trans, sc_core::sc_time& delay);

	void end_of_simulation();

private:
	void play_frames();
	void create_capture();
	void refresh();
	void save_bitmap();

	sc_core::sc_time m_refresh_rate;
	bool m_is_ready;
	basic_vga_controller m_vga_controller;
	std::vector< rgba** > m_frames;
	rgba** m_current_frame;
	unsigned long m_frame_count;

	#if FAST_FORWARD == 1
		sc_core::sc_event  m_frame_completed;
	#endif

	SPACECOMP_END(vga_controller, INDEX, vga_controller);
};

#endif
