GUI: intro, part 3

you can use this one as I disabled the intro for now
This commit is contained in:
tildearrow 2023-02-16 05:40:06 -05:00
parent ef79a94163
commit 25e4da919d
3 changed files with 34 additions and 17 deletions

View file

@ -5182,6 +5182,7 @@ bool FurnaceGUI::loop() {
} }
if (!tutorial.introPlayed) { if (!tutorial.introPlayed) {
initialScreenWipe=0;
drawIntro(); drawIntro();
} }
@ -5233,6 +5234,20 @@ bool FurnaceGUI::loop() {
ImGui::Render(); ImGui::Render();
renderTimeEnd=SDL_GetPerformanceCounter(); renderTimeEnd=SDL_GetPerformanceCounter();
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData()); ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
if (mustClear) {
SDL_RenderClear(sdlRend);
mustClear--;
} else {
if (initialScreenWipe>0.0f) {
WAKE_UP;
initialScreenWipe-=ImGui::GetIO().DeltaTime*5.0f;
if (initialScreenWipe>0.0f) {
SDL_SetRenderDrawBlendMode(sdlRend,SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(sdlRend,0,0,0,255*initialScreenWipe);
SDL_RenderFillRect(sdlRend,NULL);
}
}
}
SDL_RenderPresent(sdlRend); SDL_RenderPresent(sdlRend);
layoutTimeDelta=layoutTimeEnd-layoutTimeBegin; layoutTimeDelta=layoutTimeEnd-layoutTimeBegin;
@ -6222,7 +6237,9 @@ FurnaceGUI::FurnaceGUI():
waveGenSmooth(1), waveGenSmooth(1),
waveGenAmplify(1.0f), waveGenAmplify(1.0f),
waveGenFM(false), waveGenFM(false),
introPos(0.0) { introPos(0.0),
mustClear(2),
initialScreenWipe(1.0f) {
// value keys // value keys
valueKeys[SDLK_0]=0; valueKeys[SDLK_0]=0;
valueKeys[SDLK_1]=1; valueKeys[SDLK_1]=1;

View file

@ -1495,7 +1495,7 @@ class FurnaceGUI {
bool taken[GUI_TUTORIAL_MAX]; bool taken[GUI_TUTORIAL_MAX];
Tutorial(): Tutorial():
userComesFrom(0), userComesFrom(0),
introPlayed(false) { introPlayed(true) {
memset(taken,0,GUI_TUTORIAL_MAX*sizeof(bool)); memset(taken,0,GUI_TUTORIAL_MAX*sizeof(bool));
} }
} tutorial; } tutorial;
@ -1829,6 +1829,8 @@ class FurnaceGUI {
// intro // intro
double introPos; double introPos;
int mustClear;
float initialScreenWipe;
void drawSSGEnv(unsigned char type, const ImVec2& size); void drawSSGEnv(unsigned char type, const ImVec2& size);
void drawWaveform(unsigned char type, bool opz, const ImVec2& size); void drawWaveform(unsigned char type, bool opz, const ImVec2& size);

View file

@ -33,26 +33,21 @@ void FurnaceGUI::drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2&
-rectMin.y -rectMin.y
); );
ImVec2 posAbs=ImVec2(
pos.x*canvasW,
pos.y*canvasH
);
ImVec2 quad0=ImVec2( ImVec2 quad0=ImVec2(
posAbs.x+rectMin.x*cos(rotate)-rectMin.y*sin(rotate), pos.x+rectMin.x*cos(rotate)-rectMin.y*sin(rotate),
posAbs.y+rectMin.x*sin(rotate)+rectMin.y*cos(rotate) pos.y+rectMin.x*sin(rotate)+rectMin.y*cos(rotate)
); );
ImVec2 quad1=ImVec2( ImVec2 quad1=ImVec2(
posAbs.x+rectMax.x*cos(rotate)-rectMin.y*sin(rotate), pos.x+rectMax.x*cos(rotate)-rectMin.y*sin(rotate),
posAbs.y+rectMax.x*sin(rotate)+rectMin.y*cos(rotate) pos.y+rectMax.x*sin(rotate)+rectMin.y*cos(rotate)
); );
ImVec2 quad2=ImVec2( ImVec2 quad2=ImVec2(
posAbs.x+rectMax.x*cos(rotate)-rectMax.y*sin(rotate), pos.x+rectMax.x*cos(rotate)-rectMax.y*sin(rotate),
posAbs.y+rectMax.x*sin(rotate)+rectMax.y*cos(rotate) pos.y+rectMax.x*sin(rotate)+rectMax.y*cos(rotate)
); );
ImVec2 quad3=ImVec2( ImVec2 quad3=ImVec2(
posAbs.x+rectMin.x*cos(rotate)-rectMax.y*sin(rotate), pos.x+rectMin.x*cos(rotate)-rectMax.y*sin(rotate),
posAbs.y+rectMin.x*sin(rotate)+rectMax.y*cos(rotate) pos.y+rectMin.x*sin(rotate)+rectMax.y*cos(rotate)
); );
ImVec2 uv0=ImVec2(uvMin.x,uvMin.y); ImVec2 uv0=ImVec2(uvMin.x,uvMin.y);
@ -69,7 +64,6 @@ void FurnaceGUI::drawIntro() {
if (introPos<7.0) { if (introPos<7.0) {
WAKE_UP; WAKE_UP;
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
introPos+=ImGui::GetIO().DeltaTime;
ImGui::SetNextWindowPos(ImVec2(0,0)); ImGui::SetNextWindowPos(ImVec2(0,0));
ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH)); ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH));
if (ImGui::Begin("Intro",NULL,ImGuiWindowFlags_Modal)) { if (ImGui::Begin("Intro",NULL,ImGuiWindowFlags_Modal)) {
@ -82,8 +76,12 @@ void FurnaceGUI::drawIntro() {
dl->AddRectFilled(top,bottom,bgColor); dl->AddRectFilled(top,bottom,bgColor);
dl->AddText(top,0xffffffff,"Furnace intro - work in progress"); dl->AddText(top,0xffffffff,"Furnace intro - work in progress");
drawImage(dl,GUI_IMAGE_TALOGO,ImVec2(0.5,0.5),ImVec2(1.0,1.0),introPos,ImVec2(0.0,0.0),ImVec2(1.0,1.0),ImVec4(1.0,1.0,1.0,1.0)); drawImage(dl,GUI_IMAGE_TALOGO,ImVec2(0.5*canvasW,0.5*canvasH),ImVec2(1.0,1.0),0.0f,ImVec2(0.0,0.0),ImVec2(1.0,1.0),ImVec4(1.0,1.0,1.0,pow(MIN(1.0,introPos*2.0),0.8)));
} }
ImGui::End(); ImGui::End();
if (mustClear<=0) {
introPos+=ImGui::GetIO().DeltaTime;
}
} }
} }