MenuCheckBox::MenuCheckBox()
{
    m_MenuItemType = MIT_CheckBox;

    m_State = MCBS_Idle;
    m_FingerHolding = -1;

    m_Checked = false;
    m_Action = 0;

    m_PosX = 0;
    m_PosY = 0;
    m_Justification = 0;
    m_InputWidth = 0;
    m_InputHeight = 0;

    m_pFont = 0;
    m_FontHeight = 30;
    m_String[0] = 0;
    m_TextOffsetX = 0;
    m_TextOffsetY = 0;
    m_TextJustification = 0;
    m_TextDropShadowOffsetX = 0;
    m_TextDropShadowOffsetY = 0;
    m_TextColor = ColorByte(255,255,255,255);

    m_BGWidth = 0;
    m_BGHeight = 0;
    m_BGDropShadowOffsetX = 0;
    m_BGDropShadowOffsetY = 0;

    m_pCheckedBGSprite = 0;
    m_CheckedBGSpriteUVs = Vector4( 0, 1, 0, 1 );
    m_CheckedBGColor = ColorByte(255,255,255,255);

    m_pUncheckedBGSprite = 0;
    m_UncheckedBGSpriteUVs = Vector4( 0, 1, 0, 1 );
    m_UncheckedBGColor = ColorByte(255,255,255,255);

    m_SoundPressed = GameAudioCue_None;
}
Example #2
0
void Screen_Pause::Draw()
{
    Screen_Base::Draw();

    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->Create( 1, 1, 0, 1, 0, 1, Justify_Left|Justify_Top );
    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->SetPosition( 0, 1, 0 );
    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->SetTint( ColorByte(0,0,0,240) );
    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->Draw( &g_pGame->m_OrthoMatrix );

    FontDefinition* pFont = g_pGame->m_pSystemFont;
    int scrw = (int)g_pGame->m_GameWidth;
    int scrh = (int)g_pGame->m_GameHeight;
    float fontheight = 30;
    unsigned char justify = Justify_CenterX|Justify_CenterY;

    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->SetTint( ColorByte(0,150,0,255) );

    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->Create( 1, 0.2f, 0, 1, 0, 1, Justify_CenterX|Justify_CenterY );
    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->SetPosition( 0.5f, 0.8f, 0 );
    g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable]->Draw( &g_pGame->m_OrthoMatrix );
    //if( g_pGame->m_GBGameType == GBType_Options )
    //{
    //    RenderTextQuick( pFont, fontheight*4, 0.5f*scrw, 0.8f*scrh, justify, "OPTIONS" );        
    //}
    //else
    {
        RenderTextQuick( pFont, fontheight*4, 0.5f*scrw, 0.8f*scrh, justify, "PAUSE" );        
    }

    int i=0;
    for( i=0; i<m_MenuItemsNeeded; i++ )
    {
        if( GetMenuItem(i) )
        {
            GetMenuItem(i)->Draw( &g_pGame->m_OrthoMatrixGameSize );
        }
    }
}
Example #3
0
void ScoreChunk::Reset()
{
    m_pFont = 0;
    m_String[0] = 0;
    m_Value = 0;
    m_FontHeight = 0;
    m_X = -10000;
    m_Y = -10000;
    m_Size = 0;

    m_Color = ColorByte(255, 255, 255, 255);
    m_ShadowColor = ColorByte(0, 0, 0, 128);

    m_ShadowOffsetX = 0;
    m_ShadowOffsetY = 0;

    m_Angle = 0;

    m_InitialDelay = 0;
    m_MoveSpeed = 10;
    m_SitTime = 0;
    m_TimeAlive = 0;
    m_TimeToLive = 1;
}
void MenuCheckBox::Draw()
{
    if( m_Visible == false )
        return;
    
    if( m_State == MCBS_Disabled )
        return;

    //float scrw = g_pGame->m_GameWidth;
    //float scrh = g_pGame->m_GameHeight;

    float shadowoffx = m_TextDropShadowOffsetX;
    float shadowoffy = m_TextDropShadowOffsetY;
    float CheckBoxshadowoffx = m_BGDropShadowOffsetX;
    float CheckBoxshadowoffy = m_BGDropShadowOffsetY;

    float bgwidth = m_BGWidth;
    float bgheight = m_BGHeight;

    MySprite* pSprite = m_pCheckedBGSprite;
    Vector4 uvs = m_CheckedBGSpriteUVs;
    ColorByte bgcolor = m_CheckedBGColor;
    if( m_Checked == false )
    {
        pSprite = m_pUncheckedBGSprite;
        uvs = m_UncheckedBGSpriteUVs;
        bgcolor = m_UncheckedBGColor;
    }

    if( pSprite == 0 )
    {
        pSprite = g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable];
    }

    pSprite->SetTint( bgcolor );

    MySprite* pShadowSprite = pSprite; //m_pShadowSprite;
    Vector4 shuvs = uvs;
    if( pShadowSprite == 0 )
    {
        pShadowSprite = g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable];
        shuvs = Vector4( 0, 1, 0, 1 );
    }

    // draw the checkbox with drop shadow.
    if( pSprite )
    {
        if( pShadowSprite )
        {
            pShadowSprite->Create( "MenuCheckBox", bgwidth, bgheight, shuvs.x, shuvs.y, shuvs.z, shuvs.w, Justify_CenterX|Justify_CenterY );

            pShadowSprite->SetTint( ColorByte(0,0,0,64) );
            pShadowSprite->SetPosition( m_PosX+CheckBoxshadowoffx, m_PosY+CheckBoxshadowoffy, 0.1f );
            pShadowSprite->Draw( &g_pGame->m_OrthoMatrixGameSize );
        }

        pSprite->Create( "MenuCheckBox", bgwidth, bgheight, uvs.x, uvs.y, uvs.z, uvs.w, Justify_CenterX|Justify_CenterY );

        pSprite->SetTint( bgcolor );
        if( m_State == MCBS_HeldDown )
        {
            pSprite->SetTint( ColorByte(200,200,200,255) );
        }
        pSprite->SetPosition( m_PosX, m_PosY, 0 );
        pSprite->Draw( &g_pGame->m_OrthoMatrixGameSize );
    }

    float y;

    // draw text
    if( m_pFont != 0 && m_String[0] != 0 )
    {
        ColorByte textcolor = m_TextColor;

        ColorByte textshadowcolor(0,0,0,200);

        y = m_PosY;
        y += m_TextOffsetY;
        RenderTextQuickWithColor( m_pFont, m_FontHeight, m_PosX+shadowoffx, y-shadowoffy, m_Justification, textshadowcolor, m_String );
        RenderTextQuickWithColor( m_pFont, m_FontHeight, m_PosX, y, m_Justification, textcolor, m_String );
    }
}
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

#include "GameCommonHeader.h"
//#include "../GameSliders.h"
//#include "../Core/ResourceManager.h"
//#include "../GravityBalls/GravityBalls_Resources.h"
#include "MenuCheckBox.h"

ColorByte DefaultMenuCheckBoxColors[MCBCT_NumColors] = 
{
    ColorByte(255,255,255,255), // MCBCT_CheckedBG
    ColorByte(128,128,128,128), // MCBCT_UncheckedBG

    ColorByte(255,255,255,255), // MCBCT_Text
};

MenuCheckBox::MenuCheckBox()
{
    m_MenuItemType = MIT_CheckBox;

    m_State = MCBS_Idle;
    m_FingerHolding = -1;

    m_Checked = false;
    m_Action = 0;
Example #6
0
void MenuSprite::Draw()
{
    if( m_Visible == false )
        return;

    //float scrw = g_pGame->m_GameWidth;
    //float scrh = g_pGame->m_GameHeight;

    float bgshadowoffx = m_DropShadowOffsetBG_X;
    float bgshadowoffy = m_DropShadowOffsetBG_Y;

    //float posx = (m_PositionOffset.x + m_Transform.m41) / scrw;
    //float posy = (m_PositionOffset.y + m_Transform.m42) / scrh;
    //float bgwidth = m_BGWidth / scrw * m_Scale.x;
    //float bgheight = m_BGHeight / scrh * m_Scale.y;

    MySprite* pSprite = m_pBGSprite;
    //Vector4 uvs = m_BGSpriteUVs;
    ColorByte bgcolor = m_BGColor;

    //if( pSprite )
    //    pSprite->SetTint( ColorByte(255,255,255,255) );

    //if( pSprite == 0 )
    //{
    //    pSprite = g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable];
    //    //pSprite->SetTint( bgcolor );
    //}

    MySprite* pShadowSprite = m_pShadowSprite;
    //Vector4 shuvs = m_ShadowSpriteUVs;
    //if( pShadowSprite == 0 )
    //{
    //    pShadowSprite = g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable];
    //    shuvs = Vector4( 0, 1, 0, 1 );
    //}

    if( pSprite )
    {
        if( pShadowSprite && m_HasShadow )
        {
            //pShadowSprite->Create( bgwidth, bgheight, shuvs.x, shuvs.y, shuvs.z, shuvs.w, m_Justification );

            ColorByte shadowcolor = ColorByte(0,0,0,bgcolor.a/4);
            pShadowSprite->SetTint( shadowcolor );
            //pShadowSprite->SetPosition( posx+bgshadowoffx, posy-bgshadowoffy, 0.1f );
            pShadowSprite->SetTransform( m_Transform );
            pShadowSprite->m_Position.m41 += bgshadowoffx;
            pShadowSprite->m_Position.m42 += bgshadowoffy;

            pShadowSprite->Draw( &g_pGame->m_OrthoMatrixGameSize );
        }

        //pSprite->Create( bgwidth, bgheight, uvs.x, uvs.y, uvs.z, uvs.w, m_Justification );

        pSprite->SetTint( bgcolor );
        //pSprite->SetPosition( posx, posy, 0 );
        pSprite->SetTransform( m_Transform );

        pSprite->Draw( &g_pGame->m_OrthoMatrixGameSize );
    }

}
Example #7
0
//
// Copyright (c) 2012-2016 Jimmy Lord http://www.flatheadgames.com
//
// This software is provided 'as-is', without any express or implied warranty.  In no event will the authors be held liable for any damages arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.

#include "SharedCommonHeader.h"
//#include "Core/ResourceManager.h"
#include "MenuSlider.h"

ColorByte MenuSliderColors[MSCT_NumColors] =
{
    ColorByte(255,255,255,255), // MSCT_BarColor
    ColorByte(200,200,200,255), // MSCT_HandleColor

    ColorByte(0,0,0,0),         // MSCT_BGColor
};

MenuSlider::MenuSlider(GameCore* pGameCore)
: MenuItem( pGameCore )
{
    m_Disabled = false;

    m_ValuePerc = 0;

    for( int i=0; i<MSCT_NumColors; i++ )
        m_Colors[i] = MenuSliderColors[i];