#1
utilisation:
les coordonnées sont non uniforme, il faut utilise un cosinus pour avoir des coodonée polaire,
sinon les % peuvent avoir un rendue différents
26-03-2016 19:23:47
- Magun
- Administrateurs

- Date d'inscription:
- Messages: 910
- IP: 37.59.116.104
- Courriel Site web
YO!
j'en avais parler il y a un certain temps et je n'avais pas eu le temps de le poster ici depuis
du coup voila !

CGUIPieChart.hCGUIPieChart.cpp
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
utilisation:
Code c++ :
#include <irrlicht.h>
#include "CGUIPieChart.h"
#include "driverChoice.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
int main()
{
SIrrlichtCreationParameters cp;
cp.AntiAlias = 4;
cp.Bits = 32;
cp.DriverType = video::EDT_OPENGL;
cp.Vsync = true;
cp.WindowSize = core::dimension2d<u32>(128, 128);
IrrlichtDevice * device = createDeviceEx(cp);
device->setWindowCaption(L"Irrlicht Engine - User Interface Demo");
device->setResizable(true);
video::IVideoDriver* driver = device->getVideoDriver();
IGUIEnvironment* env = device->getGUIEnvironment();
/**********************************************/
CGUIPieChart *test = new CGUIPieChart(env, env->getRootGUIElement(), {0,0,0,0});
test->setBackgroundTexture(driver->getTexture("bg.png"));
test->setForegroundTexture(driver->getTexture("bg.png"));
// test->add({0.000f, 0.458f, {128, 255, 0, 0}});
test->add({0.458f, 0.541f, {255, 255, 128, 0}});
test->add({0.541f, 0.624f, {255, 255, 255, 0}});
test->add({0.624f, 0.707f, {255, 0, 0, 255}});
test->add({0.707f, 1.000f, {255, 255, 0, 255}});
/**********************************************/
while(device->run())
{
if(device->isWindowActive())
{
driver->beginScene(true, true, SColor(0,0,50,50));
env->drawAll();
test->setRelativePosition({
5, 5,
(s32)driver->getScreenSize().Width - 5,
(s32)driver->getScreenSize().Height - 5
});
driver->endScene();
}
}
device->drop();
return 0;
}
les coordonnées sont non uniforme, il faut utilise un cosinus pour avoir des coodonée polaire,
sinon les % peuvent avoir un rendue différents
Hors ligne



