runtime/gfx: Fix linking, update code to C++11 and formatting
This commit is contained in:
+18
-14
@@ -1,7 +1,11 @@
|
||||
|
||||
#include "gxgraphics.hpp"
|
||||
#include "gxruntime.hpp"
|
||||
#include "std.hpp"
|
||||
#include "gxcanvas.hpp"
|
||||
#include "gxmesh.hpp"
|
||||
#include "gxfont.hpp"
|
||||
#include "gxscene.hpp"
|
||||
|
||||
#include <stdutil.hpp>
|
||||
|
||||
extern gxRuntime* gx_runtime;
|
||||
|
||||
@@ -52,7 +56,7 @@ gxGraphics::~gxGraphics()
|
||||
while (canvas_set.size())
|
||||
freeCanvas(*canvas_set.begin());
|
||||
|
||||
set<string>::iterator it;
|
||||
std::set<std::string>::iterator it;
|
||||
for (it = font_res.begin(); it != font_res.end(); ++it)
|
||||
RemoveFontResource((*it).c_str());
|
||||
font_res.clear();
|
||||
@@ -104,13 +108,13 @@ bool gxGraphics::restore()
|
||||
dirDraw->RestoreAllSurfaces();
|
||||
|
||||
//restore all canvases
|
||||
set<gxCanvas*>::iterator it;
|
||||
std::set<gxCanvas*>::iterator it;
|
||||
for (it = canvas_set.begin(); it != canvas_set.end(); ++it) {
|
||||
(*it)->restore();
|
||||
}
|
||||
|
||||
//restore all meshes (b3d surfaces)
|
||||
set<gxMesh*>::iterator mesh_it;
|
||||
std::set<gxMesh*>::iterator mesh_it;
|
||||
for (mesh_it = mesh_set.begin(); mesh_it != mesh_set.end(); ++mesh_it) {
|
||||
(*mesh_it)->restore();
|
||||
}
|
||||
@@ -173,7 +177,7 @@ int gxGraphics::getAvailVidmem() const
|
||||
return caps.dwVidMemFree;
|
||||
}
|
||||
|
||||
gxMovie* gxGraphics::openMovie(const string& file, int flags)
|
||||
gxMovie* gxGraphics::openMovie(const std::string& file, int flags)
|
||||
{
|
||||
/*IAMMultiMediaStream *iam_stream;
|
||||
|
||||
@@ -226,7 +230,7 @@ gxCanvas* gxGraphics::createCanvas(int w, int h, int flags)
|
||||
return c;
|
||||
}
|
||||
|
||||
gxCanvas* gxGraphics::loadCanvas(const string& f, int flags)
|
||||
gxCanvas* gxGraphics::loadCanvas(const std::string& f, int flags)
|
||||
{
|
||||
IDirectDrawSurface7* s = ddUtil::loadSurface(f, flags, this);
|
||||
if (!s)
|
||||
@@ -262,16 +266,16 @@ int gxGraphics::getDepth() const
|
||||
return front_canvas->getDepth();
|
||||
}
|
||||
|
||||
gxFont* gxGraphics::loadFont(const string& f, int height, int flags)
|
||||
gxFont* gxGraphics::loadFont(const std::string& f, int height, int flags)
|
||||
{
|
||||
int bold = flags & gxFont::FONT_BOLD ? FW_BOLD : FW_REGULAR;
|
||||
int italic = flags & gxFont::FONT_ITALIC ? 1 : 0;
|
||||
int underline = flags & gxFont::FONT_UNDERLINE ? 1 : 0;
|
||||
int strikeout = 0;
|
||||
|
||||
string t;
|
||||
std::string t;
|
||||
int n = f.find('.');
|
||||
if (n != string::npos) {
|
||||
if (n != std::string::npos) {
|
||||
t = fullfilename(f);
|
||||
if (!font_res.count(t) && AddFontResource(t.c_str()))
|
||||
font_res.insert(t);
|
||||
@@ -459,7 +463,7 @@ static int cntBits(int mask)
|
||||
return n;
|
||||
}
|
||||
|
||||
static vector<TexFmt> tex_fmts;
|
||||
static std::vector<TexFmt> tex_fmts;
|
||||
|
||||
static HRESULT CALLBACK enumTextureFormat(DDPIXELFORMAT* fmt, void* p)
|
||||
{
|
||||
@@ -474,9 +478,9 @@ static HRESULT CALLBACK enumTextureFormat(DDPIXELFORMAT* fmt, void* p)
|
||||
return D3DENUMRET_OK;
|
||||
}
|
||||
|
||||
static string itobin(int n)
|
||||
static std::string itobin(int n)
|
||||
{
|
||||
string t;
|
||||
std::string t;
|
||||
for (int k = 0; k < 32; n <<= 1, ++k) {
|
||||
t += (n & 0x80000000) ? '1' : '0';
|
||||
}
|
||||
@@ -485,7 +489,7 @@ static string itobin(int n)
|
||||
|
||||
static void debugPF(const DDPIXELFORMAT& pf)
|
||||
{
|
||||
string t;
|
||||
std::string t;
|
||||
t = "Bits:" + itoa(pf.dwRGBBitCount);
|
||||
gx_runtime->debugLog(t.c_str());
|
||||
t = "R Mask:" + itobin(pf.dwRBitMask);
|
||||
|
||||
Reference in New Issue
Block a user