SWORD25: Clean compile!
Under MinGW, with OpenGL and tinyxml. svn-id: r53225
This commit is contained in:
parent
ab85540a1b
commit
ad5b74c9de
25 changed files with 286 additions and 267 deletions
|
@ -123,7 +123,7 @@ public:
|
|||
virtual bool Unpersist(BS_InputPersistenceBlock &Reader);
|
||||
|
||||
private:
|
||||
Common::Array<const Frame> m_Frames;
|
||||
Common::Array<Frame> m_Frames;
|
||||
BS_AnimationResource *m_SourceAnimationPtr;
|
||||
bool m_Valid;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
@return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
|
||||
@remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
|
||||
*/
|
||||
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0) = 0;
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset = 0, unsigned int Stride = 0) = 0;
|
||||
|
||||
virtual bool IsScalingAllowed() const = 0;
|
||||
virtual bool IsAlphaAllowed() const = 0;
|
||||
|
|
|
@ -123,8 +123,8 @@ bool BS_DynamicBitmap::DoRender() {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
|
||||
return m_Image->SetContent(Pixeldata, Offset, Stride);
|
||||
bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
return m_Image->SetContent(Pixeldata, size, Offset, Stride);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -184,7 +184,7 @@ bool BS_DynamicBitmap::Unpersist(BS_InputPersistenceBlock &Reader) {
|
|||
|
||||
// Bild mit durchsichtigen Bilddaten initialisieren.
|
||||
byte *TransparentImageData = (byte *)calloc(m_Width * m_Height * 4, 1);
|
||||
m_Image->SetContent(TransparentImageData);
|
||||
m_Image->SetContent(TransparentImageData, m_Width * m_Height);
|
||||
free(TransparentImageData);
|
||||
|
||||
Result &= BS_RenderObject::UnpersistChildren(Reader);
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
virtual unsigned int GetPixel(int X, int Y) const;
|
||||
|
||||
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
|
||||
virtual bool IsScalingAllowed() const;
|
||||
virtual bool IsAlphaAllowed() const;
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
@return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
|
||||
@remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
|
||||
*/
|
||||
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) = 0;
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) = 0;
|
||||
|
||||
/**
|
||||
@brief Liest einen Pixel des Bildes.
|
||||
|
|
|
@ -38,12 +38,8 @@
|
|||
|
||||
#include "sword25/kernel/bs_stdint.h"
|
||||
#include "sword25/gfx/image/vectorimage.h"
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "agg_bounding_rect.h"
|
||||
|
||||
using namespace std;
|
||||
#include "graphics/colormasks.h"
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
|
@ -195,9 +191,9 @@ BS_Rect FlashRectToBSRect(BS_VectorImage::SWFBitStream &bs) {
|
|||
// Konvertiert SWF-Farben in AntiGrain Farben
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
agg::rgba8 FlashColorToAGGRGBA8(unsigned int FlashColor) {
|
||||
agg::rgba8 ResultColor((FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff, FlashColor >> 24);
|
||||
ResultColor.premultiply();
|
||||
uint32 FlashColorToAGGRGBA8(unsigned int FlashColor) {
|
||||
uint32 ResultColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(FlashColor >> 24, (FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff);
|
||||
|
||||
return ResultColor;
|
||||
}
|
||||
|
||||
|
@ -215,12 +211,16 @@ struct CBBGetId {
|
|||
};
|
||||
|
||||
BS_Rect CalculateBoundingBox(const BS_VectorImageElement &VectorImageElement) {
|
||||
#if 0 // TODO
|
||||
agg::path_storage Path = VectorImageElement.GetPaths();
|
||||
CBBGetId IdSource(VectorImageElement);
|
||||
|
||||
double x1, x2, y1, y2;
|
||||
agg::bounding_rect(Path, IdSource, 0, VectorImageElement.GetPathCount(), &x1, &y1, &x2, &y2);
|
||||
|
||||
#else
|
||||
double x1, x2, y1, y2;
|
||||
x1 = x2 = y1 = y2 = 0;
|
||||
#endif
|
||||
return BS_Rect(static_cast<int>(x1), static_cast<int>(y1), static_cast<int>(x2) + 1, static_cast<int>(y2) + 1);
|
||||
}
|
||||
}
|
||||
|
@ -388,6 +388,7 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
|
|||
// Ein neuen Pfad erzeugen, es sei denn, es wurden nur neue Styles definiert
|
||||
if (StateLineStyle || StateFillStyle0 || StateFillStyle1 || StateMoveTo) {
|
||||
// Letzte Zeichenposition merken, beim Aufruf von start_new_path() wird die Zeichenpostionen auf 0, 0 zurückgesetzt
|
||||
#if 0 // TODO
|
||||
double LastX = m_Elements.back().m_Paths.last_x();
|
||||
double LastY = m_Elements.back().m_Paths.last_y();
|
||||
|
||||
|
@ -400,6 +401,7 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
|
|||
m_Elements.back().m_Paths.move_to(MoveDeltaX, MoveDeltaY);
|
||||
else
|
||||
m_Elements.back().m_Paths.move_to(LastX, LastY);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -414,11 +416,13 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
|
|||
s32 AnchorDeltaX = bs.GetSignedBits(NumBits);
|
||||
s32 AnchorDeltaY = bs.GetSignedBits(NumBits);
|
||||
|
||||
#if 0 // TODO
|
||||
double ControlX = m_Elements.back().m_Paths.last_x() + ControlDeltaX;
|
||||
double ControlY = m_Elements.back().m_Paths.last_y() + ControlDeltaY;
|
||||
double AnchorX = ControlX + AnchorDeltaX;
|
||||
double AnchorY = ControlY + AnchorDeltaY;
|
||||
m_Elements.back().m_Paths.curve3(ControlX, ControlY, AnchorX, AnchorY);
|
||||
#endif
|
||||
} else {
|
||||
// Staight edge
|
||||
s32 DeltaX = 0;
|
||||
|
@ -436,13 +440,15 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
|
|||
DeltaX = bs.GetSignedBits(NumBits);
|
||||
}
|
||||
|
||||
#if 0 // TODO
|
||||
m_Elements.back().m_Paths.line_rel(DeltaX, DeltaY);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bounding-Boxes der einzelnen Elemente berechnen
|
||||
vector<BS_VectorImageElement>::iterator it = m_Elements.begin();
|
||||
Common::Array<BS_VectorImageElement>::iterator it = m_Elements.begin();
|
||||
for (; it != m_Elements.end(); ++it) it->m_BoundingBox = CalculateBoundingBox(*it);
|
||||
|
||||
return true;
|
||||
|
@ -481,7 +487,8 @@ bool BS_VectorImage::ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsig
|
|||
|
||||
// Anzahl an Linestyles bestimmen
|
||||
unsigned int LineStyleCount = bs.GetU8();
|
||||
if (LineStyleCount == 0xff) LineStyleCount = bs.GetU16();
|
||||
if (LineStyleCount == 0xff)
|
||||
LineStyleCount = bs.GetU16();
|
||||
|
||||
// Alle Linestyles einlesen
|
||||
m_Elements.back().m_LineStyles.reserve(LineStyleCount);
|
||||
|
@ -521,7 +528,7 @@ unsigned int BS_VectorImage::GetPixel(int X, int Y) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_VectorImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
|
||||
bool BS_VectorImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
BS_LOG_ERRORLN("SetContent() is not supported.");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -43,10 +43,10 @@
|
|||
#include "sword25/gfx/image/image.h"
|
||||
#include "sword25/math/rect.h"
|
||||
|
||||
#if 0
|
||||
#include <vector>
|
||||
#include "agg_path_storage.h"
|
||||
#include "agg_color_rgba.h"
|
||||
|
||||
#endif
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
|
@ -62,7 +62,11 @@ class BS_VectorImage;
|
|||
class BS_VectorPathInfo {
|
||||
public:
|
||||
BS_VectorPathInfo(unsigned int ID, unsigned int LineStyle, unsigned int FillStyle0, unsigned int FillStyle1) :
|
||||
m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {};
|
||||
m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {}
|
||||
|
||||
BS_VectorPathInfo() {
|
||||
m_ID = m_LineStyle = m_FillStyle0 = m_FillStyle1 = 0;
|
||||
}
|
||||
|
||||
unsigned int GetID() const {
|
||||
return m_ID;
|
||||
|
@ -90,11 +94,14 @@ private:
|
|||
Werden alle Elemente eines Vektorbildes übereinandergelegt, ergibt sich das komplette Bild.
|
||||
*/
|
||||
class BS_VectorImageElement {
|
||||
friend BS_VectorImage;
|
||||
friend class BS_VectorImage;
|
||||
public:
|
||||
#if 0 // TODO
|
||||
const agg::path_storage &GetPaths() const {
|
||||
return m_Paths;
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned int GetPathCount() const {
|
||||
return m_PathInfos.size();
|
||||
}
|
||||
|
@ -112,7 +119,7 @@ public:
|
|||
return m_LineStyles.size();
|
||||
}
|
||||
|
||||
const agg::rgba8 &GetLineStyleColor(unsigned int LineStyle) const {
|
||||
uint32 GetLineStyleColor(unsigned int LineStyle) const {
|
||||
BS_ASSERT(LineStyle < m_LineStyles.size());
|
||||
return m_LineStyles[LineStyle].Color;
|
||||
}
|
||||
|
@ -121,7 +128,7 @@ public:
|
|||
return m_FillStyles.size();
|
||||
}
|
||||
|
||||
const agg::rgba8 &GetFillStyleColor(unsigned int FillStyle) const {
|
||||
uint32 GetFillStyleColor(unsigned int FillStyle) const {
|
||||
BS_ASSERT(FillStyle < m_FillStyles.size());
|
||||
return m_FillStyles[FillStyle];
|
||||
}
|
||||
|
@ -132,15 +139,18 @@ public:
|
|||
|
||||
private:
|
||||
struct LineStyleType {
|
||||
LineStyleType(double Width_, const agg::rgba8 &Color_) : Width(Width_), Color(Color_) {};
|
||||
LineStyleType(double Width_, uint32 Color_) : Width(Width_), Color(Color_) {}
|
||||
LineStyleType() { Width = 0; Color = 0; }
|
||||
double Width;
|
||||
agg::rgba8 Color;
|
||||
uint32 Color;
|
||||
};
|
||||
|
||||
#if 0 // TODO
|
||||
agg::path_storage m_Paths;
|
||||
#endif
|
||||
Common::Array<BS_VectorPathInfo> m_PathInfos;
|
||||
Common::Array<LineStyleType> m_LineStyles;
|
||||
Common::Array<agg::rgba8> m_FillStyles;
|
||||
Common::Array<uint32> m_FillStyles;
|
||||
BS_Rect m_BoundingBox;
|
||||
};
|
||||
|
||||
|
@ -201,7 +211,7 @@ public:
|
|||
virtual bool IsSetContentAllowed() const {
|
||||
return false;
|
||||
}
|
||||
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool Blit(int PosX = 0, int PosY = 0,
|
||||
int Flipping = FLIP_NONE,
|
||||
BS_Rect *pPartRect = NULL,
|
||||
|
|
|
@ -38,13 +38,16 @@
|
|||
|
||||
#include "sword25/gfx/image/vectorimagerenderer.h"
|
||||
#include "sword25/gfx/image/vectorimage.h"
|
||||
|
||||
#if 0 // TODO
|
||||
#include "agg_conv_curve.h"
|
||||
#include "agg_path_storage.h"
|
||||
#include "agg_conv_stroke.h"
|
||||
|
||||
#endif
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
#if 0 // TODO
|
||||
// -----------------------------------------------------------------------------
|
||||
// CompoundShape
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -109,23 +112,16 @@ private:
|
|||
const BS_VectorImageElement &m_ImageElement;
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Konstruktion
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
BS_VectorImageRenderer::BS_VectorImageRenderer() :
|
||||
PixelFormat(rbuf) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
|
||||
float ScaleFactorX, float ScaleFactorY,
|
||||
unsigned int &Width, unsigned int &Height,
|
||||
Common::Array<char> & ImageData,
|
||||
byte *ImageData,
|
||||
float LineScaleFactor,
|
||||
bool NoAlphaShapes) {
|
||||
Width = static_cast<unsigned int>(VectorImage.GetWidth() * ScaleFactorX);
|
||||
|
@ -200,4 +196,18 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
|
|||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BS_VectorImageRenderer::BS_VectorImageRenderer() {}
|
||||
|
||||
bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
|
||||
float ScaleFactorX, float ScaleFactorY,
|
||||
unsigned int &Width, unsigned int &Height,
|
||||
byte *ImageData,
|
||||
float LineScaleFactor,
|
||||
bool NoAlphaShapes) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "sword25/kernel/common.h"
|
||||
#include <vector>
|
||||
|
||||
#if 0 // TODO
|
||||
#include "agg_rendering_buffer.h"
|
||||
#include "agg_pixfmt_rgba.h"
|
||||
#include "agg_renderer_scanline.h"
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include "agg_scanline_bin.h"
|
||||
#include "agg_trans_affine.h"
|
||||
#include "agg_span_allocator.h"
|
||||
#endif
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
|
@ -68,11 +69,12 @@ public:
|
|||
bool Render(const BS_VectorImage &VectorImage,
|
||||
float ScaleFactorX, float ScaleFactorY,
|
||||
unsigned int &Width, unsigned int &Height,
|
||||
Common::Array<char> & ImageData,
|
||||
byte *ImageData,
|
||||
float LineScaleFactor = 1.0f,
|
||||
bool NoAlphaShapes = false);
|
||||
|
||||
private:
|
||||
#if 0
|
||||
typedef agg::pixfmt_rgba32_pre PixelFormatType;
|
||||
typedef agg::renderer_base<PixelFormatType> BaseRendererType;
|
||||
typedef agg::renderer_scanline_aa_solid<BaseRendererType> ScanlineRendererType;
|
||||
|
@ -87,6 +89,7 @@ private:
|
|||
agg::scanline_bin ScanlineBin;
|
||||
agg::trans_affine Scale;
|
||||
agg::span_allocator<agg::rgba8> Alloc;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
// INCLUDES
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "sword25/util/glsprites/glsprites.h"
|
||||
#include "sword25/package/packagemanager.h"
|
||||
#include "sword25/gfx/image/imageloader.h"
|
||||
#include "sword25/gfx/opengl/openglgfx.h"
|
||||
|
@ -139,9 +138,9 @@ bool BS_GLImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_GLImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
|
||||
bool BS_GLImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
// Überprüfen, ob PixelData ausreichend viele Pixel enthält um ein Bild der Größe Width * Height zu erzeugen
|
||||
if (Pixeldata.size() < static_cast<unsigned int>(m_Width * m_Height * 4)) {
|
||||
if (size < static_cast<unsigned int>(m_Width * m_Height * 4)) {
|
||||
BS_LOG_ERRORLN("PixelData vector is too small to define a 32 bit %dx%d image.", m_Width, m_Height);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
unsigned int Color = BS_ARGB(255, 255, 255, 255),
|
||||
int Width = -1, int Height = -1);
|
||||
virtual bool Fill(const BS_Rect *pFillRect, unsigned int Color);
|
||||
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset = 0, unsigned int Stride = 0);
|
||||
virtual unsigned int GetPixel(int X, int Y);
|
||||
|
||||
virtual bool IsBlitSource() const {
|
||||
|
|
|
@ -62,7 +62,7 @@ bool BS_VectorImage::Blit(int PosX, int PosY,
|
|||
unsigned int Color,
|
||||
int Width, int Height) {
|
||||
static BS_VectorImageRenderer VectorImageRenderer;
|
||||
static vector<char> PixelData;
|
||||
static byte *PixelData;
|
||||
static GLS_Sprite Sprite = 0;
|
||||
static BS_VectorImage *OldThis = 0;
|
||||
static int OldWidth;
|
||||
|
@ -98,7 +98,7 @@ bool BS_VectorImage::Blit(int PosX, int PosY,
|
|||
return true;
|
||||
}
|
||||
|
||||
GLS_Result Result = GLS_SetSpriteData(Sprite, RenderedWidth, RenderedHeight, &PixelData[0], 0);
|
||||
GLS_Result Result = GLS_SetSpriteData(Sprite, RenderedWidth, RenderedHeight, PixelData, 0);
|
||||
if (Result != GLS_OK) {
|
||||
BS_LOG_ERRORLN("Call to GLS_SetSpriteData() failed. Reason: %s", GLS_ResultString(Result));
|
||||
return false;
|
||||
|
|
|
@ -55,12 +55,8 @@
|
|||
#include "sword25/gfx/opengl/glimage.h"
|
||||
#include "sword25/gfx/opengl/swimage.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define BS_LOG_PREFIX "OPENGLGFX"
|
||||
|
||||
|
||||
|
@ -266,48 +262,50 @@ bool BS_OpenGLGfx::Fill(const BS_Rect *FillRectPtr, unsigned int Color) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, vector<unsigned int> & Data) {
|
||||
if (!ReadFramebufferContents(m_Width, m_Height, Data)) return false;
|
||||
bool BS_OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data) {
|
||||
if (!ReadFramebufferContents(m_Width, m_Height, Data))
|
||||
return false;
|
||||
|
||||
// Die Größe des Framebuffers zurückgeben.
|
||||
Width = m_Width;
|
||||
Height = m_Height;
|
||||
|
||||
// Bilddaten vom OpenGL-Format in unser eigenes Format umwandeln.
|
||||
ReverseRGBAComponentOrder(Data);
|
||||
FlipImagedataVertical(Width, Height, Data);
|
||||
ReverseRGBAComponentOrder(*Data, Width * Height);
|
||||
FlipImagedataVertical(Width, Height, *Data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data) {
|
||||
Data.resize(Width * Height);
|
||||
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, &Data[0]);
|
||||
bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data) {
|
||||
*Data = (byte *)malloc(Width * Height * 4);
|
||||
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, *Data);
|
||||
|
||||
if (glGetError() == 0)
|
||||
return true;
|
||||
else {
|
||||
Data.clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void BS_OpenGLGfx::ReverseRGBAComponentOrder(vector<unsigned int> & Data) {
|
||||
vector<unsigned int>::iterator It = Data.begin();
|
||||
while (It != Data.end()) {
|
||||
unsigned int Pixel = *It;
|
||||
*It = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16);
|
||||
++It;
|
||||
void BS_OpenGLGfx::ReverseRGBAComponentOrder(byte *Data, uint size) {
|
||||
uint32 *ptr = (uint32 *)Data;
|
||||
|
||||
for (uint i = 0; i < size; i++) {
|
||||
unsigned int Pixel = *ptr;
|
||||
*ptr = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16);
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height, vector<unsigned int> & Data) {
|
||||
void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height, byte *Data) {
|
||||
#if 0 // TODO
|
||||
vector<unsigned int> LineBuffer(Width);
|
||||
|
||||
for (unsigned int Y = 0; Y < Height / 2; ++Y) {
|
||||
|
@ -317,26 +315,18 @@ void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height
|
|||
copy(Line2It, Line2It + Width, Line1It);
|
||||
copy(LineBuffer.begin(), LineBuffer.end(), Line2It);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// RESOURCE MANAGING
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static bool DoesStringEndWith(const Common::String &String, const std::string &OtherString) {
|
||||
Common::String::size_type StringPos = String.rfind(OtherString);
|
||||
if (StringPos == Common::String::npos) return false;
|
||||
|
||||
return StringPos + OtherString.size() == String.size();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
|
||||
BS_ASSERT(CanLoadResource(FileName));
|
||||
|
||||
// Bild für den Softwarebuffer laden
|
||||
if (DoesStringEndWith(FileName, PNG_S_EXTENSION)) {
|
||||
if (FileName.hasSuffix(PNG_S_EXTENSION)) {
|
||||
bool Result;
|
||||
BS_SWImage *pImage = new BS_SWImage(FileName, Result);
|
||||
if (!Result) {
|
||||
|
@ -354,7 +344,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
|
|||
}
|
||||
|
||||
// Sprite-Bild laden
|
||||
if (DoesStringEndWith(FileName, PNG_EXTENSION) || DoesStringEndWith(FileName, B25S_EXTENSION)) {
|
||||
if (FileName.hasSuffix(PNG_EXTENSION) || FileName.hasSuffix(B25S_EXTENSION)) {
|
||||
bool Result;
|
||||
BS_GLImage *pImage = new BS_GLImage(FileName, Result);
|
||||
if (!Result) {
|
||||
|
@ -373,7 +363,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
|
|||
|
||||
|
||||
// Vectorgraphik laden
|
||||
if (DoesStringEndWith(FileName, SWF_EXTENSION)) {
|
||||
if (FileName.hasSuffix(SWF_EXTENSION)) {
|
||||
// Pointer auf Package-Manager holen
|
||||
BS_PackageManager *pPackage = BS_Kernel::GetInstance()->GetPackage();
|
||||
BS_ASSERT(pPackage);
|
||||
|
@ -406,7 +396,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
|
|||
}
|
||||
|
||||
// Animation laden
|
||||
if (DoesStringEndWith(FileName, ANI_EXTENSION)) {
|
||||
if (FileName.hasSuffix(ANI_EXTENSION)) {
|
||||
BS_AnimationResource *pResource = new BS_AnimationResource(FileName);
|
||||
if (pResource->IsValid())
|
||||
return pResource;
|
||||
|
@ -417,7 +407,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
|
|||
}
|
||||
|
||||
// Font laden
|
||||
if (DoesStringEndWith(FileName, FNT_EXTENSION)) {
|
||||
if (FileName.hasSuffix(FNT_EXTENSION)) {
|
||||
BS_FontResource *pResource = new BS_FontResource(BS_Kernel::GetInstance(), FileName);
|
||||
if (pResource->IsValid())
|
||||
return pResource;
|
||||
|
@ -434,11 +424,11 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_OpenGLGfx::CanLoadResource(const Common::String &FileName) {
|
||||
return DoesStringEndWith(FileName, PNG_EXTENSION) ||
|
||||
DoesStringEndWith(FileName, ANI_EXTENSION) ||
|
||||
DoesStringEndWith(FileName, FNT_EXTENSION) ||
|
||||
DoesStringEndWith(FileName, SWF_EXTENSION) ||
|
||||
DoesStringEndWith(FileName, B25S_EXTENSION);
|
||||
return FileName.hasSuffix(PNG_EXTENSION) ||
|
||||
FileName.hasSuffix(ANI_EXTENSION) ||
|
||||
FileName.hasSuffix(FNT_EXTENSION) ||
|
||||
FileName.hasSuffix(SWF_EXTENSION) ||
|
||||
FileName.hasSuffix(B25S_EXTENSION);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
virtual bool GetVsync() const;
|
||||
|
||||
virtual bool Fill(const BS_Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0));
|
||||
virtual bool GetScreenshot(unsigned int &Width, unsigned int &Height, Common::Array<unsigned int> & Data);
|
||||
virtual bool GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data);
|
||||
|
||||
// Resource-Managing Methoden
|
||||
// --------------------------
|
||||
|
@ -112,7 +112,8 @@ private:
|
|||
DebugLine(const BS_Vertex &_Start, const BS_Vertex &_End, unsigned int _Color) :
|
||||
Start(_Start),
|
||||
End(_End),
|
||||
Color(_Color) {};
|
||||
Color(_Color) {}
|
||||
DebugLine() {}
|
||||
|
||||
BS_Vertex Start;
|
||||
BS_Vertex End;
|
||||
|
@ -121,9 +122,9 @@ private:
|
|||
|
||||
Common::Array<DebugLine> m_DebugLines;
|
||||
|
||||
static bool ReadFramebufferContents(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data);
|
||||
static void ReverseRGBAComponentOrder(Common::Array<unsigned int> & Data);
|
||||
static void FlipImagedataVertical(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data);
|
||||
static bool ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data);
|
||||
static void ReverseRGBAComponentOrder(byte *Data, uint size);
|
||||
static void FlipImagedataVertical(unsigned int Width, unsigned int Height, byte *Data);
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
|
|
@ -118,7 +118,7 @@ bool BS_SWImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_SWImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
|
||||
bool BS_SWImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
BS_LOG_ERRORLN("SetContent() is not supported.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
unsigned int Color = BS_ARGB(255, 255, 255, 255),
|
||||
int Width = -1, int Height = -1);
|
||||
virtual bool Fill(const BS_Rect *FillRectPtr, unsigned int Color);
|
||||
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
virtual unsigned int GetPixel(int X, int Y);
|
||||
|
||||
virtual bool IsBlitSource() const {
|
||||
|
|
|
@ -152,7 +152,7 @@ unsigned int BS_StaticBitmap::GetPixel(int X, int Y) const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_StaticBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
|
||||
bool BS_StaticBitmap::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
BS_LOG_ERRORLN("SetContent() ist not supported with this object.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
virtual unsigned int GetPixel(int X, int Y) const;
|
||||
|
||||
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
|
||||
virtual bool IsScalingAllowed() const;
|
||||
virtual bool IsAlphaAllowed() const;
|
||||
|
|
|
@ -298,28 +298,28 @@ static int UnregisterCommandCallback(lua_State *L) {
|
|||
static const char *PACKAGE_LIBRARY_NAME = "Input";
|
||||
|
||||
static const luaL_reg PACKAGE_FUNCTIONS[] = {
|
||||
"Init", Init,
|
||||
"Update", Update,
|
||||
"IsLeftMouseDown", IsLeftMouseDown,
|
||||
"IsRightMouseDown", IsRightMouseDown,
|
||||
"WasLeftMouseDown", WasLeftMouseDown,
|
||||
"WasRightMouseDown", WasRightMouseDown,
|
||||
"IsLeftDoubleClick", IsLeftDoubleClick,
|
||||
"GetMouseX", GetMouseX,
|
||||
"GetMouseY", GetMouseY,
|
||||
"SetMouseX", SetMouseX,
|
||||
"SetMouseY", SetMouseY,
|
||||
"IsKeyDown", IsKeyDown,
|
||||
"WasKeyDown", WasKeyDown,
|
||||
"RegisterCharacterCallback", RegisterCharacterCallback,
|
||||
"UnregisterCharacterCallback", UnregisterCharacterCallback,
|
||||
"RegisterCommandCallback", RegisterCommandCallback,
|
||||
"UnregisterCommandCallback", UnregisterCommandCallback,
|
||||
0, 0,
|
||||
{"Init", Init},
|
||||
{"Update", Update},
|
||||
{"IsLeftMouseDown", IsLeftMouseDown},
|
||||
{"IsRightMouseDown", IsRightMouseDown},
|
||||
{"WasLeftMouseDown", WasLeftMouseDown},
|
||||
{"WasRightMouseDown", WasRightMouseDown},
|
||||
{"IsLeftDoubleClick", IsLeftDoubleClick},
|
||||
{"GetMouseX", GetMouseX},
|
||||
{"GetMouseY", GetMouseY},
|
||||
{"SetMouseX", SetMouseX},
|
||||
{"SetMouseY", SetMouseY},
|
||||
{"IsKeyDown", IsKeyDown},
|
||||
{"WasKeyDown", WasKeyDown},
|
||||
{"RegisterCharacterCallback", RegisterCharacterCallback},
|
||||
{"UnregisterCharacterCallback", UnregisterCharacterCallback},
|
||||
{"RegisterCommandCallback", RegisterCommandCallback},
|
||||
{"UnregisterCommandCallback", UnregisterCommandCallback},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
#define X(k) "KEY_" #k, BS_InputEngine::KEY_##k
|
||||
#define Y(k) "KEY_COMMAND_" #k, BS_InputEngine::KEY_COMMAND_##k
|
||||
#define X(k) {"KEY_" #k, BS_InputEngine::KEY_##k}
|
||||
#define Y(k) {"KEY_COMMAND_" #k, BS_InputEngine::KEY_COMMAND_##k}
|
||||
static const lua_constant_reg PACKAGE_CONSTANTS[] = {
|
||||
X(BACKSPACE), X(TAB), X(CLEAR), X(RETURN), X(PAUSE), X(CAPSLOCK), X(ESCAPE), X(SPACE), X(PAGEUP), X(PAGEDOWN), X(END), X(HOME), X(LEFT),
|
||||
X(UP), X(RIGHT), X(DOWN), X(PRINTSCREEN), X(INSERT), X(DELETE), X(0), X(1), X(2), X(3), X(4), X(5), X(6), X(7), X(8), X(9), X(A), X(B),
|
||||
|
|
|
@ -234,26 +234,26 @@ static int GetUsedMemory(lua_State *L) {
|
|||
static const char *KERNEL_LIBRARY_NAME = "Kernel";
|
||||
|
||||
static const luaL_reg KERNEL_FUNCTIONS[] = {
|
||||
"DisconnectService", DisconnectService,
|
||||
"GetActiveServiceIdentifier", GetActiveServiceIdentifier,
|
||||
"GetSuperclassCount", GetSuperclassCount,
|
||||
"GetSuperclassIdentifier", GetSuperclassIdentifier,
|
||||
"GetServiceCount", GetServiceCount,
|
||||
"GetServiceIdentifier", GetServiceIdentifier,
|
||||
"GetMilliTicks", GetMilliTicks,
|
||||
"GetTimer", GetTimer,
|
||||
"StartService", StartService,
|
||||
"Sleep", Sleep,
|
||||
"Crash", Crash,
|
||||
"ExecuteFile", ExecuteFile,
|
||||
"GetUserdataDirectory", GetUserdataDirectory,
|
||||
"GetPathSeparator", GetPathSeparator,
|
||||
"FileExists", FileExists,
|
||||
"CreateDirectory", CreateDirectory,
|
||||
"GetWinCode", GetWinCode,
|
||||
"GetSubversionRevision", GetSubversionRevision,
|
||||
"GetUsedMemory", GetUsedMemory,
|
||||
0, 0,
|
||||
{"DisconnectService", DisconnectService},
|
||||
{"GetActiveServiceIdentifier", GetActiveServiceIdentifier},
|
||||
{"GetSuperclassCount", GetSuperclassCount},
|
||||
{"GetSuperclassIdentifier", GetSuperclassIdentifier},
|
||||
{"GetServiceCount", GetServiceCount},
|
||||
{"GetServiceIdentifier", GetServiceIdentifier},
|
||||
{"GetMilliTicks", GetMilliTicks},
|
||||
{"GetTimer", GetTimer},
|
||||
{"StartService", StartService},
|
||||
{"Sleep", Sleep},
|
||||
{"Crash", Crash},
|
||||
{"ExecuteFile", ExecuteFile},
|
||||
{"GetUserdataDirectory", GetUserdataDirectory},
|
||||
{"GetPathSeparator", GetPathSeparator},
|
||||
{"FileExists", FileExists},
|
||||
{"CreateDirectory", CreateDirectory},
|
||||
{"GetWinCode", GetWinCode},
|
||||
{"GetSubversionRevision", GetSubversionRevision},
|
||||
{"GetUsedMemory", GetUsedMemory},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -495,25 +495,25 @@ static int HasFocus(lua_State *L) {
|
|||
static const char *WINDOW_LIBRARY_NAME = "Window";
|
||||
|
||||
static const luaL_reg WINDOW_FUNCTIONS[] = {
|
||||
"IsVisible", IsVisible,
|
||||
"SetVisible", SetVisible,
|
||||
"GetX", GetX,
|
||||
"SetX", SetX,
|
||||
"GetY", GetY,
|
||||
"SetY", SetY,
|
||||
"GetClientX", GetClientX,
|
||||
"GetClientY", GetClientY,
|
||||
"GetWidth", GetWidth,
|
||||
"GetHeight", GetHeight,
|
||||
"SetWidth", SetWidth,
|
||||
"SetHeight", SetHeight,
|
||||
"GetTitle", GetTitle,
|
||||
"SetTitle", SetTitle,
|
||||
"ProcessMessages", ProcessMessages,
|
||||
"CloseWanted", CloseWanted,
|
||||
"WaitForFocus", WaitForFocus,
|
||||
"HasFocus", HasFocus,
|
||||
0, 0,
|
||||
{"IsVisible", IsVisible},
|
||||
{"SetVisible", SetVisible},
|
||||
{"GetX", GetX},
|
||||
{"SetX", SetX},
|
||||
{"GetY", GetY},
|
||||
{"SetY", SetY},
|
||||
{"GetClientX", GetClientX},
|
||||
{"GetClientY", GetClientY},
|
||||
{"GetWidth", GetWidth},
|
||||
{"GetHeight", GetHeight},
|
||||
{"SetWidth", SetWidth},
|
||||
{"SetHeight", SetHeight},
|
||||
{"GetTitle", GetTitle},
|
||||
{"SetTitle", SetTitle},
|
||||
{"ProcessMessages", ProcessMessages},
|
||||
{"CloseWanted", CloseWanted},
|
||||
{"WaitForFocus", WaitForFocus},
|
||||
{"HasFocus", HasFocus},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -625,15 +625,15 @@ static int DumpLockedResources(lua_State *L) {
|
|||
static const char *RESOURCE_LIBRARY_NAME = "Resource";
|
||||
|
||||
static const luaL_reg RESOURCE_FUNCTIONS[] = {
|
||||
"PrecacheResource", PrecacheResource,
|
||||
"ForcePrecacheResource", ForcePrecacheResource,
|
||||
"GetMaxMemoryUsage", GetMaxMemoryUsage,
|
||||
"SetMaxMemoryUsage", SetMaxMemoryUsage,
|
||||
"EmptyCache", EmptyCache,
|
||||
"IsLogCacheMiss", IsLogCacheMiss,
|
||||
"SetLogCacheMiss", SetLogCacheMiss,
|
||||
"DumpLockedResources", DumpLockedResources,
|
||||
0, 0,
|
||||
{"PrecacheResource", PrecacheResource},
|
||||
{"ForcePrecacheResource", ForcePrecacheResource},
|
||||
{"GetMaxMemoryUsage", GetMaxMemoryUsage},
|
||||
{"SetMaxMemoryUsage", SetMaxMemoryUsage},
|
||||
{"EmptyCache", EmptyCache},
|
||||
{"IsLogCacheMiss", IsLogCacheMiss},
|
||||
{"SetLogCacheMiss", SetLogCacheMiss},
|
||||
{"DumpLockedResources", DumpLockedResources},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -708,16 +708,16 @@ static int SaveGame(lua_State *L) {
|
|||
static const char *PERSISTENCE_LIBRARY_NAME = "Persistence";
|
||||
|
||||
static const luaL_reg PERSISTENCE_FUNCTIONS[] = {
|
||||
"ReloadSlots", ReloadSlots,
|
||||
"GetSlotCount", GetSlotCount,
|
||||
"IsSlotOccupied", IsSlotOccupied,
|
||||
"GetSavegameDirectory", GetSavegameDirectory,
|
||||
"IsSavegameCompatible", IsSavegameCompatible,
|
||||
"GetSavegameDescription", GetSavegameDescription,
|
||||
"GetSavegameFilename", GetSavegameFilename,
|
||||
"LoadGame", LoadGame,
|
||||
"SaveGame", SaveGame,
|
||||
0, 0,
|
||||
{"ReloadSlots", ReloadSlots},
|
||||
{"GetSlotCount", GetSlotCount},
|
||||
{"IsSlotOccupied", IsSlotOccupied},
|
||||
{"GetSavegameDirectory", GetSavegameDirectory},
|
||||
{"IsSavegameCompatible", IsSavegameCompatible},
|
||||
{"GetSavegameDescription", GetSavegameDescription},
|
||||
{"GetSavegameFilename", GetSavegameFilename},
|
||||
{"LoadGame", LoadGame},
|
||||
{"SaveGame", SaveGame},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,10 @@ MODULE_OBJS := \
|
|||
gfx/image/pngloader.o \
|
||||
gfx/image/vectorimage.o \
|
||||
gfx/image/vectorimagerenderer.o \
|
||||
gfx/opengl/glimage.o \
|
||||
gfx/opengl/glvectorimageblit.o \
|
||||
gfx/opengl/openglgfx.o \
|
||||
gfx/opengl/swimage.o \
|
||||
input/inputengine.o \
|
||||
input/inputengine_script.o \
|
||||
kernel/callbackregistry.o \
|
||||
|
@ -60,54 +64,48 @@ MODULE_OBJS := \
|
|||
script/luacallback.o \
|
||||
script/luascript.o \
|
||||
script/lua_extensions.o \
|
||||
sfx/fmodexchannel.o \
|
||||
sfx/fmodexresource.o \
|
||||
sfx/fmodexsound.o \
|
||||
sfx/soundengine.o \
|
||||
sfx/soundengine_script.o \
|
||||
util/glsprites/internal/core.o \
|
||||
util/glsprites/internal/glswindow.o \
|
||||
util/glsprites/internal/sprite.o \
|
||||
util/glsprites/internal/sprite_pow2.o \
|
||||
util/glsprites/internal/sprite_rectangle.o \
|
||||
util/glsprites/internal/sprite_tiled.o \
|
||||
util/glsprites/internal/util.o \
|
||||
util/lua/src/lapi.o \
|
||||
util/lua/src/lauxlib.o \
|
||||
util/lua/src/lbaselib.o \
|
||||
util/lua/src/lcode.o \
|
||||
util/lua/src/ldblib.o \
|
||||
util/lua/src/ldebug.o \
|
||||
util/lua/src/ldo.o \
|
||||
util/lua/src/ldump.o \
|
||||
util/lua/src/lfunc.o \
|
||||
util/lua/src/lgc.o \
|
||||
util/lua/src/linit.o \
|
||||
util/lua/src/liolib.o \
|
||||
util/lua/src/llex.o \
|
||||
util/lua/src/lmathlib.o \
|
||||
util/lua/src/lmem.o \
|
||||
util/lua/src/loadlib.o \
|
||||
util/lua/src/lobject.o \
|
||||
util/lua/src/lopcodes.o \
|
||||
util/lua/src/loslib.o \
|
||||
util/lua/src/lparser.o \
|
||||
util/lua/src/lstate.o \
|
||||
util/lua/src/lstring.o \
|
||||
util/lua/src/lstrlib.o \
|
||||
util/lua/src/ltable.o \
|
||||
util/lua/src/ltablib.o \
|
||||
util/lua/src/ltm.o \
|
||||
util/lua/src/lua.o \
|
||||
util/lua/src/luac.o \
|
||||
util/lua/src/lundump.o \
|
||||
util/lua/src/lvm.o \
|
||||
util/lua/src/lzio.o \
|
||||
util/lua/src/print.o \
|
||||
util/lua/lapi.o \
|
||||
util/lua/lauxlib.o \
|
||||
util/lua/lbaselib.o \
|
||||
util/lua/lcode.o \
|
||||
util/lua/ldblib.o \
|
||||
util/lua/ldebug.o \
|
||||
util/lua/ldo.o \
|
||||
util/lua/ldump.o \
|
||||
util/lua/lfunc.o \
|
||||
util/lua/lgc.o \
|
||||
util/lua/linit.o \
|
||||
util/lua/liolib.o \
|
||||
util/lua/llex.o \
|
||||
util/lua/lmathlib.o \
|
||||
util/lua/lmem.o \
|
||||
util/lua/loadlib.o \
|
||||
util/lua/lobject.o \
|
||||
util/lua/lopcodes.o \
|
||||
util/lua/loslib.o \
|
||||
util/lua/lparser.o \
|
||||
util/lua/lstate.o \
|
||||
util/lua/lstring.o \
|
||||
util/lua/lstrlib.o \
|
||||
util/lua/ltable.o \
|
||||
util/lua/ltablib.o \
|
||||
util/lua/ltm.o \
|
||||
util/lua/lua.o \
|
||||
util/lua/luac.o \
|
||||
util/lua/lundump.o \
|
||||
util/lua/lvm.o \
|
||||
util/lua/lzio.o \
|
||||
util/lua/print.o \
|
||||
util/pluto/pdep.o \
|
||||
util/pluto/pluto.o \
|
||||
util/pluto/plzio.o
|
||||
|
||||
%.o: %.c
|
||||
$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
|
||||
$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||
|
||||
# This module can be built as a plugin
|
||||
ifeq ($(ENABLE_SWORD25), DYNAMIC_PLUGIN)
|
||||
PLUGIN := 1
|
||||
|
|
|
@ -217,18 +217,18 @@ static int FileExists(lua_State *L) {
|
|||
static const char *PACKAGE_LIBRARY_NAME = "Package";
|
||||
|
||||
static const luaL_reg PACKAGE_FUNCTIONS[] = {
|
||||
"LoadPackage", LoadPackage,
|
||||
"LoadDirectoryAsPackage", LoadDirectoryAsPackage,
|
||||
"GetCurrentDirectory", GetCurrentDirectory,
|
||||
"ChangeDirectory", ChangeDirectory,
|
||||
"GetAbsolutePath", GetAbsolutePath,
|
||||
"GetFileSize", GetFileSize,
|
||||
"GetFileType", GetFileType,
|
||||
"FindFiles", FindFiles,
|
||||
"FindDirectories", FindDirectories,
|
||||
"GetFileAsString", GetFileAsString,
|
||||
"FileExists", FileExists,
|
||||
0, 0
|
||||
{"LoadPackage", LoadPackage},
|
||||
{"LoadDirectoryAsPackage", LoadDirectoryAsPackage},
|
||||
{"GetCurrentDirectory", GetCurrentDirectory},
|
||||
{"ChangeDirectory", ChangeDirectory},
|
||||
{"GetAbsolutePath", GetAbsolutePath},
|
||||
{"GetFileSize", GetFileSize},
|
||||
{"GetFileType", GetFileType},
|
||||
{"FindFiles", FindFiles},
|
||||
{"FindDirectories", FindDirectories},
|
||||
{"GetFileAsString", GetFileAsString},
|
||||
{"FileExists", FileExists},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -34,13 +34,9 @@
|
|||
|
||||
#define BS_LOG_PREFIX "SOUNDENGINE"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Includes
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "sword25/sfx/soundengine.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
namespace Sword25 {
|
||||
|
||||
BS_SoundEngine::BS_SoundEngine(BS_Kernel *pKernel) : BS_ResourceService(pKernel) {
|
||||
if (!_RegisterScriptBindings())
|
||||
|
@ -48,3 +44,5 @@ BS_SoundEngine::BS_SoundEngine(BS_Kernel *pKernel) : BS_ResourceService(pKernel)
|
|||
else
|
||||
BS_LOGLN("Script bindings registered.");
|
||||
}
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "sword25/sfx/soundengine.h"
|
||||
|
||||
namespace Sword25 {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int Init(lua_State *L) {
|
||||
|
@ -155,7 +156,7 @@ static int ResumeLayer(lua_State *L) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void ProcessPlayParams(lua_State *L, std::string &FileName, BS_SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) {
|
||||
static void ProcessPlayParams(lua_State *L, Common::String &FileName, BS_SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) {
|
||||
FileName = luaL_checkstring(L, 1);
|
||||
|
||||
Type = static_cast<BS_SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2)));
|
||||
|
@ -185,7 +186,7 @@ static int PlaySound(lua_State *L) {
|
|||
BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
std::string FileName;
|
||||
Common::String FileName;
|
||||
BS_SoundEngine::SOUND_TYPES Type;
|
||||
float Volume;
|
||||
float Pan;
|
||||
|
@ -206,7 +207,7 @@ static int PlaySoundEx(lua_State *L) {
|
|||
BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
std::string FileName;
|
||||
Common::String FileName;
|
||||
BS_SoundEngine::SOUND_TYPES Type;
|
||||
float Volume;
|
||||
float Pan;
|
||||
|
@ -343,33 +344,33 @@ static int GetSoundPanning(lua_State *L) {
|
|||
static const char *SFX_LIBRARY_NAME = "Sfx";
|
||||
|
||||
static const luaL_reg SFX_FUNCTIONS[] = {
|
||||
"Init", Init,
|
||||
"Update", Update,
|
||||
"__SetVolume", SetVolume,
|
||||
"__GetVolume", GetVolume,
|
||||
"PauseAll", PauseAll,
|
||||
"ResumeAll", ResumeAll,
|
||||
"PauseLayer", PauseLayer,
|
||||
"ResumeLayer", ResumeLayer,
|
||||
"__PlaySound", PlaySound,
|
||||
"__PlaySoundEx", PlaySoundEx,
|
||||
"__SetSoundVolume", SetSoundVolume,
|
||||
"__SetSoundPanning", SetSoundPanning,
|
||||
"__PauseSound", PauseSound,
|
||||
"__ResumeSound", ResumeSound,
|
||||
"__StopSound", StopSound,
|
||||
"__IsSoundPaused", IsSoundPaused,
|
||||
"__IsSoundPlaying", IsSoundPlaying,
|
||||
"__GetSoundVolume", GetSoundVolume,
|
||||
"__GetSoundPanning", GetSoundPanning,
|
||||
0, 0,
|
||||
{"Init", Init},
|
||||
{"Update", Update},
|
||||
{"__SetVolume", SetVolume},
|
||||
{"__GetVolume", GetVolume},
|
||||
{"PauseAll", PauseAll},
|
||||
{"ResumeAll", ResumeAll},
|
||||
{"PauseLayer", PauseLayer},
|
||||
{"ResumeLayer", ResumeLayer},
|
||||
{"__PlaySound", PlaySound},
|
||||
{"__PlaySoundEx", PlaySoundEx},
|
||||
{"__SetSoundVolume", SetSoundVolume},
|
||||
{"__SetSoundPanning", SetSoundPanning},
|
||||
{"__PauseSound", PauseSound},
|
||||
{"__ResumeSound", ResumeSound},
|
||||
{"__StopSound", StopSound},
|
||||
{"__IsSoundPaused", IsSoundPaused},
|
||||
{"__IsSoundPlaying", IsSoundPlaying},
|
||||
{"__GetSoundVolume", GetSoundVolume},
|
||||
{"__GetSoundPanning", GetSoundPanning},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static const lua_constant_reg SFX_CONSTANTS[] = {
|
||||
"MUSIC", BS_SoundEngine::MUSIC,
|
||||
"SPEECH", BS_SoundEngine::SPEECH,
|
||||
"SFX", BS_SoundEngine::SFX,
|
||||
0, 0,
|
||||
{"MUSIC", BS_SoundEngine::MUSIC},
|
||||
{"SPEECH", BS_SoundEngine::SPEECH},
|
||||
{"SFX", BS_SoundEngine::SFX},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -387,3 +388,5 @@ bool BS_SoundEngine::_RegisterScriptBindings() {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
|
|
@ -603,7 +603,7 @@ union luai_Cast { double l_d; long l_l; };
|
|||
** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
|
||||
** and with longjmp/setjmp otherwise.
|
||||
*/
|
||||
#if defined(__cplusplus)
|
||||
#if 0 /* defined(__cplusplus) */
|
||||
/* C++ exceptions */
|
||||
#define LUAI_THROW(L,c) throw(c)
|
||||
#define LUAI_TRY(L,c,a) try { a } catch(...) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue