summaryrefslogtreecommitdiff
path: root/src/test.cc
blob: 55b4a14a2c0db7e3835421eacf9e1cb369c77d9a (plain)
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
#include <sys/types.h>
#include <SDL.h>
#include <generic.h>
#include <Main.h>
#include <Input.h>
#include <Output.h>
#include "glbase.h"
#include "gltexture.h"
#include "glfont.h"
#include "glwidgets.h"
#include "engine.h"
#include "sprite.h"
#include "glshape.h"

CODE_BEGINS
virtual int startup() throw (GeneralException) {
    verbosity = M_INFO;
    mogltk::glbase::setup();
    new Archive("datas.paq");
    mogltk::font font(&Input("font-2.bin"));
    mogltk::Sprite * s = new mogltk::Sprite(&Input("cursor.rgba"), 25, 25);
    
    mogltk::engine::setcursorvisible(true);
    mogltk::engine::setappactive(true);
    
    Input * pattern = new Input("pattern6.tex");
    mogltk::texture * mytex = new mogltk::texture(pattern, true);
    delete pattern;

    while (!mogltk::engine::quitrequested()) {
	mogltk::glbase::Enter2DMode();

	mogltk::shape::tbox(mytex, 50, 50, 561, 561, BLACK, RED, LIME, BLUE);
	mogltk::shape::box(400, 100, 450, 150, BLACK, RED, LIME, BLUE);    

	mogltk::shape::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"
	);

	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());

	s->draw(mogltk::engine::mouseX() - 8, mogltk::engine::mouseY() - 6);

	mogltk::glbase::Leave2DMode();
	mogltk::glbase::Flip();
    }
    
    delete mytex;
    
    return 0;
}
CODE_ENDS