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
|
#include <sys/types.h>
#include <SDL.h>
#include <generic.h>
#include <Main.h>
#include <Input.h>
#include <Output.h>
#include "glbase.h"
#include "texture.h"
#include "glfont.h"
#include "glwidgets.h"
#include "engine.h"
#include "glsprite.h"
#include "glshape.h"
CODE_BEGINS
virtual int startup() throw (GeneralException) {
int sx1, sx2, sy1, sy2;
double t = 0;
verbosity = M_INFO;
mogltk::glbase * gl = new mogltk::glbase();
mogltk::glshape * sh = new mogltk::glshape();
new Archive("datas.paq");
mogltk::glfont * font = new mogltk::glfont(&Input("font-2.bin"));
mogltk::Sprite * s = new mogltk::Sprite(&Input("cursor.rgba"), 25, 25);
mogltk::engine::setcursorvisible(true);
mogltk::engine::setappactive(true);
mogltk::texture * mytex = new mogltk::texture(&Input("pattern6.tex"), true);
Color AlphaBlue(AQUA);
AlphaBlue.A = 50;
while (!mogltk::engine::quitrequested()) {
sx1 = 320 + 320 * sin(0.983 * t + 3.15);
sx2 = 320 + 320 * sin(0.537 * t + 5.32);
sy1 = 240 + 240 * sin(0.692 * t + 8.21);
sy2 = 240 + 240 * sin(1.029 * t + 2.42);
gl->Enter2DMode();
sh->tbox(mytex, 50, 50, 561, 561, BLACK, RED, LIME, BLUE);
sh->box(400, 100, 450, 150, BLACK, RED, LIME, BLUE);
sh->box(5, 5, 150, 80, CORNFLOWERBLUE, DEEPSKYBLUE, MIDNIGHTBLUE, NAVY);
font->setshadow(1);
font->putcursor(10, 30);
font->setcolor(WHITE);
font->printf(
"PixelPawa!\n"
"It works!!\n"
"I can't believe it!\n"
);
sh->box3d(50, 150, 150, 200);
sh->obox3d(50, 250, 150, 300);
sh->window(50, 350, 150, 400, "Titre plus beau ;)");
sh->box3d(180, 130, 320, 220);
sh->button(200, 150, 300, 200, "Bouton");
sh->box(MIN(sx1, sx2), MIN(sy1, sy2), MAX(sx1, sx2), MAX(sy1, sy2), AlphaBlue);
font->putcursor(550, 400);
font->printf("FPS: %.2f\n", mogltk::engine::FPS());
font->printf("mx: %i\n", mogltk::engine::mouseX());
font->printf("my: %i\n", mogltk::engine::mouseY());
font->printf("t: %.2fs\n", (double) SDL_GetTicks() / 1000);
s->draw(mogltk::engine::mouseX() - 8, mogltk::engine::mouseY() - 6);
gl->Leave2DMode();
gl->Flip();
t = (double) SDL_GetTicks() / 1000;
}
delete mytex;
return 0;
}
CODE_ENDS
|