1

Topic: [Client Help] How can i set Background?

hi my friends
i wanna ask a question
how can i change the default background in client to any static picture like picture of Ufa Champion?

give me some code for compile:
is there? :
src/game/client/components/menus.cpp
???

please help me
i hate default background
thanks

2

Re: [Client Help] How can i set Background?

Are you talking about the 0.6 or 0.7 version?

3 (edited by Hamid Jigool 2015-12-31 08:29:58)

Re: [Client Help] How can i set Background?

0.6 big_smile

in act i wanna set some width background like k-client:
**snip**

see this image

how can i do that?*

User has been warned for advertising cheat clients // Dune

4

Re: [Client Help] How can i set Background?

Result : Click Here

void CMenus::RenderBackground()
{
    //Graphics()->Clear(1,1,1);
    //render_sunrays(0,0);
    if(gs_TextureBlob == -1)
        gs_TextureBlob = Graphics()->LoadTexture("background.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);

    CUIRect View = *UI()->Screen(); 
    IGraphics::CQuadItem QuadItem(0, 0, View.w, View.h); 

    Graphics()->TextureSet(gs_TextureBlob); 
    Graphics()->BlendNormal(); 

    Graphics()->QuadsBegin(); 
    Graphics()->QuadsDrawTL(&QuadItem, 1); 
    Graphics()->QuadsEnd(); 

    // restore screen
    {CUIRect Screen = *UI()->Screen();
    Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h);}
}

5 (edited by Hamid Jigool 2015-12-31 10:59:46)

Re: [Client Help] How can i set Background?

client crashed with this image:
**snip**

i convert this to png ---> background.png

why?
its for bad size?
what can i do?

-----------
Edit post...


yes my friend its for bad size... i fix it
thank you for the code
i love you
thank you tongue xD


User has been warned for advertising cheat clients // Dune

6 (edited by 2015-12-31 11:35:40)

Re: [Client Help] How can i set Background?

work fine.
Result : Click Here
PNG File : Click Here

src/game/client/components/mapimages.cpp

int CMapImages::GetBackground()
{
    if(m_BackgroundTexture == -1)
    {
        m_BackgroundTexture = Graphics()->LoadTexture("background.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
        if(m_BackgroundTexture == -1)
            m_BackgroundTexture = -2;
    }

    if(m_BackgroundTexture == -2){
        return -1;
    }
    return m_BackgroundTexture;
}

CMapImages::CMapImages()

m_BackgroundTexture = -1;

src/game/client/components/mapimages.h
public:

int GetBackground();

private:

int m_BackgroundTexture;

src/game/client/gameclient.cpp
void CGameClient::OnRender()

    // load background
    int bgImage = m_pClient->m_pMapimages->GetBackground();

    // draw background
    if(g_Config.m_ClOverlayEntities == 100 && bgImage != -1){
        CUIRect View = *UI()->Screen();
        IGraphics::CQuadItem QuadItem(0, 0, View.w, View.h);

        Graphics()->TextureSet(bgImage);
        Graphics()->BlendNormal();

        Graphics()->QuadsBegin();
        Graphics()->QuadsDrawTL(&QuadItem, 1);
        Graphics()->QuadsEnd();
    }