Ejemplo n.º 1
0
void setTheme(char * themeName) {
    audio_stop();

    //Save the selected theme in main config
    setConfigString("currentTheme", themeName, configTypeMain);

    //Reload theme config
    loadConfigWithType(configTypeTheme);

    //Reload theme variables for menu
    loadThemeConfig();

    loadSplashImages();

    if (themeImageExists(themeImageSplashTop)) {
        drawThemeImage(themeImageSplashTop, GFX_TOP, 0, 0);
    }
    if (themeImageExists(themeImageSplashBottom)) {
        drawThemeImage(themeImageSplashBottom, GFX_BOTTOM, 0, 0);
    }

    gfxFlip();

    int startMs = osGetTime();
    playBootSound();

    //Reload theme images
    initThemeImages();

	//Load BGM
    initThemeSounds();

    //Re-initialise colours
    initColours();

    //Force reload of GUI elements
    statusbarNeedsUpdate = true;
    toolbarNeedsUpdate = true;
    alphaImagesDrawn = false;

    waitForDurationOfSound(&themeSoundBoot, startMs);

    startBGM();

    panelsDrawn = false;
    pageControlPanelsDrawn = false;
}
Ejemplo n.º 2
0
void drawNetloaderBackground() {
    rgbColour * bgc = backgroundColour();

    gfxFillColor(GFX_BOTTOM, GFX_LEFT, (u8[]){bgc->r, bgc->g, bgc->b});
    gfxFillColor(GFX_TOP, GFX_LEFT, (u8[]){bgc->r, bgc->g, bgc->b});

    //Wallpaper
    if (themeImageExists(themeImageTopWallpaperInfo)) {
        drawThemeImage(themeImageTopWallpaperInfo, GFX_TOP, 0, 0);
    }
    else if (themeImageExists(themeImageTopWallpaper)) {
        drawThemeImage(themeImageTopWallpaper, GFX_TOP, 0, 0);
    }

    if (themeImageExists(themeImageBottomWallpaperNonGrid)) {
        drawThemeImage(themeImageBottomWallpaperNonGrid, GFX_BOTTOM, 0, 0);
    }

    else if (themeImageExists(themeImageBottomWallpaper)) {
        drawThemeImage(themeImageBottomWallpaper, GFX_BOTTOM, 0, 0);
    }

    drawStatusBar(wifiStatus, charging, batteryLevel);
}
Ejemplo n.º 3
0
void btnDrawButton(button * aButton) {
    if (!aButton->visible) {
        return;
    }
    
    if (aButton->buttonType == btnButtonTypeSlider) {
        btnDrawSlider(aButton);
        return;
    }
    
    rgbColour *aRGB;
    
    if (aButton->highlighted) {
        aRGB = tintColour();
        
    }
    else {
        aRGB = inactiveColour();
    }
    
    u8 r = aRGB->r;
    u8 g = aRGB->g;
    u8 b = aRGB->b;
    
    
    if (aButton->buttonType == btnButtonTypeToolbarLeft) {
        if (themeImageExists(themeImageTopLeftButton)) {
            if (aButton->highlighted && themeImageExists(themeImageTopLeftButtonSelected)) {
                drawThemeImage(themeImageTopLeftButtonSelected, aButton->screen, aButton->x-(36-aButton->h), aButton->y);
            }
            else {
                drawThemeImage(themeImageTopLeftButton, aButton->screen, aButton->x-(36-aButton->h), aButton->y);
            }
        }
        else {
            gfxDrawSpriteAlphaBlendFade(aButton->screen, aButton->side, (u8*)toolbarbuttonshadowleft_bin, 41, 41, aButton->x-(41-aButton->h), aButton->y, translucencyBarIcons);
            btnDrawMaskedBitmapForButton(aButton, lefttoolbarbuttonalphamask_bin, r, g, b, translucencyBarIcons);
        }
    }
    else if (aButton->buttonType == btnButtonTypeToolbarRight) {
        if (themeImageExists(themeImageTopRightButton)) {
            if (aButton->highlighted && themeImageExists(themeImageTopRightButtonSelected)) {
                drawThemeImage(themeImageTopRightButtonSelected, aButton->screen, aButton->x-(36-aButton->h), aButton->y-(36-aButton->w));
            }
            else {
                drawThemeImage(themeImageTopRightButton, aButton->screen, aButton->x-(36-aButton->h), aButton->y-(36-aButton->w));
            }
        }
        else {
            gfxDrawSpriteAlphaBlendFade(aButton->screen, aButton->side, (u8*)toolbarbuttonshadowright_bin, 41, 41, aButton->x-(41-aButton->h), aButton->y-(41-aButton->w), translucencyBarIcons);
            btnDrawMaskedBitmapForButton(aButton, righttoolbarbuttonalphamask_bin, r, g, b, translucencyBarIcons);
        }
    }
    else if (aButton->buttonType == btnButtonTypeToolbarBottomRight) {
        if (themeImageExists(themeImageBottomRightButton)) {
            if (aButton->highlighted && themeImageExists(themeImageBottomRightButtonSelected)) {
                drawThemeImage(themeImageBottomRightButtonSelected, aButton->screen, aButton->x, aButton->y-(36-aButton->w));
            }
            else {
                drawThemeImage(themeImageBottomRightButton, aButton->screen, aButton->x, aButton->y-(36-aButton->w));
            }
        }
        else {
            gfxDrawSpriteAlphaBlendFade(aButton->screen, aButton->side, (u8*)toolbarbuttonshadowbottomright_bin, 41, 41, aButton->x, aButton->y-(41-aButton->w), translucencyBarIcons);
            btnDrawMaskedBitmapForButton(aButton, bottomrighttoolbarbuttonalphamask_bin, r, g, b, translucencyBarIcons);
        }
    }
    else if (aButton->buttonType == btnButtonTypeToolbarBottomLeft) {
        if (themeImageExists(themeImageBottomLeftButton)) {
            if (aButton->highlighted && themeImageExists(themeImageBottomLeftButtonSelected)) {
                drawThemeImage(themeImageBottomLeftButtonSelected, aButton->screen, aButton->x, aButton->y);
            }
            else {
                drawThemeImage(themeImageBottomLeftButton, aButton->screen, aButton->x, aButton->y);
            }
        }
        else {
            gfxDrawSpriteAlphaBlendFade(aButton->screen, aButton->side, (u8*)toolbarbuttonshadowbottomleft_bin, 41, 41, aButton->x, aButton->y, translucencyBarIcons);
            btnDrawMaskedBitmapForButton(aButton, bottomlefttoolbarbuttonalphamask_bin, r, g, b, translucencyBarIcons);
        }
    }
    else if (aButton->buttonType == btnButtonTypePageArrowLeft) {
        btnDrawMaskedBitmapForButton(aButton, arrowleftalphamask_bin, r, g, b, translucencyPageControls);
    }
    else if (aButton->buttonType == btnButtonTypePageArrowRight) {
        btnDrawMaskedBitmapForButton(aButton, arrowrightalphamask_bin, r, g, b, translucencyPageControls);
    }
    else if (aButton->buttonType == btnButtonTypeRect) {
        drawButtonRectForButton(aButton, r, g, b);
    }
    else {
        return;
    }
    
    rgbColour * dark = darkTextColour();
    
    if (aButton->selected) {        
        gfxDrawSpriteAlphaBlend(aButton->screen, aButton->side, (u8*)tick_bin, 48, 48, aButton->x, aButton->y);
    }
    
    if (aButton->buttonIcon == btnButtonIconBackArrow) {
        if (themeImageExists(themeImageBackSymbol)) {
            drawThemeImage(themeImageBackSymbol, aButton->screen, aButton->x, aButton->y);
        }
        else {
            btnDrawIcon(aButton, (u8*)backarrow_bin);
        }
    }
    else if (aButton->buttonIcon == btnButtonIconSpanner) {
        if (themeImageExists(themeImageSettingsSymbol)) {
            drawThemeImage(themeImageSettingsSymbol, aButton->screen, aButton->x, aButton->y);
        }
        else {
            btnDrawIcon(aButton, (u8*)spanner_bin);
        }
    }
    else if (aButton->buttonIcon == btnButtonIconQuestionMark) {
        if (themeImageExists(themeImageHelpSymbol)) {
            drawThemeImage(themeImageHelpSymbol, aButton->screen, aButton->x, aButton->y);
        }
        else {
            btnDrawIcon(aButton, (u8*)questionmark_bin);
        }
    }
    else if (aButton->buttonIcon == btnButtonIconFolder) {
        if (themeImageExists(themeImageFoldersSymbol)) {
            drawThemeImage(themeImageFoldersSymbol, aButton->screen, aButton->x, aButton->y);
        }
        else {
            btnDrawIcon(aButton, (u8*)folder_bin);
        }
    }
    else if (aButton->buttonIcon == btnButtonIconHome) {
        if (themeImageExists(themeImageHomeSymbol)) {
            drawThemeImage(themeImageHomeSymbol, aButton->screen, aButton->x, aButton->y);
        }
        else {
            btnDrawIcon(aButton, (u8*)home_bin);
        }
    }
    
    MAFont *font = &MAFontRobotoRegular10;
    
    int lineHeight = font->lineHeight;
    
    int textOffset = 10;
    
    if (strlen(aButton->shortText1) > 0) {
        MADrawTextWrap(aButton->screen, aButton->side, aButton->x + (aButton->w/2), aButton->y+textOffset, aButton->shortText1, font, dark->r, dark->g, dark->b, 0, 0);
    }

    if (strlen(aButton->shortText2) > 0) {
        MADrawTextWrap(aButton->screen, aButton->side, aButton->x + (aButton->w/2) - lineHeight, aButton->y + textOffset, aButton->shortText2, font, dark->r, dark->g, dark->b, 0, 0);
    }

    if (strlen(aButton->longText) > 0) {
        MADrawTextWrap(aButton->screen, aButton->side, aButton->x + (aButton->w/2) - (lineHeight/2), aButton->y + textOffset, aButton->longText, font, dark->r, dark->g, dark->b, 0, 0);
    }

}