summaryrefslogtreecommitdiff
path: root/src/test.cc
blob: b09c00d959f2b163ee4359ab1cdafeea9dac268c (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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <sys/types.h>
#include <SDL.h>
#include <generic.h>
#include <Main.h>
#include <Input.h>
#include "glbase.h"
#include "gltexture.h"
#include "glfont.h"
#include "engine.h"
#include "sprite.h"

CODE_BEGINS
virtual int startup() throw (GeneralException) {
    verbosity = M_INFO;
    mogltk::glbase::setup();
//    new Archive("datas.paq");
    Input * fonte = new Input("font-2.bin");
    mogltk::font font(fonte);
    delete fonte;
    Input * cursor = new Input("cursor.rgba");
    printm(M_INFO, "Sprite file size: %i\n", cursor->GetSize());
    mogltk::Sprite * s = new mogltk::Sprite(cursor, 25, 25);
    delete cursor;
    
    verbosity = M_INFO;
    
    Input * pattern = new Input("pattern6.tex");
    mogltk::texture * mytex = new mogltk::texture(pattern, true);
    delete pattern;
    
//    mogltk::engine::setappactive(true);

    while (!mogltk::engine::quitrequested()) {
	mogltk::glbase::Enter2DMode();
	
	mytex->Bind();
	glBegin(GL_TRIANGLE_STRIP);
	glColor3d(0, 0, 0);
	glTexCoord2i(0, 0);
	glVertex2f(50, 50);
	glColor3d(1, 0, 0);
        glTexCoord2i(511, 0);
	glVertex2f(561, 50);
	glColor3d(0, 1, 0);
	glTexCoord2i(0, 511);
	glVertex2f(50, 561);
	glColor3d(0, 0, 1);
	glTexCoord2i(511, 511);
	glVertex2f(561, 561);
	glEnd();
    
	mogltk::texture::Unbind();
	glBegin(GL_TRIANGLE_STRIP);
	glColor3d(0, 0, 0);
	glVertex2f(400, 100);
	glColor3d(1, 0, 0);
	glVertex2f(450, 100);
	glColor3d(0, 1, 0);
	glVertex2f(400, 150);
	glColor3d(0, 0, 1);
	glVertex2f(450, 150);
	glEnd();
    

	glBegin(GL_TRIANGLE_STRIP);
	CORNFLOWERBLUE.Bind();
	glVertex2f(  5,  5);
	DEEPSKYBLUE.Bind();
	glVertex2f(150,  5);
	MIDNIGHTBLUE.Bind();
	glVertex2f(  5, 80);
	NAVY.Bind();
	glVertex2f(150, 80);
	glEnd();
	font.setshadow(1);
	font.putcursor(10, 30);
	font.setcolor(WHITE);
	font.printf(
	    "PixelPawa!\n"
	    "It works!!\n"
	    "I can't believe it!\n"
	);
	
	s->draw( 50,  50);
	s->draw(100,  50);
	s->draw(150,  50);
	s->draw(200,  50);
	s->draw( 50, 100);
	s->draw(100, 100);
	s->draw(150, 100);
	s->draw(200, 100);
	s->draw( 50, 150);
	s->draw(100, 150);
	s->draw(150, 150);
	s->draw(200, 150);
	s->draw( 50, 200);
	s->draw(100, 200);
	s->draw(150, 200);
	s->draw(200, 200);

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