mirror of
https://github.com/cmosher01/Epple-II.git
synced 2024-12-27 17:29:16 +00:00
slight refactor
This commit is contained in:
parent
e6e259ac9e
commit
2749f8ef74
@ -95,8 +95,6 @@ public:
|
|||||||
const std::filesystem::path GetConfigDir() const;
|
const std::filesystem::path GetConfigDir() const;
|
||||||
const std::filesystem::path GetDocumentsDir() const;
|
const std::filesystem::path GetDocumentsDir() const;
|
||||||
|
|
||||||
E2wxFrame *GetFrame() { return this->frame; }
|
|
||||||
|
|
||||||
void StartEmulator();
|
void StartEmulator();
|
||||||
void StopEmulator();
|
void StopEmulator();
|
||||||
|
|
||||||
|
@ -73,10 +73,11 @@ ScreenImage::ScreenImage(Emulator &emulator, KeyEventHandler &k) :
|
|||||||
fullscreen(false),
|
fullscreen(false),
|
||||||
buffer(true),
|
buffer(true),
|
||||||
display(AnalogTV::TV_OLD_COLOR),
|
display(AnalogTV::TV_OLD_COLOR),
|
||||||
|
keyEventHandler(k),
|
||||||
slotnames(8),
|
slotnames(8),
|
||||||
cassInName(32, ' '),
|
cassInName(32, ' '),
|
||||||
cassOutName(32, ' '),
|
cassOutName(32, ' ')
|
||||||
keyEventHandler(k) {
|
{
|
||||||
createScreen();
|
createScreen();
|
||||||
Center();
|
Center();
|
||||||
Show();
|
Show();
|
||||||
@ -92,8 +93,8 @@ ScreenImage::~ScreenImage() {
|
|||||||
|
|
||||||
|
|
||||||
void ScreenImage::OnIdle(wxIdleEvent &evt) {
|
void ScreenImage::OnIdle(wxIdleEvent &evt) {
|
||||||
// if (!this->FindFocus() || !this->sdl->HasFocus()) {
|
// if (!this->FindFocus() || !this->wxPanelEmuScreen->HasFocus()) {
|
||||||
// this->sdl->SetFocus();
|
// this->wxPanelEmuScreen->SetFocus();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,13 +115,13 @@ void ScreenImage::toggleFullScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenImage::createScreen() {
|
void ScreenImage::createScreen() {
|
||||||
this->sdl = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(SCRW,SCRH*ASPECT_RATIO));
|
this->wxPanelEmuScreen = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(SCRW,SCRH*ASPECT_RATIO));
|
||||||
createSdlTexture();
|
createSdlTexture();
|
||||||
this->sdl->Bind(wxEVT_KEY_DOWN, &ScreenImage::OnKeyDown, this);
|
this->wxPanelEmuScreen->Bind(wxEVT_KEY_DOWN, &ScreenImage::OnKeyDown, this);
|
||||||
this->sdl->Bind(wxEVT_KEY_UP, &ScreenImage::OnKeyUp, this);
|
this->wxPanelEmuScreen->Bind(wxEVT_KEY_UP, &ScreenImage::OnKeyUp, this);
|
||||||
|
|
||||||
wxSizer *pszr = new wxBoxSizer(wxVERTICAL);
|
wxSizer *pszr = new wxBoxSizer(wxVERTICAL);
|
||||||
pszr->Add(this->sdl);
|
pszr->Add(this->wxPanelEmuScreen);
|
||||||
SetSizer(pszr);
|
SetSizer(pszr);
|
||||||
pszr->SetSizeHints(this);
|
pszr->SetSizeHints(this);
|
||||||
|
|
||||||
@ -140,7 +141,7 @@ static void *get_native_window_handle(wxWindowBase *panel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenImage::createSdlTexture() {
|
void ScreenImage::createSdlTexture() {
|
||||||
void *nativeSdl = get_native_window_handle(this->sdl);
|
void *nativeSdl = get_native_window_handle(this->wxPanelEmuScreen);
|
||||||
|
|
||||||
this->window = SDL_CreateWindowFrom(nativeSdl);
|
this->window = SDL_CreateWindowFrom(nativeSdl);
|
||||||
if (this->window == NULL) {
|
if (this->window == NULL) {
|
||||||
@ -371,6 +372,10 @@ void ScreenImage::removeCard(const int slot, Card* card /* empty */) {
|
|||||||
updateSlotName(slot, card);
|
updateSlotName(slot, card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string truncateFilePath(const std::filesystem::path& filepath) {
|
||||||
|
return filepath.stem().string().substr(0, 12);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1 2 3 4 5 6 7 8
|
1 2 3 4 5 6 7 8
|
||||||
789012345678901234567890123456789012345678901234567890123456789012345
|
789012345678901234567890123456789012345678901234567890123456789012345
|
||||||
@ -392,10 +397,6 @@ void ScreenImage::setDiskFile(int slot, int drive, const std::filesystem::path &
|
|||||||
this->slotnames[slot].replace(c - 20, f.length(), f);
|
this->slotnames[slot].replace(c - 20, f.length(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ScreenImage::truncateFilePath(const std::filesystem::path& filepath) {
|
|
||||||
return filepath.stem().string().substr(0, 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenImage::clearCurrentDrive(int slot, int drive) {
|
void ScreenImage::clearCurrentDrive(int slot, int drive) {
|
||||||
int r(R_SLOT + slot);
|
int r(R_SLOT + slot);
|
||||||
int c(35 + 32 * drive);
|
int c(35 + 32 * drive);
|
||||||
@ -565,5 +566,5 @@ void ScreenImage::OnKeyUp(wxKeyEvent &evt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenImage::getPos(int* px, int* py) {
|
void ScreenImage::getPos(int* px, int* py) {
|
||||||
this->sdl->GetScreenPosition(px,py);
|
this->wxPanelEmuScreen->GetScreenPosition(px,py);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ struct SDL_Window;
|
|||||||
class ScreenImage : public wxFrame {
|
class ScreenImage : public wxFrame {
|
||||||
private:
|
private:
|
||||||
Emulator &emu;
|
Emulator &emu;
|
||||||
wxPanel *sdl;
|
wxPanel *wxPanelEmuScreen;
|
||||||
SDL_Window* window;
|
SDL_Window* window;
|
||||||
SDL_Renderer* renderer;
|
SDL_Renderer* renderer;
|
||||||
SDL_Texture* texture;
|
SDL_Texture* texture;
|
||||||
@ -48,16 +48,14 @@ private:
|
|||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool buffer;
|
bool buffer;
|
||||||
AnalogTV::DisplayType display;
|
AnalogTV::DisplayType display;
|
||||||
void createScreen();
|
KeyEventHandler &keyEventHandler;
|
||||||
void createSdlTexture();
|
|
||||||
void destroyScreen();
|
|
||||||
std::vector<std::string> slotnames;
|
std::vector<std::string> slotnames;
|
||||||
std::string cassInName;
|
std::string cassInName;
|
||||||
std::string cassOutName;
|
std::string cassOutName;
|
||||||
|
|
||||||
KeyEventHandler &keyEventHandler;
|
void createScreen();
|
||||||
|
void createSdlTexture();
|
||||||
static std::string truncateFilePath(const std::filesystem::path& filepath);
|
void destroyScreen();
|
||||||
|
|
||||||
void OnIdle(wxIdleEvent &evt);
|
void OnIdle(wxIdleEvent &evt);
|
||||||
void OnKeyDown(wxKeyEvent &evt);
|
void OnKeyDown(wxKeyEvent &evt);
|
||||||
|
Loading…
Reference in New Issue
Block a user