Add health/xp/level interface
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
#include "Cursor.h"
|
||||
#include <GL\freeglut.h>
|
||||
#include <cmath>
|
||||
#include "CrystalPoint.h"
|
||||
|
||||
Cursor* Cursor::instance = NULL;
|
||||
|
||||
Cursor::Cursor()
|
||||
{
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
Cursor::~Cursor()
|
||||
{
|
||||
}
|
||||
|
||||
Cursor* Cursor::getInstance(void)
|
||||
{
|
||||
if (instance == nullptr)
|
||||
instance = new Cursor();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void Cursor::enable(bool enable)
|
||||
{
|
||||
enabled = enable;
|
||||
}
|
||||
|
||||
bool Cursor::isEnabled(void)
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void Cursor::draw(void)
|
||||
{
|
||||
//Draw Cursor
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, CrystalPoint::width, CrystalPoint::height, 0, -10, 10);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glColor4f(1, cos(glutGet(GLUT_ELAPSED_TIME) / 1000.0f), sin(glutGet(GLUT_ELAPSED_TIME) / 1000.0f), 1);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex2f(mousePosition.x, mousePosition.y);
|
||||
glVertex2f(mousePosition.x + 15, mousePosition.y + 15);
|
||||
glVertex2f(mousePosition.x + 5, mousePosition.y + 20);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void Cursor::update(Vec2f newPosition)
|
||||
{
|
||||
mousePosition = newPosition;
|
||||
}
|
||||
Reference in New Issue
Block a user