1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-30 22:29:56 +00:00

Transferred ownership of the CRT to the CRTC bus handler, to give it easy access.

This commit is contained in:
Thomas Harte 2017-07-31 22:04:52 -04:00
parent 5a396f6787
commit 69b99fe127
2 changed files with 10 additions and 9 deletions

View File

@ -124,20 +124,20 @@ void Machine::set_rom(ROMType type, std::vector<uint8_t> data) {
}
void Machine::setup_output(float aspect_ratio) {
crt_.reset(new Outputs::CRT::CRT(256, 1, Outputs::CRT::DisplayType::PAL50, 1));
crt_->set_rgb_sampling_function(
crtc_bus_handler_.crt_.reset(new Outputs::CRT::CRT(256, 1, Outputs::CRT::DisplayType::PAL50, 1));
crtc_bus_handler_.crt_->set_rgb_sampling_function(
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)"
"{"
"return vec3(1.0);"
"return vec3(float(texture(texID, coordinate).r) / 255.0);"
"}");
}
void Machine::close_output() {
crt_.reset();
crtc_bus_handler_.crt_.reset();
}
std::shared_ptr<Outputs::CRT::CRT> Machine::get_crt() {
return crt_;
return crtc_bus_handler_.crt_;
}
std::shared_ptr<Outputs::Speaker> Machine::get_speaker() {

View File

@ -25,8 +25,11 @@ enum ROMType: uint8_t {
};
struct CRTCBusHandler {
inline void perform_bus_cycle(const Motorola::CRTC::BusState &state) {
}
public:
inline void perform_bus_cycle(const Motorola::CRTC::BusState &state) {
}
std::shared_ptr<Outputs::CRT::CRT> crt_;
};
class Machine:
@ -52,8 +55,6 @@ class Machine:
void set_rom(ROMType type, std::vector<uint8_t> data);
private:
std::shared_ptr<Outputs::CRT::CRT> crt_;
CRTCBusHandler crtc_bus_handler_;
Motorola::CRTC::CRTC6845<CRTCBusHandler> crtc_;