-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenemybase.cpp
61 lines (50 loc) · 1.37 KB
/
enemybase.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
/*
* File: enemybase.cpp
* Author: 2019202344
*
* Created on 6 de Dezembro de 2019, 18:16
*/
#include "enemybase.h"
#include <GL/glut.h>
#include "cube.h"
wf_object_t* enemy_base_t::sEnemyModel = NULL;
enemy_base_t::enemy_base_t(point3f position, float radius) :
position(position), radius(radius) {
}
void enemy_base_t::transformAndDraw() {
if (dead) {
return;
}
glPushMatrix();
{
glTranslatef(position.x, position.y, position.z);
drawAxis(radius);
// glRotatef(90, 1, 0, 0);
glScalef(radius, radius, radius);
// glScalef(100, 100, 100);
GLfloat color[] = {1, 0, 0, 1.0f};
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
glRotatef(90, 1, 0, 0);
glColor3f(1, 1, 1);
if (sEnemyModel != NULL) {
sEnemyModel->draw();
} else {
// draw all of the ground enemies in orange (#FFA500)
// glColor3f(0xFF / 255.0, 0xA5 / 255.0, 0x00 / 255.0);
drawCube();
}
}
glPopMatrix();
}
void enemy_base_t::init(wf_object_loader_t& loader) {
sEnemyModel = loader.loadRes("casa");
}
void enemy_base_t::drawMapElement(circle_blueprint_t* blueprint) const {
if (dead) return;
glPushMatrix();
{
glTranslatef(position.x, position.y, 0);
blueprint->draw(true, radius);
}
glPopMatrix();
}