Topic: [HELP]Modify the background
Hello ! how to modify the background ? Please
Thanks for your help
You are not logged in. Please login or register.
Teeworlds Forum → Modifications → [HELP]Modify the background
Hello ! how to modify the background ? Please
Thanks for your help
What background?
The background http://img220.imageshack.us/img220/9466/capturarge.png (the image checkered)
*Sigh* How Many Times...
You Need To Know C++ To Do This, Etc...
I know C++ but i don't find where the good file
where the good file
Where The Good File "Made It's Surprisingly Swift Escape?"
But i'm not expert in C++
The background is rendered in src/game/client/components/menus.cpp in lines 1552 - 1606.
Killa, can the delfaut backg. be replaced by a image file, like a png?
@HeroiAmarelo: Yes you can.. and you can replace it by all you can make
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();
Killa, can the delfaut backg. be replaced by a image file, like a png?
Not without modifying the client.
-- 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);
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?!
The newest N-Client had a nice lua for this ))
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 >.<
You have a image call "image.png" in to data folder??
Pls.. copy the code...
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
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);
But... Thats the same code...
You have just changed the word blob.png to image.png
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(...)
I wanna try this =o .. good idea
Teeworlds Forum → Modifications → [HELP]Modify the background
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.