GUI: intro, part 7 - DO NOT USE

This commit is contained in:
tildearrow 2023-02-17 19:40:18 -05:00
parent 92f4e48228
commit 474f6c7ebf
6 changed files with 15474 additions and 8 deletions

View File

@ -589,6 +589,7 @@ src/gui/image_talogo.cpp
src/gui/image_tachip.cpp
src/gui/image_logo.cpp
src/gui/image_wordmark.cpp
src/gui/image_introbg.cpp
src/gui/image.cpp
src/gui/debug.cpp

View File

@ -655,6 +655,7 @@ enum FurnaceGUIImages {
GUI_IMAGE_TACHIP,
GUI_IMAGE_LOGO,
GUI_IMAGE_WORDMARK,
GUI_IMAGE_INTROBG,
GUI_IMAGE_MAX
};
@ -1885,7 +1886,7 @@ class FurnaceGUI {
void popToggleColors();
FurnaceGUIImage* getImage(FurnaceGUIImages image);
SDL_Texture* getTexture(FurnaceGUIImages image);
SDL_Texture* getTexture(FurnaceGUIImages image, SDL_BlendMode blendMode=SDL_BLENDMODE_BLEND);
void drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2& pos, const ImVec2& scale, double rotate, const ImVec2& uvMin, const ImVec2& uvMax, const ImVec4& imgColor);
void drawMobileControls();

View File

@ -34,7 +34,8 @@ const unsigned char* imageData[GUI_IMAGE_MAX]={
image_talogo_data,
image_tachip_data,
image_logo_data,
image_wordmark_data
image_wordmark_data,
image_introbg_data
};
const unsigned int imageLen[GUI_IMAGE_MAX]={
@ -42,10 +43,11 @@ const unsigned int imageLen[GUI_IMAGE_MAX]={
image_talogo_size,
image_tachip_size,
image_logo_size,
image_wordmark_size
image_wordmark_size,
image_introbg_size
};
SDL_Texture* FurnaceGUI::getTexture(FurnaceGUIImages image) {
SDL_Texture* FurnaceGUI::getTexture(FurnaceGUIImages image, SDL_BlendMode blendMode) {
FurnaceGUIImage* img=getImage(image);
if (img==NULL) return NULL;
@ -54,11 +56,11 @@ SDL_Texture* FurnaceGUI::getTexture(FurnaceGUIImages image) {
if (img->tex==NULL) {
img->tex=SDL_CreateTexture(sdlRend,SDL_PIXELFORMAT_ABGR8888,SDL_TEXTUREACCESS_STATIC,img->width,img->height);
SDL_SetTextureBlendMode(img->tex,SDL_BLENDMODE_BLEND);
if (img->tex==NULL) {
logE("error while creating image %d texture! %s",(int)image,SDL_GetError());
return NULL;
}
SDL_SetTextureBlendMode(img->tex,blendMode);
if (SDL_UpdateTexture(img->tex,NULL,img->data,img->width*4)!=0) {
logE("error while updating texture of image %d! %s",(int)image,SDL_GetError());

View File

@ -33,4 +33,7 @@ extern const unsigned int image_logo_size;
extern const unsigned char image_wordmark_data[];
extern const unsigned int image_wordmark_size;
extern const unsigned char image_introbg_data[];
extern const unsigned int image_introbg_size;
#endif

15448
src/gui/image_introbg.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -83,9 +83,10 @@ void FurnaceGUI::drawIntro() {
ImVec2 bottom=ImVec2(canvasW,canvasH);
// preload textures
SDL_Texture* pt=getTexture(GUI_IMAGE_TALOGO);
pt=getTexture(GUI_IMAGE_TACHIP);
pt=getTexture(GUI_IMAGE_LOGO);
getTexture(GUI_IMAGE_TALOGO);
getTexture(GUI_IMAGE_TACHIP);
getTexture(GUI_IMAGE_LOGO);
getTexture(GUI_IMAGE_INTROBG,SDL_BLENDMODE_ADD);
// background
float bgAlpha=CLAMP(9.0-introPos,0.0,1.0);
@ -108,6 +109,16 @@ void FurnaceGUI::drawIntro() {
}
}
// background after part 1
if (introPos>2.3) {
float s1a=CLAMP((introPos-3.2)*1.3,0.0f,1.0f);
float s2a=CLAMP((introPos-4.5)*1.0,0.0f,1.0f);
float addition=(3*pow(s1a,2)-2*pow(s1a,3)+(3*pow(s2a,2)-2*pow(s2a,3))*1.5)*3.5;
drawImage(dl,GUI_IMAGE_INTROBG,ImVec2(0.125,0.25-(introPos+addition)*0.07),ImVec2(18.0,18.0),0.0,ImVec2(0.0,0.0),ImVec2(1.0,1.0),ImVec4(0.4,0.1+0.7*s1a,1.0*s1a,0.5*bgAlpha));
drawImage(dl,GUI_IMAGE_INTROBG,ImVec2(0.4,0.25-(introPos+addition)*0.08),ImVec2(18.0,18.0),0.0,ImVec2(0.0,0.0),ImVec2(1.0,1.0),ImVec4(0.5-0.4*s1a,0.8-0.6*s1a,1.0*s1a,0.6*bgAlpha));
drawImage(dl,GUI_IMAGE_INTROBG,ImVec2(0.7,0.25-(introPos+addition)*0.05),ImVec2(20.0,20.0),0.0,ImVec2(0.0,0.0),ImVec2(1.0,1.0),ImVec4(0.4+0.3*s1a,1.0,0.7,(0.5-0.4*s1a)*bgAlpha));
}
// transition
float transitionPos=CLAMP(introPos*4.0-8,-1.5,3.5);
dl->AddQuadFilled(