forked from imoital/CastleBlast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartScreen.cpp
More file actions
82 lines (66 loc) · 2.18 KB
/
StartScreen.cpp
File metadata and controls
82 lines (66 loc) · 2.18 KB
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
//
// StartScreen.cpp
// CastleBlast
//
// Created by Inês on 12/4/11.
// Copyright 2011 AVT. All rights reserved.
//
#include "StartScreen.h"
#include "Loader.h"
namespace CastleBlast {
StartScreen::StartScreen()
{
#ifdef __APPLE__
_startScreenImage = Loader::loadTexture("Images/StartScreen.png");
#else
_startScreenImage = Loader::loadTexture("..\\..\\src\\Images\\StartScreen.png");
#endif
}
StartScreen::~StartScreen() {}
void StartScreen::init()
{
cg::tWindowInfo win = cg::Manager::instance()->getApp()->getWindowInfo();
_width = win.width;
_height = win.height;
}
void StartScreen::draw()
{
glBindTexture(GL_TEXTURE_2D, _startScreenImage);
glDisable(GL_DEPTH_TEST); // Disables Depth Testing
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPushMatrix(); // Store The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
glOrtho(0,_width,0,_height,-1,1); // Set Up An Ortho Screen
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPushMatrix(); // Store The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
glDisable(GL_LIGHTING);
glColor3d(1, 1, 1);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
{
glTexCoord2d(0, 0);
glVertex2d(0, 0);
glTexCoord2d(0, 1);
glVertex2d(0, _height);
glTexCoord2d(1, 1);
glVertex2d(_width, _height);
glTexCoord2d(1, 0);
glVertex2d(_width, 0);
}
glEnd();
glDisable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPopMatrix(); // Restore The Old Projection Matrix
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPopMatrix(); // Restore The Old Projection Matrix
glEnable(GL_DEPTH_TEST);
}
void StartScreen::update(unsigned long elapsed_millis) {}
void StartScreen::onReshape(int width, int height)
{
_width = width;
_height = height;
}
}