Added antialiasing option and disabled DirectX

This commit is contained in:
KiritoDv 2021-07-20 13:58:49 -05:00
parent 3138b85ca4
commit da2698fee2
8 changed files with 19 additions and 23 deletions

View File

@ -25,6 +25,9 @@ MVideoCategory::MVideoCategory() : MoonCategory("TEXT_OPT_VIDEO"){
texY = 57; texY = 57;
hudY = 74; hudY = 74;
#endif #endif
this->catOptions.push_back(new MWValue(22, texY, "TEXT_OPT_TEXFILTER", {.index = (int*)&configFiltering, .values = &filters, .valueKeys = true}, true));
this->catOptions.push_back(new MWValue(22, texY, "Enable antialias", {.bvar = &configWindow.enable_antialias}, false));
this->catOptions.push_back(new MWValue(22, texY, "Antialias level", {.ivar = (int*)&configWindow.antialias_level, .max = 16, .min = 2, .step = 2, .rawValue = true}, false));
this->catOptions.push_back(new MWValue(22, texY, "TEXT_OPT_TEXFILTER", {.index = (int*)&configFiltering, .values = &filters, .valueKeys = true}, true)); this->catOptions.push_back(new MWValue(22, texY, "TEXT_OPT_TEXFILTER", {.index = (int*)&configFiltering, .values = &filters, .valueKeys = true}, true));
this->catOptions.push_back(new MWValue(22, hudY, "TEXT_OPT_HUD", {.bvar = &configHUD}, true)); this->catOptions.push_back(new MWValue(22, hudY, "TEXT_OPT_HUD", {.bvar = &configHUD}, true));
#ifndef TARGET_SWITCH #ifndef TARGET_SWITCH

View File

@ -109,7 +109,7 @@ void MWValue::Draw(){
float value = isFloat ? *this->bind.fvar : *this->bind.ivar; float value = isFloat ? *this->bind.fvar : *this->bind.ivar;
float max = this->bind.max; float max = this->bind.max;
wstring text = to_wstring((int)(100 * (value / max))) + L"%"; wstring text = !this->bind.rawValue ? to_wstring((int)(100 * (value / max))) + L"%" : to_wstring((int)value);
tmpWidth += MoonGetTextWidth(text, scale, false); tmpWidth += MoonGetTextWidth(text, scale, false);
MoonDrawWideText(this->x + ( 10 + barWidth / 2 ) - tmpWidth / 2 + titleWidth, this->y, text, scale, {58, 249, 252, 255}, true, true); MoonDrawWideText(this->x + ( 10 + barWidth / 2 ) - tmpWidth / 2 + titleWidth, this->y, text, scale, {58, 249, 252, 255}, true, true);

View File

@ -18,6 +18,7 @@ struct MWValueBind{
int *index; int *index;
std::vector<std::wstring>* values; std::vector<std::wstring>* values;
bool valueKeys; bool valueKeys;
bool rawValue;
uint32_t* bindKeys; uint32_t* bindKeys;
std::string keyIcon; std::string keyIcon;

View File

@ -48,6 +48,8 @@ ConfigWindow configWindow = {
.fullscreen = false, .fullscreen = false,
.exiting_fullscreen = false, .exiting_fullscreen = false,
.settings_changed = false, .settings_changed = false,
.enable_antialias = true,
.antialias_level = 4
}; };
unsigned int configLanguage = 0; unsigned int configLanguage = 0;

View File

@ -15,6 +15,8 @@ typedef struct {
bool fullscreen; bool fullscreen;
bool exiting_fullscreen; bool exiting_fullscreen;
bool settings_changed; bool settings_changed;
bool enable_antialias;
unsigned int antialias_level;
} ConfigWindow; } ConfigWindow;
extern ConfigWindow configWindow; extern ConfigWindow configWindow;

View File

@ -645,6 +645,10 @@ static void gfx_opengl_start_frame(void) {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
if(configWindow.enable_antialias)
glEnable(GL_MULTISAMPLE);
else
glDisable(GL_MULTISAMPLE);
} }
static void gfx_opengl_end_frame(void) { static void gfx_opengl_end_frame(void) {

View File

@ -219,8 +219,9 @@ static void gfx_sdl_init(const char *window_title) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
#endif #endif
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configWindow.antialias_level);
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
#ifdef TARGET_SWITCH #ifdef TARGET_SWITCH
configWindow.fullscreen = false; configWindow.fullscreen = false;

View File

@ -207,30 +207,13 @@ void main_func(char *argv[]) {
else if (gCLIOpts.FullScreen == 2) else if (gCLIOpts.FullScreen == 2)
configWindow.fullscreen = false; configWindow.fullscreen = false;
#if defined(WAPI_SDL1) || defined(WAPI_SDL2)
wm_api = &gfx_sdl; wm_api = &gfx_sdl;
#elif defined(WAPI_DXGI)
wm_api = &gfx_dxgi;
#else
#error No window API!
#endif
#if defined(RAPI_D3D11)
rendering_api = &gfx_direct3d11_api;
# define RAPI_NAME "DirectX 11"
#elif defined(RAPI_D3D12)
rendering_api = &gfx_direct3d12_api;
# define RAPI_NAME "DirectX 12"
#elif defined(RAPI_GL) || defined(RAPI_GL_LEGACY)
rendering_api = &gfx_opengl_api; rendering_api = &gfx_opengl_api;
# ifdef USE_GLES # ifdef USE_GLES
# define RAPI_NAME "OpenGL ES" # define RAPI_NAME "OpenGL ES"
# else # else
# define RAPI_NAME "OpenGL" # define RAPI_NAME "OpenGL"
# endif # endif
#else
#error No rendering API!
#endif
char window_title[96] = char window_title[96] =
"Super Mario 64 - Moon64 (" RAPI_NAME ")"; "Super Mario 64 - Moon64 (" RAPI_NAME ")";