This repository has been archived by the owner on Jul 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1769 from reicast/skmp/refactorcast-2
REFACTORCAST-2
- Loading branch information
Showing
18 changed files
with
397 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include "types.h" | ||
#include "version.h" | ||
#include "gui.h" | ||
#include "imgui/imgui.h" | ||
#include "gui_partials.h" | ||
#include "gui_util.h" | ||
#include "rend/gles/imgui_impl_opengl3.h" | ||
#include "cfg/cfg.h" | ||
#include "oslib/oslib.h" | ||
|
||
float CalcScreenScale(const char* headline) { | ||
auto size = ImGui::CalcTextSize(headline); | ||
|
||
float scale = 0; | ||
|
||
scale = screen_width/(size.x + 10); | ||
|
||
if (size.y * scale / screen_height > 0.4) { | ||
scale = (screen_height * 0.4) / size.y; | ||
} | ||
return scale; | ||
} | ||
|
||
void DrawTextCentered(const char* text) { | ||
auto size = ImGui::CalcTextSize(text); | ||
ImGui::SetCursorPosX(screen_width/2 - size.x / 2); | ||
ImGui::Text("%s", text); | ||
} | ||
|
||
void gui_welcome(ImFont* font64) { | ||
|
||
static auto endTime = os_GetSeconds() + 3; | ||
|
||
if (os_GetSeconds() > endTime) { | ||
gui_state = Main; | ||
return; | ||
} | ||
|
||
ImGui_Impl_NewFrame(); | ||
ImGui::NewFrame(); | ||
|
||
ImGui_ImplOpenGL3_DrawBackground(); | ||
|
||
ImGui::SetNextWindowPos(ImVec2(0, 0)); | ||
ImGui::SetNextWindowSize(ImVec2(screen_width, screen_height)); | ||
|
||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0); | ||
|
||
ImGui::PushFont(font64); | ||
ImGui::Begin("Welcome", NULL, /*ImGuiWindowFlags_AlwaysAutoResize |*/ ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize); | ||
|
||
|
||
ImGui::SetWindowFontScale(1); | ||
float scale = CalcScreenScale("Reicast"); | ||
|
||
ImGui::SetWindowFontScale(scale); | ||
|
||
DrawTextCentered("Reicast"); | ||
|
||
string ver = REICAST_VERSION; | ||
auto ver_numeric = ver.substr(0, ver.find_last_of("-")); | ||
auto ver_hash = "(" + ver.substr(ver.find_last_of("-") + 2) + ")"; | ||
|
||
ImGui::SetWindowFontScale(scale / 3.5); | ||
DrawTextCentered(ver_numeric.c_str()); | ||
|
||
ImGui::SetWindowFontScale(scale / 6); | ||
DrawTextCentered(ver_hash.c_str()); | ||
|
||
ImGui::End(); | ||
ImGui::PopFont(); | ||
ImGui::PopStyleVar(); | ||
|
||
ImGui::Render(); | ||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData(), false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
#include "types.h" | ||
|
||
struct SuperH4; | ||
|
||
void map_area0_init(SuperH4* sh4); | ||
void map_area0(SuperH4* sh4, u32 base); |
Oops, something went wrong.