Minor formating fixes.
This commit is contained in:
parent
6f53b0c069
commit
4df668e68f
76 changed files with 121 additions and 121 deletions
|
|
@ -13,10 +13,10 @@ protected :
|
|||
private :
|
||||
|
||||
// Skip implementation to trigger compiler error.
|
||||
NonCopyable(const NonCopyable&);
|
||||
NonCopyable(const NonCopyable&);
|
||||
NonCopyable& operator =(const NonCopyable&);
|
||||
};
|
||||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_CORE_NONCOPYABLE_H */
|
||||
#endif /* SPECTRE_CORE_NONCOPYABLE_H */
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ public :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_DISPLAY_DISPLAYMODE_H */
|
||||
#endif /* SPECTRE_DISPLAY_DISPLAYMODE_H */
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class FPSCounter
|
|||
public :
|
||||
FPSCounter();
|
||||
|
||||
// Add a frame to the counter.
|
||||
// Add a frame to the counter.
|
||||
// Should be called whenever a frame has been rendered.
|
||||
void addFrame();
|
||||
|
||||
|
|
@ -44,4 +44,4 @@ private :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_FPS_COUNTER_H */
|
||||
#endif /* SPECTRE_FPS_COUNTER_H */
|
||||
|
|
|
|||
|
|
@ -46,4 +46,4 @@ protected :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_GAME_TIME_H */
|
||||
#endif /* SPECTRE_GAME_TIME_H */
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ protected :
|
|||
unsigned int m_VBO;
|
||||
|
||||
RenderState m_state;
|
||||
|
||||
|
||||
unsigned short m_size;
|
||||
|
||||
ShaderProgram m_textShader;
|
||||
|
|
@ -73,4 +73,4 @@ protected :
|
|||
|
||||
} // namespace
|
||||
|
||||
#endif /* SPECTRE_BATCH_RENDERER2D_H */
|
||||
#endif /* SPECTRE_BATCH_RENDERER2D_H */
|
||||
|
|
|
|||
|
|
@ -26,4 +26,4 @@ protected :
|
|||
|
||||
} // namespace
|
||||
|
||||
#endif /* SPECTRE_DEFAULT_RENDERER2D_H */
|
||||
#endif /* SPECTRE_DEFAULT_RENDERER2D_H */
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
#include <Spectre/Graphics/GL/glad.h>
|
||||
|
||||
#endif /* SPECTRE_OPENGL_H */
|
||||
#endif /* SPECTRE_OPENGL_H */
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ protected :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_RENDERER2D_H */
|
||||
#endif /* SPECTRE_GRAPHICS_RENDERER2D_H */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public :
|
|||
|
||||
protected :
|
||||
|
||||
// Compile the shader.
|
||||
// Compile the shader.
|
||||
// Returns true if the shader compiled without errors. false otherwise.
|
||||
bool compile();
|
||||
|
||||
|
|
@ -55,4 +55,4 @@ protected :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_SHADER_H */
|
||||
#endif /* SPECTRE_GRAPHICS_SHADER_H */
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ public :
|
|||
|
||||
// Returns true if the program was linked successfully
|
||||
bool isLinked() const;
|
||||
|
||||
// Enable this shader
|
||||
|
||||
// Enable this shader
|
||||
// All shader operations after this call will affect this shader.
|
||||
void enable() const;
|
||||
|
||||
|
||||
// Disable this shader
|
||||
// Operations will no longer affect this shader after this call.
|
||||
void disable() const;
|
||||
|
|
|
|||
|
|
@ -60,4 +60,4 @@ private :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_TRANSFORMABLE_H */
|
||||
#endif /* SPECTRE_GRAPHICS_TRANSFORMABLE_H */
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@ public :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_INPUT_LISTENER_H */
|
||||
#endif /* SPECTRE_INPUT_LISTENER_H */
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "Vector2.h"
|
||||
#include "Matrix4.h"
|
||||
|
||||
namespace sp { namespace math
|
||||
namespace sp { namespace math
|
||||
{
|
||||
float rand(float min, float max);
|
||||
|
||||
|
|
@ -50,4 +50,4 @@ namespace sp { namespace math
|
|||
|
||||
} } // namespace sp
|
||||
|
||||
#endif /* SPECTRE_MATH_MATH_H */
|
||||
#endif /* SPECTRE_MATH_MATH_H */
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ struct Matrix3
|
|||
| 0 3 6 |
|
||||
| 1 4 7 |
|
||||
| 2 5 8 |
|
||||
|_ _|
|
||||
|_ _|
|
||||
*/
|
||||
T v[9];
|
||||
};
|
||||
|
|
@ -32,8 +32,8 @@ struct Matrix3
|
|||
|
||||
inline Matrix3();
|
||||
|
||||
inline Matrix3( T a, T b, T c,
|
||||
T d, T e, T f,
|
||||
inline Matrix3( T a, T b, T c,
|
||||
T d, T e, T f,
|
||||
T g, T h, T i);
|
||||
|
||||
inline Matrix3(T *a);
|
||||
|
|
@ -83,4 +83,4 @@ typedef Matrix3<unsigned> Matrix3u;
|
|||
|
||||
#include "Matrix3.inl"
|
||||
|
||||
#endif /* SPECTRE_MATH_MATRIX3_H */
|
||||
#endif /* SPECTRE_MATH_MATRIX3_H */
|
||||
|
|
|
|||
|
|
@ -108,9 +108,9 @@ Matrix3<T> Matrix3<T>::transpose() const
|
|||
{
|
||||
Matrix3<T> t;
|
||||
|
||||
t.v[0] = v[0]; t.v[3] = v[1]; t.v[6] = v[2];
|
||||
t.v[1] = v[3]; t.v[4] = v[4]; t.v[7] = v[5];
|
||||
t.v[2] = v[6]; t.v[5] = v[7]; t.v[8] = v[8];
|
||||
t.v[0] = v[0]; t.v[3] = v[1]; t.v[6] = v[2];
|
||||
t.v[1] = v[3]; t.v[4] = v[4]; t.v[7] = v[5];
|
||||
t.v[2] = v[6]; t.v[5] = v[7]; t.v[8] = v[8];
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,4 +109,4 @@ typedef Matrix4<unsigned> mat4u;
|
|||
// ----------------
|
||||
#include "Matrix4.inl"
|
||||
|
||||
#endif /* SPECTRE_MATH_MATRIX4_H */
|
||||
#endif /* SPECTRE_MATH_MATRIX4_H */
|
||||
|
|
|
|||
|
|
@ -155,4 +155,4 @@ inline std::ostream& operator<<(std::ostream &s, const Matrix4<T>& mat)
|
|||
return s << mat.toString();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -79,4 +79,4 @@ Vector2f operator*(const Transform& t, const Vector2f& v);
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_MATH_TRANSFORM_H */
|
||||
#endif /* SPECTRE_MATH_TRANSFORM_H */
|
||||
|
|
|
|||
|
|
@ -317,4 +317,4 @@ inline std::ostream& operator<<(std::ostream &s, const Vector2<T>& v)
|
|||
return s << "(" << v.x << "," << v.y << ")";
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ template <typename T>
|
|||
struct Vector3
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
struct {
|
||||
T x, y, z;
|
||||
};
|
||||
T v[3];
|
||||
|
|
|
|||
|
|
@ -268,4 +268,4 @@ inline std::ostream& operator<<(std::ostream &s, const Vector3<T>& v)
|
|||
return s << "(" << v.x << "," << v.y << "," << v.z << ")";
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ template <typename T>
|
|||
struct Vector4
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
struct {
|
||||
T x, y, z, w;
|
||||
};
|
||||
T v[4];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// TODO: Support unprojection, from Screenspace -> Worldspace.
|
||||
|
||||
// TODO: Zoom is implemented using a scale matrix.
|
||||
// TODO: Zoom is implemented using a scale matrix.
|
||||
// It's abit weird to control. Must be a better solution.
|
||||
|
||||
namespace sp {
|
||||
|
|
@ -84,4 +84,4 @@ protected :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_SCENE_CAMERA2D_H */
|
||||
#endif /* SPECTRE_SCENE_CAMERA2D_H */
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ public :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_SCENE_ICAMERA_H */
|
||||
#endif /* SPECTRE_SCENE_ICAMERA_H */
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@ public :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_SYSTEM_MESSAGEHANDLER_H */
|
||||
#endif /* SPECTRE_SYSTEM_MESSAGEHANDLER_H */
|
||||
|
|
|
|||
|
|
@ -38,4 +38,4 @@ public :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SYSTEM_EVENT_H */
|
||||
#endif /* SYSTEM_EVENT_H */
|
||||
|
|
|
|||
|
|
@ -151,4 +151,4 @@ void Display::onReshape(int width, int height)
|
|||
m_context->setSize(width, height);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@ decoration (decoration)
|
|||
{
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -55,4 +55,4 @@ DisplayMode DisplayMode::getDesktopMode()
|
|||
return PlatformMisc::GetDesktopMode();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ void FPSCounter::setUpdateRate(unsigned int ups)
|
|||
if (ups < 1) {
|
||||
ups = 1;
|
||||
}
|
||||
|
||||
|
||||
m_updateRate = ups * 1000;
|
||||
|
||||
// Must reset the counter.
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void GameTime::reset()
|
|||
void GameTime::accumulateTime()
|
||||
{
|
||||
updateTime();
|
||||
|
||||
|
||||
m_acc += (double) (m_current - m_lastUpdate);
|
||||
if (m_acc > (1000.f / m_slice)) {
|
||||
m_acc = 1000.f / m_slice;
|
||||
|
|
@ -77,4 +77,4 @@ void GameTime::updateTime()
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ unsigned int BatchRenderer2D::addRenderable(Vertex2D* buffer, const Renderable2D
|
|||
const Transform& transform = renderable->getTransform();
|
||||
const std::vector<Vertex2D>& vertices = renderable->getVertices();
|
||||
|
||||
// Pretransform vertex positions to skip setting a uniform model
|
||||
// Pretransform vertex positions to skip setting a uniform model
|
||||
// matrix in the shader for each renderable reducing the number of draw calls.
|
||||
|
||||
for(size_t i = 0; i < vertices.size(); i++) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace sp {
|
||||
|
||||
DefaultRenderer2D::DefaultRenderer2D()
|
||||
DefaultRenderer2D::DefaultRenderer2D()
|
||||
{
|
||||
m_shader.create();
|
||||
if (!m_shader.loadFromFile("assets/shaders/standard.shader.glsl")) {
|
||||
|
|
@ -73,4 +73,4 @@ void DefaultRenderer2D::render()
|
|||
m_queue.clear();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ Vector2u Font::findTextureRegion(const Image& img) const
|
|||
resizeTexture();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pos = m_cacheTextureA.texpos;
|
||||
|
||||
m_cacheTextureA.texpos.x += img.getWidth() + 1;
|
||||
|
|
@ -127,4 +127,4 @@ const Texture* Font::getTexture() const
|
|||
return &m_cacheTextureA.texture;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ void FontDriver::setHinting(bool value)
|
|||
m_hinting = value;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -80,14 +80,14 @@ bool FreeTypeDriver::setCharacterSize(unsigned int size)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FreeTypeDriver::loadFromFile(const std::string& filename)
|
||||
bool FreeTypeDriver::loadFromFile(const std::string& filename)
|
||||
{
|
||||
FT_Face face;
|
||||
FT_Error error;
|
||||
|
||||
error = FT_New_Face(LibWrapper::getInstance().handle, filename.c_str(), 0, &face);
|
||||
if (error) {
|
||||
Log::warn("FreeType: could not load file (%s): %s",
|
||||
Log::warn("FreeType: could not load file (%s): %s",
|
||||
filename.c_str(), FT_GetErrorString(error));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -168,4 +168,4 @@ std::string FreeTypeDriver::getName()
|
|||
return m_face->family_name;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
const struct error_list {
|
||||
int code;
|
||||
const char* msg;
|
||||
} ft_errors[] =
|
||||
} ft_errors[] =
|
||||
#include FT_ERRORS_H
|
||||
|
||||
const char* FT_GetErrorString(FT_Error error) {
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@
|
|||
|
||||
const char* FT_GetErrorString(FT_Error error);
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_FONT_FREETYPE_ERROR_H */
|
||||
#endif /* SPECTRE_GRAPHICS_FONT_FREETYPE_ERROR_H */
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ void glCheckError(const char *file, unsigned int line, const char *expr) {
|
|||
if (err != GL_NO_ERROR) {
|
||||
std::string msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <Spectre/Graphics/OpenGL.h>
|
||||
|
||||
#define checkGLError(expr) do { expr; glCheckError(__FILE__, __LINE__, #expr); } while(false)
|
||||
#define checkGLError(expr) do { expr; glCheckError(__FILE__, __LINE__, #expr); } while(false)
|
||||
|
||||
void glCheckError(const char *file, unsigned int line, const char *expr);
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_GL_CHECKERROR_H */
|
||||
#endif /* SPECTRE_GRAPHICS_GL_CHECKERROR_H */
|
||||
|
|
|
|||
|
|
@ -210,4 +210,4 @@ const unsigned char* Image::getPixels() const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -90,4 +90,4 @@ void Graphics::swapBuffers()
|
|||
m_display->swapBuffers();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void RenderState::enableTexture(const Texture *texture)
|
|||
// Enable the new texture.
|
||||
if (texture) {
|
||||
texture->enable();
|
||||
}
|
||||
}
|
||||
// No texture selected.
|
||||
// Must unbind cached texture if set.
|
||||
else if (m_texture) {
|
||||
|
|
@ -49,4 +49,4 @@ void RenderState::cleanup()
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ m_zorder (0)
|
|||
{
|
||||
}
|
||||
|
||||
Renderable2D::Renderable2D(const Vector2f& position) :
|
||||
Renderable2D::Renderable2D(const Vector2f& position) :
|
||||
m_zorder (0),
|
||||
Transformable (position)
|
||||
{
|
||||
|
|
@ -28,4 +28,4 @@ void Renderable2D::setZOrder(unsigned char value)
|
|||
m_zorder = value;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@ void Renderer2D::setCamera(const Camera2D& camera)
|
|||
m_camera = &camera;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -101,4 +101,4 @@ std::string Shader::fetchErrorLog()
|
|||
return std::string(buf);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ bool ShaderProgram::loadFromFile(const std::string& filename)
|
|||
std::string base_name = filename.substr(0, filename.length() - extension.length());
|
||||
|
||||
// vert and frag are not optional. they must exist.
|
||||
return loadFromFile(base_name + "vert.glsl", Shader::Type::Vertex) &&
|
||||
return loadFromFile(base_name + "vert.glsl", Shader::Type::Vertex) &&
|
||||
loadFromFile(base_name + "frag.glsl", Shader::Type::Fragment);
|
||||
|
||||
} else if (extension == "vert.glsl") {
|
||||
|
|
@ -117,7 +117,7 @@ void ShaderProgram::enable() const
|
|||
{
|
||||
glUseProgram(m_id);
|
||||
}
|
||||
|
||||
|
||||
void ShaderProgram::disable() const
|
||||
{
|
||||
glUseProgram(0);
|
||||
|
|
@ -194,4 +194,4 @@ std::string ShaderProgram::fetchErrorLog()
|
|||
return std::string(buf);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ void Sprite::setTextureCoords(const vec2u& pos, const vec2u& size)
|
|||
float left = pos.x / tex_size.x;
|
||||
float right = left + (size.x / tex_size.x);
|
||||
float top = pos.y / tex_size.y;
|
||||
float bottom = top + (size.y / tex_size.y);
|
||||
float bottom = top + (size.y / tex_size.y);
|
||||
|
||||
m_vertices[0].uv = Vector2f(left , top);
|
||||
m_vertices[1].uv = Vector2f(left , bottom);
|
||||
|
|
@ -118,4 +118,4 @@ void Sprite::render(Renderer2D& renderer) const
|
|||
renderer.draw(this);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -177,4 +177,4 @@ void Text::render(Renderer2D& renderer) const
|
|||
renderer.draw(this);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ void Texture::create(unsigned width, unsigned heigth, PixelFormat format)
|
|||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
}
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToInternal(format), width, heigth, 0,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToInternal(format), width, heigth, 0,
|
||||
pixelFormatToGL(format), GL_UNSIGNED_BYTE, &empty_pixels[0]);
|
||||
|
||||
setSmooth(true);
|
||||
|
|
@ -98,7 +98,7 @@ void Texture::create(const Image& image)
|
|||
srcFormat = pixelFormatToGL(image.getFormat());
|
||||
glFormat = pixelFormatToInternal(image.getFormat());
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, glFormat, m_size.x, m_size.y,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, glFormat, m_size.x, m_size.y,
|
||||
0, srcFormat, GL_UNSIGNED_BYTE, image.getPixels());
|
||||
|
||||
setSmooth(true);
|
||||
|
|
@ -157,8 +157,8 @@ void Texture::update(vec2u pos, const Image& image)
|
|||
|
||||
format = pixelFormatToGL(image.getFormat());
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, pos.x, pos.y,
|
||||
image.getWidth(), image.getHeight(),
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, pos.x, pos.y,
|
||||
image.getWidth(), image.getHeight(),
|
||||
format, GL_UNSIGNED_BYTE, image.getPixels());
|
||||
|
||||
disable();
|
||||
|
|
@ -180,9 +180,9 @@ Image Texture::copyToImage() const
|
|||
|
||||
//glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
|
||||
glGetTexImage(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToGL(m_format),
|
||||
GL_UNSIGNED_BYTE,
|
||||
glGetTexImage(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToGL(m_format),
|
||||
GL_UNSIGNED_BYTE,
|
||||
&pixels[0]);
|
||||
|
||||
img.create(m_format, m_size.x, m_size.y, &pixels[0]);
|
||||
|
|
@ -255,4 +255,4 @@ bool Texture::operator!=(const Texture* other) const
|
|||
return m_id != other->m_id;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -96,4 +96,4 @@ const Transform& Transformable::getTransform() const
|
|||
return m_transform;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ void InputDevice::init()
|
|||
{
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace sp {
|
||||
|
||||
InputEvent::InputEvent(Type type) :
|
||||
InputEvent::InputEvent(Type type) :
|
||||
type (type)
|
||||
{
|
||||
}
|
||||
|
|
@ -20,4 +20,4 @@ std::string InputEvent::MouseButtonEvent::getName() const
|
|||
return Mouse::getButtonName(button);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ void InputListener::onInputEvent(const InputEvent& event)
|
|||
{
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void InputModule::registerListener(InputListener* listener)
|
|||
|
||||
void InputModule::removeListener(InputListener* listener)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
Mouse* InputModule::getMouse()
|
||||
|
|
@ -97,4 +97,4 @@ void InputModule::dispatch()
|
|||
m_buffer.clear();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ struct keyentry table[] = {
|
|||
MapSym(Key::Down, "Down"),
|
||||
MapSym(Key::Left, "Left"),
|
||||
MapSym(Key::Right, "Right"),
|
||||
|
||||
|
||||
// Numpad
|
||||
MapSym(Key::NUMPAD_1, "Numpad 1"),
|
||||
MapSym(Key::NUMPAD_2, "Numpad 2"),
|
||||
|
|
@ -113,4 +113,4 @@ std::string Keyboard::getKeyName(Key::Type key)
|
|||
return table[key].name;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ std::string Mouse::getButtonName(MouseButton::Type button)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -129,4 +129,4 @@ Color operator *(const Color& c, unsigned int s)
|
|||
return Color(c.r * s, c.g * s, c.b * s, c.a * s);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace sp { namespace math
|
|||
float bottom, float top,
|
||||
float zNear, float zFar) {
|
||||
|
||||
float rl = (right - left),
|
||||
float rl = (right - left),
|
||||
tb = (top - bottom),
|
||||
fn = (zFar - zNear),
|
||||
rl2 = 2.0f / rl,
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ Transform& operator*=(Transform& a, const Transform& other)
|
|||
return a;
|
||||
}
|
||||
|
||||
Vector2f operator*(const Transform& transform, const Vector2f& vec)
|
||||
Vector2f operator*(const Transform& transform, const Vector2f& vec)
|
||||
{
|
||||
return transform.transformPoint(vec);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,4 @@ public :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_PLATFORM_H */
|
||||
#endif /* SPECTRE_PLATFORM_H */
|
||||
|
|
|
|||
|
|
@ -33,4 +33,4 @@ void PlatformDisplay::onReshape(int width, int height)
|
|||
m_parent->onReshape(width, height);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#ifndef SPECTRE_PLATFORM_DISPLAY_H
|
||||
#define SPECTRE_PLATFORM_DISPLAY_H
|
||||
#define SPECTRE_PLATFORM_DISPLAY_H
|
||||
|
||||
#include <Spectre/Math/Vector2.h>
|
||||
#include <Spectre/Display/DisplayDescription.h>
|
||||
|
|
@ -53,4 +53,4 @@ private :
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* SPECTRE_PLATFORM_DISPLAY_H */
|
||||
#endif /* SPECTRE_PLATFORM_DISPLAY_H */
|
||||
|
|
|
|||
|
|
@ -97,4 +97,4 @@ LRESULT Win32Application::processMessage(MSG msg)
|
|||
return DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace sp {
|
||||
|
||||
// Can't use GLAD's standard loader function because it
|
||||
// Can't use GLAD's standard loader function because it
|
||||
// calls wglGetProcAddress without __stdcall
|
||||
// that results in some runtime exception.
|
||||
static GLADapiproc func_loader(const char *name) {
|
||||
|
|
@ -186,4 +186,4 @@ bool Win32GLContext::setPixelFormat()
|
|||
return false;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -28,4 +28,4 @@ void Win32Input::update()
|
|||
{
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ const char* Win32GetMessage(DWORD messageId) {
|
|||
static char buf[1024] = { '\0' };
|
||||
|
||||
DWORD rc = FormatMessage(
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, messageId,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, messageId,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
buf, 1024, NULL);
|
||||
|
||||
|
||||
if (!rc) {
|
||||
strcpy_s(buf, "Unkown error!\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@
|
|||
|
||||
const char* Win32GetMessage(DWORD messageId);
|
||||
|
||||
#endif /* PLATFORM_WIN32_INTERNAL_H */
|
||||
#endif /* PLATFORM_WIN32_INTERNAL_H */
|
||||
|
|
|
|||
|
|
@ -120,4 +120,4 @@ bool Win32Keyboard::handleMessage(MSG message)
|
|||
return msg_buf.postMessage(message);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ DisplayMode PlatformMisc::GetDesktopMode()
|
|||
return DisplayMode();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace sp {
|
|||
|
||||
static Win32MsgBuffer msg_buf;
|
||||
|
||||
static Vector2f _normalizePos(int x, int y, RECT area)
|
||||
static Vector2f _normalizePos(int x, int y, RECT area)
|
||||
{
|
||||
Vector2f out;
|
||||
|
||||
|
|
@ -75,8 +75,8 @@ void Win32Mouse::update(InputModule *input)
|
|||
m_state[MouseButton::Middle] = event.mouseButton.pressed;
|
||||
input->postInputEvent(event);
|
||||
|
||||
} else if (msg.message == WM_XBUTTONDOWN || msg.message == WM_XBUTTONUP) {
|
||||
|
||||
} else if (msg.message == WM_XBUTTONDOWN || msg.message == WM_XBUTTONUP) {
|
||||
|
||||
int btn = GET_XBUTTON_WPARAM(msg.wParam);
|
||||
InputEvent event(InputEvent::MouseButton);
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ void Win32Mouse::update(InputModule *input)
|
|||
|
||||
InputEvent event(InputEvent::MousePosition);
|
||||
RECT area = GetClientArea(msg.hwnd);
|
||||
|
||||
|
||||
int x = LOWORD(msg.lParam);
|
||||
int y = HIWORD(msg.lParam);
|
||||
|
||||
|
|
@ -116,4 +116,4 @@ bool Win32Mouse::handleMessage(MSG message)
|
|||
return msg_buf.postMessage(message);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ bool Win32MsgBuffer::postMessage(MSG msg)
|
|||
return false;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ struct Win32MsgBuffer {
|
|||
|
||||
} // namespace sp
|
||||
|
||||
#endif /* PLATFORM_WIN32_MSG_BUFFER_H */
|
||||
#endif /* PLATFORM_WIN32_MSG_BUFFER_H */
|
||||
|
|
|
|||
|
|
@ -175,4 +175,4 @@ const Transform& Camera2D::getTransform() const
|
|||
return m_view;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <Spectre/System/Log.h>
|
||||
|
||||
namespace sp
|
||||
namespace sp
|
||||
{
|
||||
|
||||
void Log::info(const char *message, ...) {
|
||||
|
|
|
|||
|
|
@ -17,4 +17,4 @@ SysEvent SysEvent::sizeEvent(Display *display, int width, int height)
|
|||
return event;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue