ImGui settings: add video.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
29821c9e7c
commit
362c9877d4
3 changed files with 99 additions and 5 deletions
|
@ -45,6 +45,19 @@ namespace
|
|||
return color;
|
||||
}
|
||||
|
||||
uint8_t roundToRGB(float x)
|
||||
{
|
||||
// c++ cast truncates
|
||||
return uint8_t(x * 255 + 0.5);
|
||||
}
|
||||
|
||||
COLORREF imVec4ToColorref(const ImVec4 & color)
|
||||
{
|
||||
const bgra_t bgra = {roundToRGB(color.x), roundToRGB(color.y), roundToRGB(color.z), roundToRGB(color.w)};
|
||||
const COLORREF * cr = reinterpret_cast<const COLORREF *>(&bgra);
|
||||
return *cr;
|
||||
}
|
||||
|
||||
ImVec4 debuggerGetColor(int iColor)
|
||||
{
|
||||
const COLORREF cr = DebuggerGetColor(iColor);
|
||||
|
@ -242,7 +255,7 @@ namespace sa2
|
|||
}
|
||||
|
||||
standardLabelText("CPU", getCPUName(GetMainCpu()).c_str());
|
||||
standardLabelText("Mode", getModeName(g_nAppMode).c_str());
|
||||
standardLabelText("Mode", getAppModeName(g_nAppMode).c_str());
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
@ -481,6 +494,51 @@ namespace sa2
|
|||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Video"))
|
||||
{
|
||||
Video & video = GetVideo();
|
||||
const VideoType_e videoType = video.GetVideoType();
|
||||
if (ImGui::BeginCombo("Video mode", getVideoTypeName(videoType).c_str()))
|
||||
{
|
||||
for (size_t value = VT_MONO_CUSTOM; value < NUM_VIDEO_MODES; ++value)
|
||||
{
|
||||
const bool isSelected = value == videoType;
|
||||
if (ImGui::Selectable(getVideoTypeName(VideoType_e(value)).c_str(), isSelected))
|
||||
{
|
||||
video.SetVideoType(VideoType_e(value));
|
||||
frame->ApplyVideoModeChange();
|
||||
}
|
||||
if (isSelected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImVec4 color = colorrefToImVec4(video.GetMonochromeRGB());
|
||||
ImGui::ColorEdit3("Monochrome Color", (float*)&color, 0);
|
||||
const COLORREF cr = imVec4ToColorref(color);
|
||||
video.SetMonochromeRGB(cr);
|
||||
frame->ApplyVideoModeChange();
|
||||
|
||||
bool scanLines = video.IsVideoStyle(VS_HALF_SCANLINES);
|
||||
if (ImGui::Checkbox("50% Scan lines", &scanLines))
|
||||
{
|
||||
setVideoStyle(video, VS_HALF_SCANLINES, scanLines);
|
||||
frame->ApplyVideoModeChange();
|
||||
}
|
||||
|
||||
bool verticalBlend = video.IsVideoStyle(VS_COLOR_VERTICAL_BLEND);
|
||||
if (ImGui::Checkbox("Vertical blend", &verticalBlend))
|
||||
{
|
||||
setVideoStyle(video, VS_COLOR_VERTICAL_BLEND, verticalBlend);
|
||||
frame->ApplyVideoModeChange();
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Debugger"))
|
||||
{
|
||||
if (ImGui::RadioButton("Color", g_iColorScheme == SCHEME_COLOR)) { g_iColorScheme = SCHEME_COLOR; } ImGui::SameLine();
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace
|
|||
{CPU_Z80, "CPU_Z80"},
|
||||
};
|
||||
|
||||
const std::map<AppMode_e, std::string> modes =
|
||||
const std::map<AppMode_e, std::string> appModes =
|
||||
{
|
||||
{MODE_LOGO, "MODE_LOGO"},
|
||||
{MODE_PAUSED, "MODE_PAUSED"},
|
||||
|
@ -70,6 +70,19 @@ namespace
|
|||
{DISK_STATUS_PROT, "PROT"},
|
||||
};
|
||||
|
||||
const std::map<VideoType_e, std::string> videoTypes =
|
||||
{
|
||||
{VT_MONO_CUSTOM, "Monochrome (Custom)"},
|
||||
{VT_COLOR_IDEALIZED, "Color (Composite Idealized)"},
|
||||
{VT_COLOR_VIDEOCARD_RGB, "Color (RGB Card/Monitor)"},
|
||||
{VT_COLOR_MONITOR_NTSC, "Color (Composite Monitor)"},
|
||||
{VT_COLOR_TV, "Color TV"},
|
||||
{VT_MONO_TV, "B&W TV"},
|
||||
{VT_MONO_AMBER, "Monochrome (Amber)"},
|
||||
{VT_MONO_GREEN, "Monochrome (Green)"},
|
||||
{VT_MONO_WHITE, "Monochrome (White)"},
|
||||
};
|
||||
|
||||
const std::map<size_t, std::vector<SS_CARDTYPE>> cardsForSlots =
|
||||
{
|
||||
{0, {CT_Empty, CT_LanguageCard, CT_Saturn128K}},
|
||||
|
@ -104,9 +117,14 @@ namespace sa2
|
|||
return cpuTypes.at(cpu);
|
||||
}
|
||||
|
||||
const std::string & getModeName(AppMode_e mode)
|
||||
const std::string & getAppModeName(AppMode_e mode)
|
||||
{
|
||||
return modes.at(mode);
|
||||
return appModes.at(mode);
|
||||
}
|
||||
|
||||
const std::string & getVideoTypeName(VideoType_e type)
|
||||
{
|
||||
return videoTypes.at(type);
|
||||
}
|
||||
|
||||
const std::vector<SS_CARDTYPE> & getCardsForSlot(size_t slot)
|
||||
|
@ -152,4 +170,18 @@ namespace sa2
|
|||
};
|
||||
}
|
||||
|
||||
void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled)
|
||||
{
|
||||
VideoStyle_e currentVideoStyle = video.GetVideoStyle();
|
||||
if (enabled)
|
||||
{
|
||||
currentVideoStyle = VideoStyle_e(currentVideoStyle | style);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentVideoStyle = VideoStyle_e(currentVideoStyle & (~style));
|
||||
}
|
||||
video.SetVideoStyle(currentVideoStyle);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "CPU.h"
|
||||
#include "Common.h"
|
||||
#include "DiskImage.h"
|
||||
#include "Video.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -15,12 +16,15 @@ namespace sa2
|
|||
const std::string & getCardName(SS_CARDTYPE card);
|
||||
const std::string & getApple2Name(eApple2Type type);
|
||||
const std::string & getCPUName(eCpuType cpu);
|
||||
const std::string & getModeName(AppMode_e mode);
|
||||
const std::string & getAppModeName(AppMode_e mode);
|
||||
const std::string & getDiskStatusName(Disk_Status_e status);
|
||||
const std::string & getVideoTypeName(VideoType_e type);
|
||||
|
||||
const std::vector<SS_CARDTYPE> & getCardsForSlot(size_t slot);
|
||||
const std::vector<SS_CARDTYPE> & getExpansionCards();
|
||||
const std::map<eApple2Type, std::string> & getAapple2Types();
|
||||
|
||||
void insertCard(size_t slot, SS_CARDTYPE card);
|
||||
|
||||
void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue