2012-04-21 00:04:34 +00:00
|
|
|
/*
|
|
|
|
epple2
|
2015-07-29 01:14:58 +00:00
|
|
|
Copyright (C) 2008 by Christopher A. Mosher <cmosher01@gmail.com>
|
2012-04-21 00:04:34 +00:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY, without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2013-10-10 03:23:33 +00:00
|
|
|
*/
|
2012-04-21 00:04:34 +00:00
|
|
|
#ifndef SCREENIMAGE_H
|
|
|
|
#define SCREENIMAGE_H
|
|
|
|
|
2022-12-23 00:31:34 +00:00
|
|
|
#include "keyboard.h"
|
2012-04-21 00:04:34 +00:00
|
|
|
#include "analogtv.h"
|
2022-12-23 00:31:34 +00:00
|
|
|
#include "KeyEventHandler.h"
|
2022-12-19 00:40:54 +00:00
|
|
|
|
|
|
|
#include <wx/frame.h>
|
|
|
|
#include <wx/panel.h>
|
2022-12-23 00:31:34 +00:00
|
|
|
#include <wx/event.h>
|
2022-12-19 00:40:54 +00:00
|
|
|
|
2022-12-12 03:07:50 +00:00
|
|
|
#include <filesystem>
|
2012-04-21 00:04:34 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class Card;
|
2013-10-10 03:23:33 +00:00
|
|
|
struct SDL_Texture;
|
|
|
|
struct SDL_Renderer;
|
|
|
|
struct SDL_Window;
|
2012-04-21 00:04:34 +00:00
|
|
|
|
2022-12-19 00:40:54 +00:00
|
|
|
class ScreenImage : public wxFrame {
|
2012-04-21 00:04:34 +00:00
|
|
|
private:
|
2022-12-23 00:31:34 +00:00
|
|
|
wxPanel *sdl;
|
2013-10-10 03:23:33 +00:00
|
|
|
SDL_Window* window;
|
|
|
|
SDL_Renderer* renderer;
|
|
|
|
SDL_Texture* texture;
|
|
|
|
unsigned int* pixels;
|
|
|
|
int screen_pitch;
|
|
|
|
bool fullscreen;
|
|
|
|
bool buffer;
|
|
|
|
AnalogTV::DisplayType display;
|
|
|
|
void createScreen();
|
2022-12-23 00:31:34 +00:00
|
|
|
void createSdlTexture();
|
2022-12-13 06:13:12 +00:00
|
|
|
void destroyScreen();
|
2013-10-10 03:23:33 +00:00
|
|
|
std::vector<std::string> slotnames;
|
2019-01-21 05:12:47 +00:00
|
|
|
std::string cassInName;
|
|
|
|
std::string cassOutName;
|
2013-10-10 03:23:33 +00:00
|
|
|
|
2022-12-23 00:31:34 +00:00
|
|
|
KeyEventHandler &keyEventHandler;
|
|
|
|
|
2022-12-12 03:07:50 +00:00
|
|
|
static std::string truncateFilePath(const std::filesystem::path& filepath);
|
2013-10-10 03:23:33 +00:00
|
|
|
|
2022-12-23 00:31:34 +00:00
|
|
|
void OnIdle(wxIdleEvent &evt);
|
|
|
|
void OnKeyDown(wxKeyEvent &evt);
|
|
|
|
void OnKeyUp(wxKeyEvent &evt);
|
2022-12-19 00:40:54 +00:00
|
|
|
|
2013-10-10 03:23:33 +00:00
|
|
|
// TODO some of these methods should be private
|
2012-04-21 00:04:34 +00:00
|
|
|
public:
|
2022-12-23 00:31:34 +00:00
|
|
|
ScreenImage(KeyEventHandler &keyEventHandler);
|
2013-10-10 03:23:33 +00:00
|
|
|
~ScreenImage();
|
|
|
|
|
2019-01-13 04:30:34 +00:00
|
|
|
void exitFullScreen();
|
2013-10-10 03:23:33 +00:00
|
|
|
void toggleFullScreen();
|
|
|
|
void drawPower(bool on);
|
|
|
|
void notifyObservers();
|
|
|
|
void setElem(const unsigned int i, const unsigned int val);
|
|
|
|
void blank();
|
|
|
|
void drawText(const std::string& text, int row, int col, int color = 0xFFFFFF, int bgcolor = 0);
|
|
|
|
void drawChar(const char ch, int row, int col, int color = 0xFFFFFF, int bgcolor = 0);
|
|
|
|
void drawLabels();
|
|
|
|
void drawSlots();
|
|
|
|
void drawSlot(int slot, int r, int c);
|
|
|
|
void drawCassette();
|
|
|
|
void drawFnKeys();
|
|
|
|
void toggleKdbBufferLabel();
|
|
|
|
void cycleDisplayLabel();
|
|
|
|
void displayHz(int hz);
|
|
|
|
void toggleFillLinesLabel();
|
|
|
|
void invertText(int row, int begincol, int endcol);
|
|
|
|
void drawDisplayLabel();
|
|
|
|
void updateSlotName(const int slot, Card* card);
|
|
|
|
void removeCard(const int slot, Card* card /* empty */);
|
|
|
|
|
2022-12-12 03:07:50 +00:00
|
|
|
void setDiskFile(int slot, int drive, const std::filesystem::path& filename);
|
2013-10-10 03:23:33 +00:00
|
|
|
|
2019-01-27 06:41:23 +00:00
|
|
|
void setAnnunciator(int ann, bool on);
|
|
|
|
|
2013-10-10 03:23:33 +00:00
|
|
|
void clearCurrentDrive(int slt, int drv);
|
|
|
|
void setCurrentDrive(int slt, int drv, int track, bool on);
|
|
|
|
void setTrack(int slot, int drive, int track);
|
|
|
|
void setIO(int slot, int drive, bool on);
|
|
|
|
void setDirty(int slot, int drive, bool dirty);
|
|
|
|
|
2022-12-12 03:07:50 +00:00
|
|
|
void setCassetteInFile(const std::filesystem::path& filepath);
|
|
|
|
void setCassetteOutFile(const std::filesystem::path& filepath);
|
2019-01-21 05:12:47 +00:00
|
|
|
void setCassetteDirty(bool dirty); // cassette out only
|
|
|
|
void setCassettePos(unsigned int pos, unsigned int siz); // cassette in only
|
2013-10-10 03:23:33 +00:00
|
|
|
|
|
|
|
void setLangCard(int slot, bool readEnable, bool writeEnable, int bank);
|
|
|
|
void setFirmCard(int slot, bool bank, bool F8);
|
|
|
|
|
|
|
|
void saveBMP();
|
2012-04-21 00:04:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|