1

Topic: [HELP]Modify the background

Hello ! how to modify the background ? Please

Thanks for your help smile

2

Re: [HELP]Modify the background

What background?

Not Luck, Just Magic.

3

Re: [HELP]Modify the background

The background http://img220.imageshack.us/img220/9466/capturarge.png (the image checkered)

4

Re: [HELP]Modify the background

*Sigh* How Many Times...
You Need To Know C++ To Do This, Etc...

Italic text

5

Re: [HELP]Modify the background

I know C++ but i don't find where the good file

6

Re: [HELP]Modify the background

Light~Sophien[BioPi] wrote:

where the good file

Where The Good File "Made It's Surprisingly Swift Escape?"

Italic text

7

Re: [HELP]Modify the background

But i'm not expert in C++

8

Re: [HELP]Modify the background

The background is rendered in src/game/client/components/menus.cpp in lines 1552 - 1606.

9

Re: [HELP]Modify the background

Killa, can the delfaut backg. be replaced by a image file, like a png?

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

10

Re: [HELP]Modify the background

@HeroiAmarelo: Yes you can.. and you can replace it by all you can make smile

You can load png image using CGraphics class or using bam to store it...

With CGraphics:

-- Load the image in to memory
int TextureID = Graphics()->LoadTexture("image.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);

-- Use the image
Graphics()->TextureSet(TextureID);
Graphics()->QuadsBegin();
[...PAINT...]
Graphics()->QuadsEnd();

-- Unload image from memory
Graphics()->UnloadTexture(TextureID);

With Bam (Automatically the client is responsible for loading and unloading the image in memory):

-- Insert the image in datasrc/content.py:
container.images.Add(Image("mypicture", "image.png"))

-- Use it in code:
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MYPICTURE].m_Id);
Graphics()->QuadsBegin();
[...PAINT...]
Graphics()->QuadsEnd();

11

Re: [HELP]Modify the background

HeroiAmarelo wrote:

Killa, can the delfaut backg. be replaced by a image file, like a png?

Not without modifying the client.


I do not know wrote:
-- Load the image in to memory
int TextureID = Graphics()->LoadTexture("image.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);

As this is C++ you have to use // for comments.
You should not save the texture id to a local variable, as it would be reloaded every tick. Do it like this:

static int TextureID = -1;
if(TextureID == -1)
    TextureID = Graphics()->LoadTexture("image.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);

12

Re: [HELP]Modify the background

I know that I'm reactivating a old topic, sorry for that but...
I'm trying to make what I do not know said using the content.py
I have already written what he said:
"-- Insert the image in datasrc/content.py:
container.images.Add(Image("mypicture", "image.png"))"

And it doesn't work. Anny ideas?!

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

13

Re: [HELP]Modify the background

The newest N-Client had a nice lua for this ))

14

Re: [HELP]Modify the background

Yap, but I need to make it in code to make my client. I just need to make this and I can't!!
Omg. No one help >.<

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

15

Re: [HELP]Modify the background

You have a image call "image.png" in to data folder??

Pls.. copy the code... smile

16

Re: [HELP]Modify the background

Of corse.

File: Menus.cpp
I'v replaced the blob.png by the image that I want to.

int CMenus::DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect)
{
    Graphics()->TextureSet(g_pData->m_aImages[ImageId].m_Id);

Oh Deem! :@
Take the file -> menus.cpp

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

17

Re: [HELP]Modify the background

Why changed the DoButton_Icon function??

See RenderBackground:

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

Change to..

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

18

Re: [HELP]Modify the background

But... Thats the same code...
You have just changed the word blob.png to image.png yikes

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

19 (edited by Sushi Tee 2012-03-27 18:53:02)

Re: [HELP]Modify the background

i would put the image in content.py like every other image too and load it like every other image in code too ^^
its just copy and paste and TextureSet(...)

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

20

Re: [HELP]Modify the background

I wanna try this =o .. good idea

*~°~~°~ Ryomou Wins... Flawless Victory ! ~°~~°~*
Support me: Subscribe!
[Fatality]