runtime/gfx: Fix linking, update code to C++11 and formatting

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2019-01-18 19:05:43 +01:00
parent 420744efd4
commit 077776b704
42 changed files with 227 additions and 324 deletions
+8 -9
View File
@@ -40,18 +40,17 @@ add_library(${PROJECT_NAME} STATIC
"gxsound.cpp" "gxsound.cpp"
"gxtimer.hpp" "gxtimer.hpp"
"gxtimer.cpp" "gxtimer.cpp"
"std.hpp"
"std.cpp"
) )
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
PRIVATE stdutil
stdutil shell32
PUBLIC winmm
shell32 ${fmod_LIBRARIES}
winmm ${FreeImage_LIBRARIES}
${fmod_LIBRARIES} ddraw
${FreeImage_LIBRARIES} dxguid
dinput8
) )
target_include_directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME}
+2 -7
View File
@@ -4,14 +4,11 @@
// testroutine for asmcoder class // testroutine for asmcoder class
// see asmcoder.h for readme // see asmcoder.h for readme
#define WIN32_LEAN_AND_MEAN #include "asmcoder.hpp"
#include <windows.h> #include <Windows.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include "asmcoder.hpp"
void(__fastcall* plot)(void* s, int argb); void(__fastcall* plot)(void* s, int argb);
int(__fastcall* point)(void* s); int(__fastcall* point)(void* s);
void(__fastcall* span)(void* s, int* argb, int n); void(__fastcall* span)(void* s, int* argb, int n);
@@ -63,8 +60,6 @@ void main()
return; return;
} }
// void (__fastcall *plot)(int x,int y,int argb,Surface *s)=(void (__fastcall *)(int,int,int,Surface*))code;
void ortest() void ortest()
{ {
__asm { __asm {
+1 -4
View File
@@ -43,8 +43,7 @@ ToDo:
*/ */
#ifndef ASMCODER_H #pragma once
#define ASMCODER_H
class IA32 { class IA32 {
public: public:
@@ -524,5 +523,3 @@ class AsmCoder : IA32 {
return off; return off;
} }
}; };
#endif
+24 -25
View File
@@ -1,12 +1,11 @@
#include "ddutil.hpp" #include "ddutil.hpp"
#include "GraphicsRuntime.hpp" #include "graphicsruntime.hpp"
#include "asmcoder.hpp" #include "asmcoder.hpp"
#include "gxcanvas.hpp" #include "gxcanvas.hpp"
#include "gxruntime.hpp" #include "gxruntime.hpp"
#include "std.hpp" #include "gxgraphics.hpp"
#define FREEIMAGE_LIB //#define FREEIMAGE_LIB
#include <freeimage.h> #include <freeimage.h>
extern gxRuntime* gx_runtime; extern gxRuntime* gx_runtime;
@@ -100,7 +99,7 @@ static void adjustTexSize(int* width, int* height, IDirect3DDevice7* dir3dDev, b
} }
//check aspect ratio //check aspect ratio
if (max = ddDesc.dwMaxTextureAspectRatio) { if ((max = ddDesc.dwMaxTextureAspectRatio) && max > 0) {
int asp = w > h ? w / h : h / w; int asp = w > h ? w / h : h / w;
if (asp > max) { if (asp > max) {
if (w > h) if (w > h)
@@ -267,33 +266,33 @@ void ddUtil::buildMipMaps(IDirectDrawSurface7* surf)
} }
} }
void ddUtil::copy(IDirectDrawSurface7* dest, int dx, int dy, int dw, int dh, IDirectDrawSurface7* src, int sx, int sy, void ddUtil::copy(IDirectDrawSurface7* dst_surface, int dx, int dy, int dw, int dh, IDirectDrawSurface7* src_surface,
int sw, int sh) int sx, int sy, int sw, int sh)
{ {
DDSURFACEDESC2 src_desc = {sizeof(src_desc)}; DDSURFACEDESC2 src_desc = {sizeof(src_desc)};
src->Lock(0, &src_desc, DDLOCK_WAIT, 0); src_surface->Lock(0, &src_desc, DDLOCK_WAIT, 0);
PixelFormat src_fmt(src_desc.ddpfPixelFormat); PixelFormat src_format(src_desc.ddpfPixelFormat);
unsigned char* src_p = (unsigned char*)src_desc.lpSurface; unsigned char* src_memory = (unsigned char*)src_desc.lpSurface;
src_p += src_desc.lPitch * sy + src_fmt.getPitch() * sx; src_memory += src_desc.lPitch * sy + src_format.getPitch() * sx;
DDSURFACEDESC2 dest_desc = {sizeof(dest_desc)}; DDSURFACEDESC2 dst_desc = {sizeof(dst_desc)};
dest->Lock(0, &dest_desc, DDLOCK_WAIT, 0); dst_surface->Lock(0, &dst_desc, DDLOCK_WAIT, 0);
PixelFormat dest_fmt(dest_desc.ddpfPixelFormat); PixelFormat dst_format(dst_desc.ddpfPixelFormat);
unsigned char* dest_p = (unsigned char*)dest_desc.lpSurface; unsigned char* dst_memory = (unsigned char*)dst_desc.lpSurface;
dest_p += dest_desc.lPitch * dy + dest_fmt.getPitch() * dx; dst_memory += dst_desc.lPitch * dy + dst_format.getPitch() * dx;
for (int y = 0; y < dh; ++y) { for (int y = 0; y < dh; ++y) {
unsigned char* dest = dest_p; unsigned char* dst = dst_memory;
unsigned char* src = src_p + src_desc.lPitch * (y * sh / dh); unsigned char* src = src_memory + src_desc.lPitch * (y * sh / dh);
for (int x = 0; x < dw; ++x) { for (int x = 0; x < dw; ++x) {
dest_fmt.setPixel(dest, src_fmt.getPixel(src + src_fmt.getPitch() * (x * sw / dw))); dst_format.setPixel(dst, src_format.getPixel(src + src_format.getPitch() * (x * sw / dw)));
dest += dest_fmt.getPitch(); dst += dst_format.getPitch();
} }
dest_p += dest_desc.lPitch; dst_memory += dst_desc.lPitch;
} }
src->Unlock(0); src_surface->Unlock(0);
dest->Unlock(0); dst_surface->Unlock(0);
} }
IDirectDrawSurface7* ddUtil::createSurface(int w, int h, int flags, gxGraphics* gfx) IDirectDrawSurface7* ddUtil::createSurface(int w, int h, int flags, gxGraphics* gfx)
@@ -524,7 +523,7 @@ IDirectDrawSurface7* loadDXTC(const char* filename, gxGraphics* gfx)
IDirectDrawSurface7* ddUtil::loadSurface(const std::string& f, int flags, gxGraphics* gfx) IDirectDrawSurface7* ddUtil::loadSurface(const std::string& f, int flags, gxGraphics* gfx)
{ {
int i = f.find(".dds"); int i = f.find(".dds");
if (i != string::npos && i + 4 == f.size()) { if (i != std::string::npos && i + 4 == f.size()) {
//dds file! //dds file!
IDirectDrawSurface7* surf = loadDXTC(f.c_str(), gfx); IDirectDrawSurface7* surf = loadDXTC(f.c_str(), gfx);
return surf; return surf;
@@ -534,7 +533,7 @@ IDirectDrawSurface7* ddUtil::loadSurface(const std::string& f, int flags, gxGrap
FREE_IMAGE_FORMAT fmt = FreeImage_GetFileType(f.c_str(), f.size()); FREE_IMAGE_FORMAT fmt = FreeImage_GetFileType(f.c_str(), f.size());
if (fmt == FIF_UNKNOWN) { if (fmt == FIF_UNKNOWN) {
int n = f.find("."); int n = f.find(".");
if (n == string::npos) if (n == std::string::npos)
return 0; return 0;
fmt = FreeImage_GetFileType(f.c_str()); fmt = FreeImage_GetFileType(f.c_str());
if (fmt == FIF_UNKNOWN) if (fmt == FIF_UNKNOWN)
+3 -7
View File
@@ -1,8 +1,6 @@
#pragma once
#ifndef DDUTIL_H #include <string>
#define DDUTIL_H #include "graphicsruntime.hpp"
#include "GraphicsRuntime.hpp"
class gxGraphics; class gxGraphics;
@@ -64,5 +62,3 @@ class PixelFormat {
return point(p); return point(p);
} }
}; };
#endif
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once #pragma once
#include <windows.h> #include <Windows.h>
// Direct Draw // Direct Draw
#define DIRECTDRAW_VERSION 0x0700 #define DIRECTDRAW_VERSION 0x0700
+22 -13
View File
@@ -1,7 +1,15 @@
#include "gxaudio.hpp" #include "gxaudio.hpp"
#include "gxchannel.hpp"
#include "gxsound.hpp"
#include <set>
#include <vector>
#include <map>
#include <stdutil.hpp>
extern "C" {
#include <fmod.h> #include <fmod.h>
#include "std.hpp" }
struct StaticChannel : public gxChannel { struct StaticChannel : public gxChannel {
virtual void play() = 0; virtual void play() = 0;
@@ -162,13 +170,13 @@ struct MusicChannel : public StaticChannel {
FMUSIC_MODULE* module; FMUSIC_MODULE* module;
}; };
static set<gxSound*> sound_set; static std::set<gxSound*> sound_set;
static vector<gxChannel*> channels; static std::vector<gxChannel*> channels;
static map<string, StaticChannel*> songs; static std::map<std::string, StaticChannel*> songs;
static CDChannel* cdChannel; static CDChannel* cdChannel;
static int next_chan; static int next_chan;
static vector<SoundChannel*> soundChannels; static std::vector<SoundChannel*> soundChannels;
static gxChannel* allocSoundChannel(int n) static gxChannel* allocSoundChannel(int n)
{ {
@@ -245,7 +253,7 @@ void gxAudio::pause() {}
void gxAudio::resume() {} void gxAudio::resume() {}
gxSound* gxAudio::loadSound(const string& f, bool use3d) gxSound* gxAudio::loadSound(const std::string& f, bool use3d)
{ {
int flags = FSOUND_NORMAL | (use3d ? FSOUND_FORCEMONO : FSOUND_2D); int flags = FSOUND_NORMAL | (use3d ? FSOUND_FORCEMONO : FSOUND_2D);
@@ -289,18 +297,19 @@ void gxAudio::set3dListener(const float pos[3], const float vel[3], const float
FSOUND_Update(); FSOUND_Update();
} }
gxChannel* gxAudio::playFile(const string& t, bool use_3d) gxChannel* gxAudio::playFile(const std::string& t, bool use_3d)
{ {
string f = tolower(t); std::string f = tolower(t);
StaticChannel* chan = 0; StaticChannel* chan = 0;
map<string, StaticChannel*>::iterator it = songs.find(f); std::map<std::string, StaticChannel*>::iterator it = songs.find(f);
if (it != songs.end()) { if (it != songs.end()) {
chan = it->second; chan = it->second;
chan->play(); chan->play();
return chan; return chan;
} else if (f.find(".raw") != string::npos || f.find(".wav") != string::npos || f.find(".mp2") != string::npos } else if (f.find(".raw") != std::string::npos || f.find(".wav") != std::string::npos
|| f.find(".mp3") != string::npos || f.find(".ogg") != string::npos || f.find(".wma") != string::npos || f.find(".mp2") != std::string::npos || f.find(".mp3") != std::string::npos
|| f.find(".asf") != string::npos) { || f.find(".ogg") != std::string::npos || f.find(".wma") != std::string::npos
|| f.find(".asf") != std::string::npos) {
FSOUND_STREAM* stream = FSOUND_Stream_Open(f.c_str(), use_3d, 0, 0); FSOUND_STREAM* stream = FSOUND_Stream_Open(f.c_str(), use_3d, 0, 0);
if (!stream) if (!stream)
return 0; return 0;
+4 -8
View File
@@ -1,12 +1,10 @@
#pragma once
#ifndef GXAUDIO_H
#define GXAUDIO_H
#include <string> #include <string>
#include "gxsound.hpp"
class gxRuntime; class gxRuntime;
class gxChannel;
class gxSound;
struct FSOUND_SAMPLE; struct FSOUND_SAMPLE;
class gxAudio { class gxAudio {
@@ -41,5 +39,3 @@ class gxAudio {
gxChannel* playCDTrack(int track, int mode); gxChannel* playCDTrack(int track, int mode);
gxChannel* playFile(const std::string& filename, bool use_3d); gxChannel* playFile(const std::string& filename, bool use_3d);
}; };
#endif
+2 -3
View File
@@ -1,9 +1,8 @@
#include "gxcanvas.hpp" #include "gxcanvas.hpp"
#include "asmcoder.hpp" #include "asmcoder.hpp"
#include "gxgraphics.hpp" #include "gxgraphics.hpp"
#include "gxruntime.hpp" #include "gxruntime.hpp"
#include "std.hpp" #include "gxfont.hpp"
#define DEBUG_BITMASK #define DEBUG_BITMASK
@@ -662,7 +661,7 @@ void gxCanvas::blit(int x, int y, gxCanvas* src, int src_x, int src_y, int src_w
damage(dest_r); damage(dest_r);
} }
void gxCanvas::text(int x, int y, const string& t) void gxCanvas::text(int x, int y, const std::string& t)
{ {
int ty = y + origin_y; int ty = y + origin_y;
if (ty >= viewport.bottom) if (ty >= viewport.bottom)
+2 -6
View File
@@ -1,7 +1,5 @@
#pragma once
#ifndef GXCANVAS_H #include "graphicsruntime.hpp"
#define GXCANVAS_H
#include "ddutil.hpp" #include "ddutil.hpp"
class gxFont; class gxFont;
@@ -140,5 +138,3 @@ class gxCanvas {
unsigned getColor() const; unsigned getColor() const;
unsigned getClsColor() const; unsigned getClsColor() const;
}; };
#endif
-2
View File
@@ -1,5 +1,3 @@
#include "gxchannel.hpp" #include "gxchannel.hpp"
#include "std.hpp"
gxChannel::~gxChannel() {} gxChannel::~gxChannel() {}
+1 -5
View File
@@ -1,6 +1,4 @@
#pragma once
#ifndef GXCHANNEL_H
#define GXCHANNEL_H
class gxChannel { class gxChannel {
/***** GX INTERFACE *****/ /***** GX INTERFACE *****/
@@ -16,5 +14,3 @@ class gxChannel {
virtual bool isPlaying() = 0; virtual bool isPlaying() = 0;
}; };
#endif
-2
View File
@@ -1,7 +1,5 @@
#include "gxdevice.hpp" #include "gxdevice.hpp"
#include "gxruntime.hpp" #include "gxruntime.hpp"
#include "std.hpp"
gxDevice::gxDevice() gxDevice::gxDevice()
{ {
+1 -5
View File
@@ -1,6 +1,4 @@
#pragma once
#ifndef GXDEVICE_H
#define GXDEVICE_H
class gxDevice { class gxDevice {
public: public:
@@ -34,5 +32,3 @@ class gxDevice {
float getAxisState(int axis); float getAxisState(int axis);
}; };
#endif
+2 -4
View File
@@ -1,6 +1,4 @@
#include "gxdir.hpp" #include "gxdir.hpp"
#include "std.hpp"
gxDir::gxDir(HANDLE h, const WIN32_FIND_DATA& f) : handle(h), findData(f) {} gxDir::gxDir(HANDLE h, const WIN32_FIND_DATA& f) : handle(h), findData(f) {}
@@ -10,11 +8,11 @@ gxDir::~gxDir()
FindClose(handle); FindClose(handle);
} }
string gxDir::getNextFile() std::string gxDir::getNextFile()
{ {
if (handle == INVALID_HANDLE_VALUE) if (handle == INVALID_HANDLE_VALUE)
return ""; return "";
string t = findData.cFileName; std::string t = findData.cFileName;
if (!FindNextFile(handle, &findData)) { if (!FindNextFile(handle, &findData)) {
FindClose(handle); FindClose(handle);
handle = INVALID_HANDLE_VALUE; handle = INVALID_HANDLE_VALUE;
+2 -7
View File
@@ -1,9 +1,6 @@
#pragma once
#ifndef GXDIR_H
#define GXDIR_H
#include <string> #include <string>
#include <windows.h> #include <Windows.h>
class gxDir { class gxDir {
public: public:
@@ -18,5 +15,3 @@ class gxDir {
public: public:
std::string getNextFile(); std::string getNextFile();
}; };
#endif
+7 -7
View File
@@ -1,8 +1,7 @@
#include "gxfilesystem.hpp" #include "gxfilesystem.hpp"
#include "std.hpp" #include <set>
static set<gxDir*> dir_set; static std::set<gxDir*> dir_set;
gxFileSystem::gxFileSystem() gxFileSystem::gxFileSystem()
{ {
@@ -35,7 +34,7 @@ bool gxFileSystem::deleteFile(const std::string& file)
return DeleteFile(file.c_str()) ? true : false; return DeleteFile(file.c_str()) ? true : false;
} }
bool gxFileSystem::copyFile(const std::string& src, const string& dest) bool gxFileSystem::copyFile(const std::string& src, const std::string& dest)
{ {
return CopyFile(src.c_str(), dest.c_str(), false) ? true : false; return CopyFile(src.c_str(), dest.c_str(), false) ? true : false;
} }
@@ -50,12 +49,12 @@ bool gxFileSystem::setCurrentDir(const std::string& dir)
return SetCurrentDirectory(dir.c_str()) ? true : false; return SetCurrentDirectory(dir.c_str()) ? true : false;
} }
string gxFileSystem::getCurrentDir() const std::string gxFileSystem::getCurrentDir() const
{ {
char buff[MAX_PATH]; char buff[MAX_PATH];
if (!GetCurrentDirectory(MAX_PATH, buff)) if (!GetCurrentDirectory(MAX_PATH, buff))
return ""; return "";
string t = buff; std::string t = buff;
if (t.size() && t[t.size() - 1] != '\\') if (t.size() && t[t.size() - 1] != '\\')
t += '\\'; t += '\\';
return t; return t;
@@ -80,7 +79,7 @@ int gxFileSystem::getFileType(const std::string& name) const
gxDir* gxFileSystem::openDir(const std::string& name, int flags) gxDir* gxFileSystem::openDir(const std::string& name, int flags)
{ {
string t = name; std::string t = name;
if (t[t.size() - 1] == '\\') if (t[t.size() - 1] == '\\')
t += "*"; t += "*";
else else
@@ -94,6 +93,7 @@ gxDir* gxFileSystem::openDir(const std::string& name, int flags)
} }
return 0; return 0;
} }
gxDir* gxFileSystem::verifyDir(gxDir* d) gxDir* gxFileSystem::verifyDir(gxDir* d)
{ {
return dir_set.count(d) ? d : 0; return dir_set.count(d) ? d : 0;
+1 -7
View File
@@ -1,9 +1,5 @@
#pragma once
#ifndef GXFILESYSTEM_H
#define GXFILESYSTEM_H
#include <string> #include <string>
#include "gxdir.hpp" #include "gxdir.hpp"
class gxFileSystem { class gxFileSystem {
@@ -31,5 +27,3 @@ class gxFileSystem {
gxDir* verifyDir(gxDir* d); gxDir* verifyDir(gxDir* d);
void closeDir(gxDir* dir); void closeDir(gxDir* dir);
}; };
#endif
+2 -4
View File
@@ -1,8 +1,6 @@
#include "gxfont.hpp" #include "gxfont.hpp"
#include "gxcanvas.hpp" #include "gxcanvas.hpp"
#include "gxgraphics.hpp" #include "gxgraphics.hpp"
#include "std.hpp"
gxFont::gxFont(gxGraphics* g, gxCanvas* c, int w, int h, int b, int e, int d, int* os, int* ws) gxFont::gxFont(gxGraphics* g, gxCanvas* c, int w, int h, int b, int e, int d, int* os, int* ws)
: graphics(g), canvas(c), width(w), height(h), begin_char(b), end_char(e), def_char(d), offs(os), widths(ws) : graphics(g), canvas(c), width(w), height(h), begin_char(b), end_char(e), def_char(d), offs(os), widths(ws)
@@ -26,7 +24,7 @@ int gxFont::charWidth(int c) const
return widths[c - begin_char]; return widths[c - begin_char];
} }
void gxFont::render(gxCanvas* dest, unsigned color_argb, int x, int y, const string& t) void gxFont::render(gxCanvas* dest, unsigned color_argb, int x, int y, const std::string& t)
{ {
int width = getWidth(t); int width = getWidth(t);
if (width > t_canvas->getWidth()) { if (width > t_canvas->getWidth()) {
@@ -63,7 +61,7 @@ int gxFont::getHeight() const
return height; return height;
} }
int gxFont::getWidth(const string& t) const int gxFont::getWidth(const std::string& t) const
{ {
int w = 0; int w = 0;
for (int k = 0; k < t.size(); ++k) { for (int k = 0; k < t.size(); ++k) {
+2 -5
View File
@@ -1,6 +1,5 @@
#pragma once
#ifndef GXFONT_H #include <string>
#define GXFONT_H
class gxCanvas; class gxCanvas;
class gxGraphics; class gxGraphics;
@@ -30,5 +29,3 @@ class gxFont {
int getWidth(const std::string& text) const; //width of string int getWidth(const std::string& text) const; //width of string
bool isPrintable(int chr) const; //printable char? bool isPrintable(int chr) const; //printable char?
}; };
#endif
+18 -14
View File
@@ -1,7 +1,11 @@
#include "gxgraphics.hpp" #include "gxgraphics.hpp"
#include "gxruntime.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; extern gxRuntime* gx_runtime;
@@ -52,7 +56,7 @@ gxGraphics::~gxGraphics()
while (canvas_set.size()) while (canvas_set.size())
freeCanvas(*canvas_set.begin()); freeCanvas(*canvas_set.begin());
set<string>::iterator it; std::set<std::string>::iterator it;
for (it = font_res.begin(); it != font_res.end(); ++it) for (it = font_res.begin(); it != font_res.end(); ++it)
RemoveFontResource((*it).c_str()); RemoveFontResource((*it).c_str());
font_res.clear(); font_res.clear();
@@ -104,13 +108,13 @@ bool gxGraphics::restore()
dirDraw->RestoreAllSurfaces(); dirDraw->RestoreAllSurfaces();
//restore all canvases //restore all canvases
set<gxCanvas*>::iterator it; std::set<gxCanvas*>::iterator it;
for (it = canvas_set.begin(); it != canvas_set.end(); ++it) { for (it = canvas_set.begin(); it != canvas_set.end(); ++it) {
(*it)->restore(); (*it)->restore();
} }
//restore all meshes (b3d surfaces) //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) { for (mesh_it = mesh_set.begin(); mesh_it != mesh_set.end(); ++mesh_it) {
(*mesh_it)->restore(); (*mesh_it)->restore();
} }
@@ -173,7 +177,7 @@ int gxGraphics::getAvailVidmem() const
return caps.dwVidMemFree; return caps.dwVidMemFree;
} }
gxMovie* gxGraphics::openMovie(const string& file, int flags) gxMovie* gxGraphics::openMovie(const std::string& file, int flags)
{ {
/*IAMMultiMediaStream *iam_stream; /*IAMMultiMediaStream *iam_stream;
@@ -226,7 +230,7 @@ gxCanvas* gxGraphics::createCanvas(int w, int h, int flags)
return c; 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); IDirectDrawSurface7* s = ddUtil::loadSurface(f, flags, this);
if (!s) if (!s)
@@ -262,16 +266,16 @@ int gxGraphics::getDepth() const
return front_canvas->getDepth(); 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 bold = flags & gxFont::FONT_BOLD ? FW_BOLD : FW_REGULAR;
int italic = flags & gxFont::FONT_ITALIC ? 1 : 0; int italic = flags & gxFont::FONT_ITALIC ? 1 : 0;
int underline = flags & gxFont::FONT_UNDERLINE ? 1 : 0; int underline = flags & gxFont::FONT_UNDERLINE ? 1 : 0;
int strikeout = 0; int strikeout = 0;
string t; std::string t;
int n = f.find('.'); int n = f.find('.');
if (n != string::npos) { if (n != std::string::npos) {
t = fullfilename(f); t = fullfilename(f);
if (!font_res.count(t) && AddFontResource(t.c_str())) if (!font_res.count(t) && AddFontResource(t.c_str()))
font_res.insert(t); font_res.insert(t);
@@ -459,7 +463,7 @@ static int cntBits(int mask)
return n; return n;
} }
static vector<TexFmt> tex_fmts; static std::vector<TexFmt> tex_fmts;
static HRESULT CALLBACK enumTextureFormat(DDPIXELFORMAT* fmt, void* p) static HRESULT CALLBACK enumTextureFormat(DDPIXELFORMAT* fmt, void* p)
{ {
@@ -474,9 +478,9 @@ static HRESULT CALLBACK enumTextureFormat(DDPIXELFORMAT* fmt, void* p)
return D3DENUMRET_OK; 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) { for (int k = 0; k < 32; n <<= 1, ++k) {
t += (n & 0x80000000) ? '1' : '0'; t += (n & 0x80000000) ? '1' : '0';
} }
@@ -485,7 +489,7 @@ static string itobin(int n)
static void debugPF(const DDPIXELFORMAT& pf) static void debugPF(const DDPIXELFORMAT& pf)
{ {
string t; std::string t;
t = "Bits:" + itoa(pf.dwRGBBitCount); t = "Bits:" + itoa(pf.dwRGBBitCount);
gx_runtime->debugLog(t.c_str()); gx_runtime->debugLog(t.c_str());
t = "R Mask:" + itobin(pf.dwRBitMask); t = "R Mask:" + itobin(pf.dwRBitMask);
+8 -16
View File
@@ -1,23 +1,17 @@
#pragma once
#ifndef GXGRAPHICS_H
#define GXGRAPHICS_H
#include <set> #include <set>
#include <string> #include <string>
#include <d3d.h> #include <d3d.h>
#include <windows.h> #include <Windows.h>
#include "GraphicsRuntime.hpp" #include "graphicsruntime.hpp"
#include "ddutil.hpp" #include "ddutil.hpp"
#include "gxcanvas.hpp" class gxCanvas;
#include "gxfont.hpp" class gxFont;
#include "gxmesh.hpp" class gxMesh;
#include "gxmovie.hpp" class gxMovie;
#include "gxscene.hpp"
class gxRuntime; class gxRuntime;
class gxScene;
class gxGraphics { class gxGraphics {
private: private:
@@ -122,5 +116,3 @@ class gxGraphics {
gxMesh* verifyMesh(gxMesh* mesh); gxMesh* verifyMesh(gxMesh* mesh);
void freeMesh(gxMesh* mesh); void freeMesh(gxMesh* mesh);
}; };
#endif
+5 -4
View File
@@ -1,8 +1,9 @@
#pragma once
#include "gxinput.hpp" #include "gxinput.hpp"
#include "gxdevice.hpp"
#include "gxruntime.hpp" #include "gxruntime.hpp"
#include "std.hpp" #include "gxgraphics.hpp"
#include <mmsystem.h>
static const int QUE_SIZE = 32; static const int QUE_SIZE = 32;
@@ -149,7 +150,7 @@ class Joystick : public Device {
static Keyboard* keyboard; static Keyboard* keyboard;
static Mouse* mouse; static Mouse* mouse;
static vector<Joystick*> joysticks; static std::vector<Joystick*> joysticks;
static Keyboard* createKeyboard(gxInput* input) static Keyboard* createKeyboard(gxInput* input)
{ {
+2 -4
View File
@@ -1,9 +1,7 @@
#pragma once #pragma once
#include "graphicsruntime.hpp"
#include "GraphicsRuntime.hpp" class gxDevice;
#include "gxdevice.hpp"
#include "std.hpp"
class gxRuntime; class gxRuntime;
class gxInput { class gxInput {
-2
View File
@@ -1,8 +1,6 @@
#include "gxlight.hpp" #include "gxlight.hpp"
#include "gxgraphics.hpp" #include "gxgraphics.hpp"
#include "gxscene.hpp" #include "gxscene.hpp"
#include "std.hpp"
const float PI = 3.14159265359f; //180 degrees const float PI = 3.14159265359f; //180 degrees
const float TWOPI = PI * 2.0f; //360 degrees const float TWOPI = PI * 2.0f; //360 degrees
+10 -10
View File
@@ -1,11 +1,10 @@
#pragma once
#include "GraphicsRuntime.hpp" #include "graphicsruntime.hpp"
#ifndef GXLIGHT_H
#define GXLIGHT_H
class gxScene; class gxScene;
enum { LIGHT_DISTANT = 1, LIGHT_POINT = 2, LIGHT_SPOT = 3 };
class gxLight { class gxLight {
public: public:
gxLight(gxScene* scene, int type); gxLight(gxScene* scene, int type);
@@ -18,20 +17,21 @@ class gxLight {
/***** GX INTERFACE *****/ /***** GX INTERFACE *****/
public: public:
enum { LIGHT_DISTANT = 1, LIGHT_POINT = 2, LIGHT_SPOT = 3 };
void setRange(float range); void setRange(float range);
void setColor(const float rgb[3])
inline void setColor(const float rgb[3])
{ {
memcpy(&d3d_light.dcvDiffuse, rgb, 12); memcpy(&d3d_light.dcvDiffuse, rgb, 12);
} }
void setPosition(const float pos[3]); void setPosition(const float pos[3]);
void setDirection(const float dir[3]); void setDirection(const float dir[3]);
void setConeAngles(float inner, float outer); void setConeAngles(float inner, float outer);
void getColor(float rgb[3]) inline void getColor(float rgb[3])
{ {
memcpy(rgb, &d3d_light.dcvDiffuse, 12); memcpy(rgb, &d3d_light.dcvDiffuse, 12);
} }
}; };
#endif
-3
View File
@@ -1,8 +1,5 @@
#include "gxmesh.hpp" #include "gxmesh.hpp"
#include "gxgraphics.hpp" #include "gxgraphics.hpp"
#include "std.hpp"
#include "gxruntime.hpp" #include "gxruntime.hpp"
extern gxRuntime* gx_runtime; extern gxRuntime* gx_runtime;
+3 -8
View File
@@ -1,10 +1,7 @@
#pragma once
#ifndef GXMESH_H
#define GXMESH_H
#include <d3d.h> #include <d3d.h>
#include <windows.h> #include <Windows.h>
#include "GraphicsRuntime.hpp" #include "graphicsruntime.hpp"
class gxGraphics; class gxGraphics;
@@ -81,5 +78,3 @@ class gxMesh {
tri_indices[n * 3 + 2] = v2; tri_indices[n * 3 + 2] = v2;
} }
}; };
#endif
-2
View File
@@ -1,7 +1,5 @@
#include "gxmovie.hpp" #include "gxmovie.hpp"
#include "gxgraphics.hpp" #include "gxgraphics.hpp"
#include "std.hpp"
gxMovie::gxMovie(gxGraphics* g, IMultiMediaStream* mm) : gfx(g), mm_stream(mm), playing(true) gxMovie::gxMovie(gxGraphics* g, IMultiMediaStream* mm) : gfx(g), mm_stream(mm), playing(true)
{ {
+10 -14
View File
@@ -1,14 +1,10 @@
#pragma once
#ifndef GXMOVIE_H #include <amstream.h> // DirectShow multimedia stream interfaces
#define GXMOVIE_H #include <ddstream.h> // DirectDraw multimedia stream interfaces
#include <mmstream.h> // multimedia stream interfaces
#include "amstream.h" // DirectShow multimedia stream interfaces
#include "ddstream.h" // DirectDraw multimedia stream interfaces
#include "mmstream.h" // multimedia stream interfaces
#include "gxcanvas.hpp"
class gxGraphics; class gxGraphics;
class gxCanvas;
class gxMovie { class gxMovie {
public: public:
@@ -30,18 +26,18 @@ class gxMovie {
public: public:
bool draw(gxCanvas* dest, int x, int y, int w, int h); bool draw(gxCanvas* dest, int x, int y, int w, int h);
bool isPlaying() const inline bool isPlaying() const
{ {
return playing; return playing;
} }
int getWidth() const
inline int getWidth() const
{ {
return src_rect.right; return src_rect.right;
} }
int getHeight() const
inline int getHeight() const
{ {
return src_rect.bottom; return src_rect.bottom;
} }
}; };
#endif
+4 -5
View File
@@ -1,7 +1,8 @@
#include "gxmusic.hpp" #include "gxmusic.hpp"
extern "C" {
#include <fmod.h> #include <fmod.h>
#include "std.hpp" }
gxMusic::gxMusic(gxAudio* a, FMUSIC_MODULE* m, FSOUND_STREAM* s) : audio(a), module(m), stream(s), stream_channel(-1) {} gxMusic::gxMusic(gxAudio* a, FMUSIC_MODULE* m, FSOUND_STREAM* s) : audio(a), module(m), stream(s), stream_channel(-1) {}
@@ -54,8 +55,6 @@ bool gxMusic::isPlaying() const
{ {
if (module) { if (module) {
return FMUSIC_IsPlaying(module) ? true : false; return FMUSIC_IsPlaying(module) ? true : false;
} else {
return FSOUND_IsPlaying(stream_channel) ? true : false;
} }
return false; return FSOUND_IsPlaying(stream_channel) ? true : false;
} }
+5 -5
View File
@@ -1,6 +1,4 @@
#pragma once
#ifndef GXMUSIC_H
#define GXMUSIC_H
class gxAudio; class gxAudio;
@@ -21,14 +19,16 @@ class gxMusic {
/***** GX INTERFACE *****/ /***** GX INTERFACE *****/
public: public:
//modifiers //modifiers
void play(); void play();
void stop(); void stop();
void setPaused(bool paused); void setPaused(bool paused);
void setVolume(float volume); void setVolume(float volume);
//accessors //accessors
bool isPlaying() const; bool isPlaying() const;
}; };
#endif
+45 -34
View File
@@ -1,12 +1,23 @@
#pragma once
#include "gxruntime.hpp" #include "gxruntime.hpp"
#include <fmod.h> #include <algorithm>
#include <map>
#include "graphicsruntime.hpp"
#include "gxaudio.hpp"
#include "gxcanvas.hpp"
#include "gxfilesystem.hpp"
#include "gxgraphics.hpp"
#include "gxinput.hpp"
#include "gxtimer.hpp"
#include <stdutil.hpp>
#include <Windows.h>
#include <mmsystem.h>
#include <shellapi.h> #include <shellapi.h>
#include <windows.h>
#include <zmouse.h> #include <zmouse.h>
#include "GraphicsRuntime.hpp"
#include "std.hpp" extern "C" {
#include <fmod.h>
}
struct gxRuntime::GfxMode { struct gxRuntime::GfxMode {
DDSURFACEDESC2 desc; DDSURFACEDESC2 desc;
@@ -21,8 +32,8 @@ struct gxRuntime::GfxDriver {
static const int static_ws = WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; static const int static_ws = WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
static const int scaled_ws = WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; static const int scaled_ws = WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
static string app_title; static std::string app_title;
static string app_close; static std::string app_close;
static gxRuntime* runtime; static gxRuntime* runtime;
static bool busy, suspended; static bool busy, suspended;
static volatile bool run_flag; static volatile bool run_flag;
@@ -31,11 +42,11 @@ static DDSURFACEDESC2 desktop_desc;
typedef int(_stdcall* LibFunc)(const void* in, int in_sz, void* out, int out_sz); typedef int(_stdcall* LibFunc)(const void* in, int in_sz, void* out, int out_sz);
struct gxDll { struct gxDll {
HINSTANCE hinst; HINSTANCE hinst;
map<string, LibFunc> funcs; std::map<std::string, LibFunc> funcs;
}; };
static map<string, gxDll*> libs; static std::map<std::string, gxDll*> libs;
static LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); static LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
@@ -57,14 +68,14 @@ static IDirectDrawClipper* clipper;
static IDirectDrawSurface7* primSurf; static IDirectDrawSurface7* primSurf;
//static Debugger *debugger; //static Debugger *debugger;
static set<gxTimer*> timers; static std::set<gxTimer*> timers;
enum { WM_STOP = WM_USER + 1, WM_RUN, WM_END }; enum { WM_STOP = WM_USER + 1, WM_RUN, WM_END };
//////////////////// ////////////////////
// STATIC STARTUP // // STATIC STARTUP //
//////////////////// ////////////////////
gxRuntime* gxRuntime::openRuntime(HINSTANCE hinst, const string& cmd_line, void* d) gxRuntime* gxRuntime::openRuntime(HINSTANCE hinst, const std::string& cmd_line, void* d)
{ {
if (runtime) if (runtime)
return 0; return 0;
@@ -105,7 +116,7 @@ void gxRuntime::closeRuntime(gxRuntime* r)
if (!runtime || runtime != r) if (!runtime || runtime != r)
return; return;
map<string, gxDll*>::const_iterator it; std::map<std::string, gxDll*>::const_iterator it;
for (it = libs.begin(); it != libs.end(); ++it) { for (it = libs.begin(); it != libs.end(); ++it) {
FreeLibrary(it->second->hinst); FreeLibrary(it->second->hinst);
} }
@@ -120,7 +131,7 @@ void gxRuntime::closeRuntime(gxRuntime* r)
////////////////////////// //////////////////////////
typedef int(_stdcall* SetAppCompatDataFunc)(int x, int y); typedef int(_stdcall* SetAppCompatDataFunc)(int x, int y);
gxRuntime::gxRuntime(HINSTANCE hi, const string& cl, HWND hw) gxRuntime::gxRuntime(HINSTANCE hi, const std::string& cl, HWND hw)
: hinst(hi), cmd_line(cl), hwnd(hw), curr_driver(0), enum_all(false), pointer_visible(true), audio(0), input(0), : hinst(hi), cmd_line(cl), hwnd(hw), curr_driver(0), enum_all(false), pointer_visible(true), audio(0), input(0),
graphics(0), fileSystem(0), use_di(false) graphics(0), fileSystem(0), use_di(false)
{ {
@@ -338,7 +349,7 @@ void gxRuntime::flip(bool vwait)
} }
if (n >= 0) if (n >= 0)
return; return;
string t = "Flip Failed! Return code:" + itoa(n & 0x7fff); std::string t = "Flip Failed! Return code:" + itoa(n & 0x7fff);
debugLog(t.c_str()); debugLog(t.c_str());
break; break;
} }
@@ -677,7 +688,7 @@ void gxRuntime::debugLog(const char* t)
///////////////////////// /////////////////////////
// RETURN COMMAND LINE // // RETURN COMMAND LINE //
///////////////////////// /////////////////////////
string gxRuntime::commandLine() std::string gxRuntime::commandLine()
{ {
return cmd_line; return cmd_line;
} }
@@ -685,24 +696,24 @@ string gxRuntime::commandLine()
///////////// /////////////
// EXECUTE // // EXECUTE //
///////////// /////////////
bool gxRuntime::execute(const string& cmd_line) bool gxRuntime::execute(const std::string& cmd_line)
{ {
if (!cmd_line.size()) if (!cmd_line.size())
return false; return false;
//convert cmd_line to cmd and params //convert cmd_line to cmd and params
string cmd = cmd_line, params; std::string cmd = cmd_line, params;
while (cmd.size() && cmd[0] == ' ') while (cmd.size() && cmd[0] == ' ')
cmd = cmd.substr(1); cmd = cmd.substr(1);
if (cmd.find('\"') == 0) { if (cmd.find('\"') == 0) {
int n = cmd.find('\"', 1); int n = cmd.find('\"', 1);
if (n != string::npos) { if (n != std::string::npos) {
params = cmd.substr(n + 1); params = cmd.substr(n + 1);
cmd = cmd.substr(1, n - 1); cmd = cmd.substr(1, n - 1);
} }
} else { } else {
int n = cmd.find(' '); int n = cmd.find(' ');
if (n != string::npos) { if (n != std::string::npos) {
params = cmd.substr(n + 1); params = cmd.substr(n + 1);
cmd = cmd.substr(0, n); cmd = cmd.substr(0, n);
} }
@@ -720,7 +731,7 @@ bool gxRuntime::execute(const string& cmd_line)
/////////////// ///////////////
// APP TITLE // // APP TITLE //
/////////////// ///////////////
void gxRuntime::setTitle(const string& t, const string& e) void gxRuntime::setTitle(const std::string& t, const std::string& e)
{ {
app_title = t; app_title = t;
app_close = e; app_close = e;
@@ -1165,7 +1176,7 @@ static BOOL WINAPI enumDriver(GUID FAR* guid, LPSTR desc, LPSTR name, LPVOID con
dir3d->EnumDevices(enumDevice, d); dir3d->EnumDevices(enumDevice, d);
dir3d->Release(); dir3d->Release();
} }
vector<gxRuntime::GfxDriver*>* drivers = (vector<gxRuntime::GfxDriver*>*)context; std::vector<gxRuntime::GfxDriver*>* drivers = (std::vector<gxRuntime::GfxDriver*>*)context;
drivers->push_back(d); drivers->push_back(d);
dd->EnumDisplayModes(0, 0, d, enumMode); dd->EnumDisplayModes(0, 0, d, enumMode);
dd->Release(); dd->Release();
@@ -1203,7 +1214,7 @@ int gxRuntime::enumerateGraphicsDrivers()
return drivers.size(); return drivers.size();
} }
void gxRuntime::graphicsDriverInfo(int driver, string* name, int* c) void gxRuntime::graphicsDriverInfo(int driver, std::string* name, int* c)
{ {
GfxDriver* g = drivers[driver]; GfxDriver* g = drivers[driver];
int caps = 0; int caps = 0;
@@ -1278,26 +1289,26 @@ void gxRuntime::freeTimer(gxTimer* t)
delete t; delete t;
} }
static string toDir(string t) static std::string toDir(std::string t)
{ {
if (t.size() && t[t.size() - 1] != '\\') if (t.size() && t[t.size() - 1] != '\\')
t += '\\'; t += '\\';
return t; return t;
} }
string gxRuntime::systemProperty(const std::string& p) std::string gxRuntime::systemProperty(const std::string& p)
{ {
char buff[MAX_PATH + 1]; char buff[MAX_PATH + 1];
string t = tolower(p); std::string t = tolower(p);
if (t == "cpu") { if (t == "cpu") {
return "Intel"; return "Intel";
} else if (t == "os") { } else if (t == "os") {
return "Windows"; return "Windows";
} else if (t == "appdir") { } else if (t == "appdir") {
if (GetModuleFileName(0, buff, MAX_PATH)) { if (GetModuleFileName(0, buff, MAX_PATH)) {
string t = buff; std::string t = buff;
int n = t.find_last_of('\\'); int n = t.find_last_of('\\');
if (n != string::npos) if (n != std::string::npos)
t = t.substr(0, n); t = t.substr(0, n);
return toDir(t); return toDir(t);
} }
@@ -1342,7 +1353,7 @@ void gxRuntime::enableDirectInput(bool enable)
int gxRuntime::callDll(const std::string& dll, const std::string& func, const void* in, int in_sz, void* out, int gxRuntime::callDll(const std::string& dll, const std::string& func, const void* in, int in_sz, void* out,
int out_sz) int out_sz)
{ {
map<string, gxDll*>::const_iterator lib_it = libs.find(dll); std::map<std::string, gxDll*>::const_iterator lib_it = libs.find(dll);
if (lib_it == libs.end()) { if (lib_it == libs.end()) {
HINSTANCE h = LoadLibrary(dll.c_str()); HINSTANCE h = LoadLibrary(dll.c_str());
@@ -1353,8 +1364,8 @@ int gxRuntime::callDll(const std::string& dll, const std::string& func, const vo
lib_it = libs.insert(make_pair(dll, t)).first; lib_it = libs.insert(make_pair(dll, t)).first;
} }
gxDll* t = lib_it->second; gxDll* t = lib_it->second;
map<string, LibFunc>::const_iterator fun_it = t->funcs.find(func); std::map<std::string, LibFunc>::const_iterator fun_it = t->funcs.find(func);
if (fun_it == t->funcs.end()) { if (fun_it == t->funcs.end()) {
LibFunc f = (LibFunc)GetProcAddress(t->hinst, func.c_str()); LibFunc f = (LibFunc)GetProcAddress(t->hinst, func.c_str());
+9 -12
View File
@@ -1,16 +1,15 @@
#pragma once
#ifndef GXRUNTIME_H #include "graphicsruntime.hpp"
#define GXRUNTIME_H
#include <string> #include <string>
#include <vector> #include <vector>
#include <windows.h>
#include "gxaudio.hpp" #include <Windows.h>
#include "gxfilesystem.hpp"
#include "gxgraphics.hpp" class gxAudio;
#include "gxinput.hpp" class gxInput;
#include "gxtimer.hpp" class gxGraphics;
class gxFileSystem;
class gxTimer;
class gxRuntime { class gxRuntime {
/***** INTERNAL INTERFACE *****/ /***** INTERNAL INTERFACE *****/
@@ -139,5 +138,3 @@ class gxRuntime {
OSVERSIONINFO osinfo; OSVERSIONINFO osinfo;
}; };
#endif
+4 -3
View File
@@ -1,8 +1,9 @@
#include "gxscene.hpp" #include "gxscene.hpp"
#include "gxgraphics.hpp" #include "gxgraphics.hpp"
#include "gxruntime.hpp" #include "gxruntime.hpp"
#include "std.hpp" #include "gxcanvas.hpp"
#include "gxlight.hpp"
#include "gxmesh.hpp"
static bool can_wb; static bool can_wb;
static int hw_tex_stages, tex_stages; static int hw_tex_stages, tex_stages;
@@ -627,7 +628,7 @@ void gxScene::setRenderState(const RenderState& rs)
} }
} }
bool gxScene::begin(const vector<gxLight*>& lights) bool gxScene::begin(const std::vector<gxLight*>& lights)
{ {
if (dir3dDev->BeginScene() != D3D_OK) if (dir3dDev->BeginScene() != D3D_OK)
return false; return false;
+6 -12
View File
@@ -1,21 +1,17 @@
#pragma once
#ifndef GXSCENE_H
#define GXSCENE_H
#include <d3d.h> #include <d3d.h>
#include <map> #include <map>
#include <windows.h> #include <Windows.h>
#include "GraphicsRuntime.hpp" #include "graphicsruntime.hpp"
#include <vector>
#include "gxlight.hpp" #include <set>
class gxCanvas; class gxCanvas;
class gxMesh; class gxMesh;
class gxLight; class gxLight;
class gxGraphics; class gxGraphics;
class gxTexture; class gxTexture;
class gxLight;
class gxScene { class gxScene {
public: public:
@@ -142,5 +138,3 @@ class gxScene {
void setTriCull(); void setTriCull();
void setTexState(int index, const TexState& state, bool set_blend); void setTexState(int index, const TexState& state, bool set_blend);
}; };
#endif
+4 -3
View File
@@ -1,8 +1,9 @@
#include "gxsound.hpp" #include "gxsound.hpp"
#include <fmod.h>
#include "gxaudio.hpp" #include "gxaudio.hpp"
#include "std.hpp"
extern "C" {
#include <fmod.h>
}
gxSound::gxSound(gxAudio* a, FSOUND_SAMPLE* s) : audio(a), sample(s), defs_valid(true) gxSound::gxSound(gxAudio* a, FSOUND_SAMPLE* s) : audio(a), sample(s), defs_valid(true)
{ {
+3 -7
View File
@@ -1,10 +1,8 @@
#pragma once;
#ifndef GXSOUND_H
#define GXSOUND_H
#include "gxchannel.hpp"
class gxAudio; class gxAudio;
class gxChannel;
struct FSOUND_SAMPLE; struct FSOUND_SAMPLE;
class gxSound { class gxSound {
@@ -34,5 +32,3 @@ class gxSound {
void setVolume(float volume); void setVolume(float volume);
void setPan(float pan); void setPan(float pan);
}; };
#endif
+2 -2
View File
@@ -1,7 +1,7 @@
#include "gxtimer.hpp" #include "gxtimer.hpp"
#include "gxruntime.hpp" #include "gxruntime.hpp"
#include "std.hpp"
#include <mmsystem.h>
gxTimer::gxTimer(gxRuntime* rt, int hertz) : runtime(rt), ticks_get(0), ticks_put(0) gxTimer::gxTimer(gxRuntime* rt, int hertz) : runtime(rt), ticks_get(0), ticks_put(0)
{ {
+2 -6
View File
@@ -1,7 +1,5 @@
#pragma once
#ifndef GXTIMER_H #include <Windows.h>
#define GXTIMER_H
#include <mmsyscom.h> #include <mmsyscom.h>
class gxRuntime; class gxRuntime;
@@ -23,5 +21,3 @@ class gxTimer {
public: public:
int wait(); int wait();
}; };
#endif
-2
View File
@@ -1,2 +0,0 @@
#include "std.hpp"
-25
View File
@@ -1,25 +0,0 @@
#ifndef STD_H
#define STD_H
#include "stdutil.hpp"
#pragma warning(disable : 4786)
#define DIRECTSOUND_VERSION 0x700
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <math.h>
#include <windows.h>
#include "GraphicsRuntime.hpp"
using namespace std;
#endif