1

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 ?

2

Re: [HELP] Add data files

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;

3

Re: [HELP] Add data files

I know them.but Do I need to add enums like SOUND_MYSOUND in client_data.h ?

4

Re: [HELP] Add data files

When you use content.py, bam generate some files and you not need define "SOUND_MYSOUND"

5

Re: [HELP] Add data files

Thanks a lot smile