Commit 61d4b4fe authored by ottona's avatar ottona

pretty all in there, except for points counting:

- guns reloading
- randomized routes for aircraft
- added terrain
- added 3d sounds for flyby
- beautified
parent e67f92d4
# Blender MTL File: 'SU35S.blend'
# Material Count: 36
newmtl Gum
Ns 23.529412
Ka 1.000000 1.000000 1.000000
Kd 0.015136 0.015136 0.015136
Ks 0.021014 0.021014 0.021014
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Killermachine01
Ns 92.156863
Ka 1.000000 1.000000 1.000000
Kd 0.512000 0.512000 0.512000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/FGear.png
newmtl Killermachine01_NONE
Ns 92.156863
Ka 1.000000 1.000000 1.000000
Kd 0.512000 0.512000 0.512000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/FGear.png
newmtl KillermachineSu
Ns 92.156863
Ka 1.000000 1.000000 1.000000
Kd 0.512000 0.512000 0.512000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/FGear.png
newmtl Material_#145
Ns 92.156863
Ka 1.000000 1.000000 1.000000
Kd 0.512000 0.512000 0.512000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/FGear.png
newmtl Steel
Ns 190.196078
Ka 0.200000 0.200000 0.200000
Kd 0.088054 0.088054 0.088054
Ks 0.250000 0.250000 0.250000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 3
map_Kd C:/Users/Psychedelic/Desktop/FGear.png
# Blender MTL File: 'None'
# Material Count: 25
newmtl capony
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -79,7 +14,7 @@ map_Kd C:/Users/Psychedelic/Desktop/Tex_23119_0.png
map_Ks C:/Users/Psychedelic/Desktop/Tex_23119_0.png
newmtl fuse_back
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.510968 0.510968 0.510968
Ks 0.500000 0.500000 0.500000
......@@ -87,20 +22,8 @@ Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex02_2013.bmp.png
map_Ks C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex02_2013.bmp.png
newmtl fuse_back_NONE
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.510968 0.510968 0.510968
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex02_2013.bmp.png
map_Ks C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex02_2013.bmp.png
map_Kd Teschmacher/Su27_tex02_2013.bmp.png
map_Ks Teschmacher/Su27_tex02_2013.bmp.png
newmtl glass
Ns 978.431373
......@@ -114,7 +37,7 @@ illum 2
refl C:/Users/Psychedelic/Desktop/Raptor/cloud2.png
newmtl glass1
Ns 939.215686
Ns 937.254902
Ka 1.000000 1.000000 1.000000
Kd 0.039217 0.045141 0.053445
Ks 1.000000 1.000000 1.000000
......@@ -136,30 +59,8 @@ illum 2
map_Kd C:/Users/Psychedelic/Desktop/Raptor/cloud2.png
refl C:/Users/Psychedelic/Desktop/Raptor/cloud2.png
newmtl gum
Ns 17.647059
Ka 1.000000 1.000000 1.000000
Kd 0.021768 0.021768 0.021768
Ks 0.008694 0.008694 0.008694
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex02_2013.bmp.png
newmtl gum_NONE
Ns 17.647059
Ka 1.000000 1.000000 1.000000
Kd 0.021768 0.021768 0.021768
Ks 0.008694 0.008694 0.008694
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex02_2013.bmp.png
newmtl keel_stab
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -167,11 +68,11 @@ Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex06_2013.bmp.png
map_Ks C:/Users/Psychedelic/Archive/Blender/Air Force (2013) by Teschmacher/Su27_tex06_2013.bmp.png
map_Kd Teschmacher/Su27_tex06_2013.bmp.png
map_Ks Teschmacher/Su27_tex06_2013.bmp.png
newmtl kreslo
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -183,7 +84,7 @@ map_Kd C:/Users/Psychedelic/Archive/Blender/PNG/su-27_k36.bmp.png
map_Ks C:/Users/Psychedelic/Archive/Blender/PNG/su-27_k36.bmp.png
newmtl lamp
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -205,7 +106,7 @@ d 0.700000
illum 2
newmtl misc
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -217,7 +118,7 @@ map_Kd C:/Users/Psychedelic/Desktop/Flanker-E/PNG/su27_tex07.bmp.png
map_Ks C:/Users/Psychedelic/Desktop/Flanker-E/PNG/su27_tex07.bmp.png
newmtl nose
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.242558 0.242558 0.242558
Ks 0.500000 0.500000 0.500000
......@@ -229,7 +130,7 @@ map_Kd C:/Users/Psychedelic/Desktop/Flanker-E/PNG/su27_tex07.bmp.png
map_Ks C:/Users/Psychedelic/Desktop/Flanker-E/PNG/su27_tex07.bmp.png
newmtl nose1
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.510968 0.510968 0.510968
Ks 0.500000 0.500000 0.500000
......@@ -241,7 +142,7 @@ map_Kd C:/Users/Psychedelic/Desktop/Su33_tex01.bmp.png
map_Ks C:/Users/Psychedelic/Desktop/Su33_tex01.bmp.png
newmtl nose1_1
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.513600 0.513600 0.513600
Ks 0.500000 0.500000 0.500000
......@@ -249,11 +150,11 @@ Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd /tmp/Air Force (2013) by Teschmacher/Originals/Su27_tex01_2013.bmp.png
map_Ks /tmp/Air Force (2013) by Teschmacher/Originals/Su27_tex01_2013.bmp.png
map_Kd Teschmacher/Originals/Su27_tex01_2013.bmp.png
map_Ks Teschmacher/Originals/Su27_tex01_2013.bmp.png
newmtl numberL
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.510968 0.510968 0.510968
Ks 0.000000 0.000000 0.000000
......@@ -265,7 +166,7 @@ map_Kd C:/Users/Psychedelic/Archive/Blender/PNG/Su-27_numbers_red.png
map_d C:/Users/Psychedelic/Archive/Blender/PNG/Su-27_numbers_red.png
newmtl numberR
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.510968 0.510968 0.510968
Ks 0.000000 0.000000 0.000000
......@@ -278,7 +179,7 @@ map_Ka C:/Users/Psychedelic/Archive/Blender/PNG/Su-27_numbers_red.png
map_d C:/Users/Psychedelic/Archive/Blender/PNG/Su-27_numbers_red.png
newmtl pilon
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.515325 0.515325 0.515325
Ks 0.500000 0.500000 0.500000
......@@ -290,7 +191,7 @@ map_Kd C:/Users/Psychedelic/Archive/Blender/PNG/su27_pylon.bmp.png
map_Ks C:/Users/Psychedelic/Archive/Blender/PNG/su27_pylon.bmp.png
newmtl pilon2
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -302,7 +203,7 @@ map_Kd C:/Users/Psychedelic/Archive/Blender/PNG/Su27_pylon2.png
map_Ks C:/Users/Psychedelic/Archive/Blender/PNG/Su27_pylon2.png
newmtl pilot
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -339,7 +240,7 @@ map_Ka C:/Users/Psychedelic/Desktop/Flanker-E/PNG/Tex_3306_0.png
map_Ks C:/Users/Psychedelic/Desktop/Flanker-E/PNG/Tex_3306_0.png
newmtl sopla
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.515325 0.515325 0.515325
Ks 0.500000 0.500000 0.500000
......@@ -354,31 +255,7 @@ map_Ks C:/Users/Psychedelic/Archive/Blender/PNG/Su-27_detail.png
map_d C:/Users/Psychedelic/Desktop/Flanker-E/PNG/Su-27_detail_nrm.tif
newmtl vozduh
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.513684 0.513684 0.513684
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/Air Force (2013) by Teschmacher/Su27_tex05_2013.bmp.png
map_Ks C:/Users/Psychedelic/Desktop/Air Force (2013) by Teschmacher/Su27_tex05_2013.bmp.png
newmtl wing_R
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.513684 0.513684 0.513684
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/Flanker-E/Air Force (2013) by Teschmacher/Su27_tex03_2013.bmp.png
map_Ks C:/Users/Psychedelic/Desktop/Flanker-E/Air Force (2013) by Teschmacher/Su27_tex03_2013.bmp.png
newmtl wing_R_FGear.png
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.513684 0.513684 0.513684
Ks 0.500000 0.500000 0.500000
......@@ -386,11 +263,11 @@ Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/FGear.png
map_Ks C:/Users/Psychedelic/Desktop/Flanker-E/Air Force (2013) by Teschmacher/Su27_tex03_2013.bmp.png
map_Kd Teschmacher/Su27_tex05_2013.bmp.png
map_Ks Teschmacher/Su27_tex05_2013.bmp.png
newmtl wing_R_Su27_tex03_2013.bmp.png
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.513684 0.513684 0.513684
Ks 0.500000 0.500000 0.500000
......@@ -398,11 +275,11 @@ Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/Flanker-E/Air Force (2013) by Teschmacher/Su27_tex03_2013.bmp.png
map_Ks C:/Users/Psychedelic/Desktop/Flanker-E/Air Force (2013) by Teschmacher/Su27_tex03_2013.bmp.png
map_Kd Teschmacher/Su27_tex03_2013.bmp.png
map_Ks Teschmacher/Su27_tex03_2013.bmp.png
newmtl wing_l
Ns 96.078431
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
......@@ -410,8 +287,8 @@ Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd C:/Users/Psychedelic/Desktop/Flanker-E/Air Force (2013) by Teschmacher/Su27_tex04_2013.bmp.png
map_Ks C:/Users/Psychedelic/Desktop/Flanker-E/Air Force (2013) by Teschmacher/Su27_tex04_2013.bmp.png
map_Kd Teschmacher/Su27_tex04_2013.bmp.png
map_Ks Teschmacher/Su27_tex04_2013.bmp.png
newmtl wing_r
Ns 92.156863
......
This diff is collapsed.
This diff is collapsed.
#include "Aircraft.hpp"
#include <iostream>
#include <cAudio/cAudio.h>
#include "Globals.hpp"
using namespace irr;
using namespace irr::core;
Aircraft::Aircraft()
Aircraft::Aircraft(const line3df &flightLine, u32 flightTimeMillis)
: flightDuration(flightTimeMillis)
, flightStarted(Globals::getDevice()->getTimer()->getRealTime())
{
model = Globals::getSceneManager()->addMeshSceneNode(Globals::getSceneManager()->getMesh("../res/SU35S.obj"));
model->setPosition(vector3df(25.f, 0.f, 0.f));
a = Globals::getSceneManager()->createFlyStraightAnimator(vector3df(100.f, 100.f, -1000.f),
vector3df(100.f, 100.f, 1000.f),
32000,
false,
false);
a = Globals::getSceneManager()->createFlyStraightAnimator(flightLine.start,
flightLine.end,
flightTimeMillis,
false,
false);
auto dvec = (flightLine.end - flightLine.start).normalize();
f64 rotBy = vector2df(dvec.X, dvec.Z).getAngleTrig();
model->setRotation(vector3df(0.f, -rotBy, 0.f));
model->addAnimator(a);
std::cout << "Aircraft" << std::endl;
flybySound = Globals::getAudioManager()->create("flybySound", "../res/flyby.wav", false);
//std::cout << "Aircraft from " << flightTimeMillis << ' ' << flightLine.start.Y << " to " << flightLine.end.X << ' ' << flightLine.end.Y << " at " << flightLine.start.Z << std::endl;
}
Aircraft::~Aircraft()
{
a->drop();
Globals::getSceneManager()->addToDeletionQueue(model);
std::cout << "~Aircraft" << std::endl;
}
......@@ -55,3 +64,25 @@ bool Aircraft::evalShot(const irr::core::line3df &shotline)
}
return hit;
}
void Aircraft::update(u32 curMS)
{
if (!flybySound->isPlaying())
{
u32 curTime = curMS;
curTime -= flightStarted;
if (curTime > flightDuration / 2 - 4000 && curTime < flightDuration / 2)
{
auto p = model->getAbsolutePosition();
flybySound->play3d(cAudio::cVector3(p.X, p.Y, p.Z));
//std::cout << "PLAY!" << std::endl;
// flybySound->play2d();
}
}
else
{
auto p = model->getAbsolutePosition();
flybySound->move(cAudio::cVector3(p.X, p.Y, p.Z));
}
}
#include <irrlicht.h>
namespace cAudio
{
class IAudioSource;
}
class Aircraft
{
public:
Aircraft();
Aircraft(const irr::core::line3df &flightLine, irr::u32 flightTimeMillis);
~Aircraft();
bool evalShot(const irr::core::line3df&);
bool isGood() const;
bool isTerminated() const;
void update(irr::u32 curMS);
private:
Aircraft();
irr::scene::IMeshSceneNode *model;
irr::scene::ISceneNodeAnimator *a;
bool healthy;
class cAudio::IAudioSource* flybySound;
irr::u32 flightDuration, flightStarted;
};
......@@ -3,6 +3,7 @@
#include "Aircraft.hpp"
using namespace irr;
using namespace irr::core;
Dispatcher::Dispatcher()
: active(false)
......@@ -27,15 +28,15 @@ void Dispatcher::execute()
if (active && (curTime - lastDispatchMS) > 10000)
{
auto a = std::make_shared<Aircraft>();
aircrafts.push_back(a);
dispatchAircraft();
lastDispatchMS = curTime;
}
//cleanup
// loopdidoo & cleanup
auto a = aircrafts.begin();
while (a < aircrafts.end())
{
(*a)->update(curTime);
if ((*a)->isTerminated())
{
a = aircrafts.erase(a);
......@@ -68,3 +69,24 @@ bool Dispatcher::evalShot(const core::line3df& l)
return ret;
}
void Dispatcher::dispatchAircraft()
{
IRandomizer *rand = Globals::getDevice()->getRandomizer();
// rand dir vector around 0/0
vector2df dVec(1.f, 0.f);
dVec.rotateBy(rand->frand() * 360.f, vector2df(0.f, 0.f));
dVec.normalize();
vector2df nVec(dVec.Y, -dVec.X);
f32 d = rand->frand() * 500.f;
f32 alt = 50.f + rand->frand() * 500.f;
// start/end 2km off our pos, displaced by d * nVec to the side
vector2df start = dVec * -2000.f + nVec * d;
vector2df end = dVec * 2000.f + nVec * d;
line3df l;
l.start = vector3df(start.X, alt, start.Y);
l.end = vector3df(end.X, alt, end.Y);
aircrafts.push_back(std::make_shared<Aircraft>(l, 30000 + static_cast<u32>(rand->frand() * 30000.f)));
}
......@@ -21,4 +21,5 @@ private:
Aircrafts aircrafts;
bool active;
void dispatchAircraft();
};
......@@ -14,8 +14,10 @@ using namespace irr::core;
FireUnit::FireUnit()
: aziTurnCoeffSmooth(0.f)
, elevTurnCoeffSmooth(0.f)
, flashCount(0)
, fireCount(0)
, fireBtnPressed(false)
, stripsRemaining(5)
, reloading(false)
{
turretAzimuth = Globals::getSceneManager()->addEmptySceneNode();
turretElevation = Globals::getSceneManager()->addMeshSceneNode(Globals::getSceneManager()->getMesh("../res/guns.obj"), turretAzimuth);
......@@ -71,19 +73,13 @@ bool FireUnit::OnEvent(const SEvent& e)
{
if (!fireBtnPressed)
{
shotline.start = cam->getAbsolutePosition();
shotline.end = cam->getTarget() - shotline.start;
shotline.end.normalize();
shotline.end *= 4000.f;
fireSound->play2d();
/*vector3df lineEnd = cam->getTarget();
lineEnd.normalize();
lineEnd += 4000.f;
shotline.end = shotline.start + lineEnd;*/
Globals::getDispatcher()->evalShot(shotline);
if (!reloading && stripsRemaining > 0 && fireCount == 0)
{
fireSound->play2d();
fireCount = 16;
stripsRemaining--;
}
fireBtnPressed = true;
flashCount = 16;
}
}
else
......@@ -93,7 +89,11 @@ bool FireUnit::OnEvent(const SEvent& e)
if (e.JoystickEvent.IsButtonPressed(2))
{
// sec trigger pressed
if (!reloading)
{
reloadUntil = Globals::getDevice()->getTimer()->getRealTime() + 15000;
reloading = true;
}
}
else
{
......@@ -128,6 +128,16 @@ bool FireUnit::OnEvent(const SEvent& e)
return false;
}
u32 FireUnit::getRoundsRemaining() const
{
return stripsRemaining * 16 + fireCount;
}
bool FireUnit::isReloading() const
{
return reloading;
}
void FireUnit::draw()
{
......@@ -146,11 +156,17 @@ void FireUnit::draw()
matA.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
drv->setMaterial(matA);
if (flashCount > 0)
if (fireCount > 0)
{
mflashL->setVisible(flashCount % 4 == 2);
mflashR->setVisible(flashCount % 4 == 0);
flashCount--;
shotline.start = cam->getAbsolutePosition();
shotline.end = cam->getTarget() - shotline.start;
shotline.end.normalize();
shotline.end *= 4000.f;
Globals::getDispatcher()->evalShot(shotline);
mflashL->setVisible(fireCount % 4 == 2);
mflashR->setVisible(fireCount % 4 == 0);
fireCount--;
}
else
{
......@@ -158,6 +174,14 @@ void FireUnit::draw()
mflashR->setVisible(false);
}
if (reloading)
{
if (Globals::getDevice()->getTimer()->getRealTime() > reloadUntil)
{
reloading = false;
stripsRemaining = 5;
}
}
//drv->draw3DLine(shotline.start, shotline.end);
//cout << tgt.X << ' ' << tgt.Y << ' ' << tgt.Z << endl;
}
......@@ -15,6 +15,8 @@ public:
~FireUnit();
bool OnEvent(const irr::SEvent&);
irr::u32 getRoundsRemaining() const;
bool isReloading() const;
void draw();
private:
......@@ -26,8 +28,11 @@ private:
irr::core::line3df shotline;
irr::scene::IBillboardSceneNode *mflashL, *mflashR;
irr::u32 flashCount;
irr::u32 fireCount;
bool fireBtnPressed;
irr::u32 stripsRemaining;
bool reloading;
irr::u32 reloadUntil;
class cAudio::IAudioSource* fireSound;
};
......
......@@ -24,6 +24,14 @@ FlaSimApp::FlaSimApp()
drv->getTexture("../res/sky0.jpg"),
drv->getTexture("../res/sky2.jpg")
);
auto t = sman->addTerrainSceneNode("../res/heightmap.png");
t->setScale(vector3df(1.f, .1f, 1.f));
auto move = t->getTerrainCenter();
move.Y += 10.f;
t->setPosition(-move);
t->setMaterialFlag(EMF_FOG_ENABLE, true);
t->setMaterialTexture(0, drv->getTexture("../res/detailmap.png"));
drv->setFog(video::SColor(0, 99, 122, 193), EFT_FOG_EXP, 100.f, 300.f);
scene::ILightSceneNode *sun = sman->addLightSceneNode();
sun->setLightType(ELT_DIRECTIONAL);
......@@ -96,4 +104,11 @@ void FlaSimApp::drawScreenSpace()
drv->draw3DLine(vector3df(0.f, 0.f, 0.f), vector3df(1.f, 0.f, 0.f), video::SColor(255, 255, 0, 0));
drv->draw3DLine(vector3df(0.f, 0.f, 0.f), vector3df(0.f, 1.f, 0.f), video::SColor(255, 0, 255, 0));
drv->draw3DLine(vector3df(0.f, 0.f, 0.f), vector3df(0.f, 0.f, 1.f), video::SColor(255, 0, 0, 255));
core::stringw info = L"RNDS REMAIN: ";
if (fireUnit.isReloading())
info += L"[RELOADING]";
else
info += fireUnit.getRoundsRemaining();
Globals::getFont()->draw(info, core::recti(10, 10, 100, 100), video::SColor(255, 255, 255, 255));
}
......@@ -15,6 +15,7 @@ Globals::Globals()
sman = dev->getSceneManager();
dispatcher = new Dispatcher();
audioManager = cAudio::createAudioManager(true);
font = dev->getGUIEnvironment()->getFont("../res/fontlucida.png");
}
Globals::~Globals()
......@@ -69,3 +70,11 @@ Dispatcher* Globals::getDispatcher()
return instance->dispatcher;
}
gui::IGUIFont *Globals::getFont()
{
if (!instance)
instance = new Globals();
return instance->font;
}
......@@ -18,6 +18,10 @@ namespace irr
{
class IVideoDriver;
}
namespace gui
{
class IGUIFont;
}
}
......@@ -29,6 +33,7 @@ public:
static class irr::video::IVideoDriver* getVideoDriver();
static cAudio::IAudioManager* getAudioManager();
static class Dispatcher* getDispatcher();
static class irr::gui::IGUIFont *getFont();
static void shutdown();
......@@ -42,5 +47,6 @@ private:
class irr::video::IVideoDriver* drv;
class cAudio::IAudioManager *audioManager;
class Dispatcher *dispatcher;
class irr::gui::IGUIFont *font;
};
#endif // GLOBALS_HPP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment