Topic: [HELP] Add data files
How to add some data files like tetures and sounds ? just need to edit content.py or need to edit client_data.cpp, too ?
You are not logged in. Please login or register.
Teeworlds Forum → Development → [HELP] Add data files
How to add some data files like tetures and sounds ? just need to edit content.py or need to edit client_data.cpp, too ?
For images you can use content.py or load directly in source code... but with sounds the best way is use content.py
you can use content.py:
container.images.Add(Image("myimage", "myimage.png"))
container.sounds.Add(SoundSet("mysound", ["mysound.wv"]))
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MYIMAGE].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1,1,1,1);
IGraphics::CQuadItem QuadItem(<POSX>,<POSY>,<WIDTH>,<HEIGHT>);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
m_pClient->m_pSounds->PlayAt(<CHANNEL>, SOUND_MYSOUND, 1.0f, <VEC2 POS>);
m_pClient->m_pSounds->Play(<CHANNEL>, SOUND_MYSOUND, 1.0f);
**CHANNELS:
CHN_GUI
CHN_MUSIC
CHN_WORLD
CHN_GLOBAL
Or you can load it in-game:
int m_MyImageID = Graphics()->LoadTexture("myimage.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
Graphics()->TextureSet(m_MyImageID);
Graphics()->QuadsBegin();
Graphics()->SetColor(1,1,1,1);
IGraphics::CQuadItem QuadItem(<POSX>,<POSY>,<WIDTH>,<HEIGHT>);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
Graphics()->UnloadTexture(m_MyImageID);
m_MyImageID = -1;
I know them.but Do I need to add enums like SOUND_MYSOUND in client_data.h ?
When you use content.py, bam generate some files and you not need define "SOUND_MYSOUND"
Thanks a lot
Teeworlds Forum → Development → [HELP] Add data files
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.