mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-22 22:45:52 +00:00
Merging
This commit is contained in:
@@ -75,5 +75,8 @@ add_executable(ComSquare
|
||||
sources/Memory/IRectangleMemory.hpp
|
||||
sources/DSP/DSP.cpp
|
||||
sources/DSP/DSP.hpp
|
||||
sources/Renderer/IRenderer.hpp
|
||||
sources/Renderer/SFRenderer.hpp
|
||||
sources/Renderer/SFRenderer.cpp
|
||||
sources/Exceptions/InvalidAcction.hpp
|
||||
)
|
||||
|
||||
+10
-3
@@ -8,7 +8,8 @@
|
||||
|
||||
namespace ComSquare::PPU
|
||||
{
|
||||
uint8_t PPU::read(uint24_t addr) {
|
||||
uint8_t PPU::read(uint24_t addr)
|
||||
{
|
||||
switch (addr) {
|
||||
case 0x34:
|
||||
return this->mpy.mpyl;
|
||||
@@ -21,7 +22,8 @@ namespace ComSquare::PPU
|
||||
}
|
||||
}
|
||||
|
||||
void PPU::write(uint24_t addr, uint8_t data) {
|
||||
void PPU::write(uint24_t addr, uint8_t data)
|
||||
{
|
||||
switch (addr) {
|
||||
case 0x00:
|
||||
this->inidisp.raw = data;
|
||||
@@ -62,9 +64,14 @@ namespace ComSquare::PPU
|
||||
case 0x0C:
|
||||
this->bg34nba.raw = data;
|
||||
break;
|
||||
//TODO adding the rest of the registers. ooof !
|
||||
//TODO adding the rest of the registers. oaf !
|
||||
default:
|
||||
throw InvalidAddress("PPU Internal Registers write", addr);
|
||||
}
|
||||
}
|
||||
|
||||
void PPU::update(int cycles)
|
||||
{
|
||||
(void)cycles;
|
||||
}
|
||||
}
|
||||
@@ -390,6 +390,9 @@ namespace ComSquare::PPU
|
||||
//! @param data The new data to write.
|
||||
//! @throw This function should thrown an InvalidAddress for address that are not mapped to the component.
|
||||
void write(uint24_t addr, uint8_t data) override;
|
||||
//! @brief Update the PPU of n cycles.
|
||||
//! @param The number of cycles to update.
|
||||
void update(int cycles);
|
||||
};
|
||||
}
|
||||
#endif //COMSQUARE_PPU_HPP
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by cbihan on 1/30/20.
|
||||
//
|
||||
|
||||
#ifndef COMSQUARE_IRENDERER_HPP
|
||||
#define COMSQUARE_IRENDERER_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ComSquare::Renderer
|
||||
{
|
||||
class IRenderer {
|
||||
public:
|
||||
//! @brief Set a new name to the window, if there is already a name it will be overwrite
|
||||
virtual void setWindowName(std::string) = 0;
|
||||
//! @brief Tells to the program if the window has been closed, and therefore if he should stop
|
||||
bool shouldExit;
|
||||
//! @brief Render the buffer to the window
|
||||
virtual void drawScreen() = 0;
|
||||
//! @brief Set a pixel to the coordinates x, y with the color rgba
|
||||
virtual void putPixel(int x, int y, uint8_t rgba) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //COMSQUARE_IRENDERER_HPP
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by cbihan on 1/30/20.
|
||||
//
|
||||
|
||||
#include "SFRenderer.hpp"
|
||||
|
||||
namespace ComSquare::Renderer
|
||||
{
|
||||
void SFRenderer::setWindowName(std::string)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SFRenderer::drawScreen()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SFRenderer::putPixel(int x, int y, uint8_t rgba)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) rgba;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by cbihan on 1/30/20.
|
||||
//
|
||||
|
||||
#ifndef COMSQUARE_SFRENDERER_HPP
|
||||
#define COMSQUARE_SFRENDERER_HPP
|
||||
|
||||
#include "IRenderer.hpp"
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Audio.hpp>
|
||||
#include <SFML/System.hpp>
|
||||
#include <SFML/Window.hpp>
|
||||
#include <SFML/Graphics//RenderWindow.hpp>
|
||||
|
||||
namespace ComSquare::Renderer
|
||||
{
|
||||
class SFRenderer : public IRenderer {
|
||||
public:
|
||||
//! @brief Set a new name to the window, if there is already a name it will be overwrite.
|
||||
//! @param A new title for the window.
|
||||
void setWindowName(std::string) override;
|
||||
//! @brief Update the screen by printing the buffer.
|
||||
void drawScreen() override;
|
||||
//! @brief Add a pixel to the buffer to the coordinates x, y with the color rgba.
|
||||
//! @param X : horizontal index.
|
||||
//! @param Y : vertical index.
|
||||
//! @param rgba : The color of the pixel.
|
||||
void putPixel(int x, int y, uint8_t rgba) override ;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //COMSQUARE_SFRENDERER_HPP
|
||||
Reference in New Issue
Block a user