Permalink
Browse files

fix compile errors and warnings on Windows

  • Loading branch information...
jhasse committed Oct 25, 2012
1 parent 4f10dc0 commit 90be2456f42de8c6d92fb1322a4c41ee4d6d3d41
View
@@ -139,7 +139,6 @@ BOOST_PYTHON_MODULE(jngl)
def("mousePressed", mousePressed1);
def("mousePressed", mousePressed2);
def("setMouse", setMouse);
- def("drawButton", drawButton);
def("setTitle", setTitle);
def("setBackgroundColor", setBackgroundColor);
def("setColor", setColor1);
@@ -160,6 +159,8 @@ BOOST_PYTHON_MODULE(jngl)
def("readPixel", readPixel);
def("getWindowWidth", getWindowWidth);
def("getWindowHeight", getWindowHeight);
+ def("getScreenWidth", getScreenWidth);
+ def("getScreenHeight", getScreenHeight);
def("setAntiAliasing", setAntiAliasing);
def("getAntiAliasing", getAntiAliasing);
def("getTextWidth", getTextWidth);
View
@@ -51,7 +51,7 @@ namespace draw
std::vector<T> vertexes;
vertexes.push_back(0);
vertexes.push_back(0);
- for (T t = startAngle; t < 2 * M_PI; t += 0.1) {
+ for (T t = startAngle; t < 2 * M_PI; t += 0.1f) {
vertexes.push_back(width * sin(t));
vertexes.push_back(-height * cos(t));
}
View
@@ -6,7 +6,7 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "framebufferimpl.hpp"
#include "windowptr.hpp"
#include "main.hpp"
-#include "jngl.hpp"
+#include "jngl/matrix.hpp"
namespace jngl {
View
@@ -100,8 +100,7 @@ namespace jngl {
opengl::translate(width_, 0);
}
- double Character::GetWidth() const
- {
+ int Character::getWidth() const {
return width_;
}
@@ -231,21 +230,18 @@ namespace jngl {
return lines;
}
- double FontImpl::getTextWidth(const std::string& text) {
- double maxWidth = 0;
+ int FontImpl::getTextWidth(const std::string& text) {
+ int maxWidth = 0;
std::vector<std::string> lines(ParseString(text));
- std::vector<std::string>::iterator lineEnd = lines.end();
- for(std::vector<std::string>::iterator lineIter = lines.begin(); lineIter != lineEnd; ++lineIter)
- {
- double lineWidth = 0;
- std::string::iterator charEnd = lineIter->end();
- for(std::string::iterator charIter = lineIter->begin(); charIter != charEnd; ++charIter)
- {
- lineWidth += GetCharacter(charIter, charEnd).GetWidth();
+ auto lineEnd = lines.end();
+ for (auto lineIter = lines.begin(); lineIter != lineEnd; ++lineIter) {
+ int lineWidth = 0;
+ auto charEnd = lineIter->end();
+ for (auto charIter = lineIter->begin(); charIter != charEnd; ++charIter) {
+ lineWidth += GetCharacter(charIter, charEnd).getWidth();
}
- if(lineWidth > maxWidth)
- {
+ if (lineWidth > maxWidth) {
maxWidth = lineWidth;
}
}
View
@@ -31,7 +31,7 @@ namespace jngl {
Character(unsigned long ch, unsigned int height, FT_Face);
~Character();
void Draw() const;
- double GetWidth() const;
+ int getWidth() const;
private:
Texture* texture_;
int width_;
@@ -45,7 +45,7 @@ namespace jngl {
FontImpl(const std::string& filename, unsigned int height);
~FontImpl();
void print(int x, int y, const std::string& text);
- double getTextWidth(const std::string& text);
+ int getTextWidth(const std::string& text);
int getLineHeight() const;
void setLineHeight(int);
private:
View
@@ -19,13 +19,14 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "job.hpp"
#include "shapes.hpp"
#include "matrix.hpp"
-#include "rgb.hpp"
#include <string>
#include <vector>
#include <stdexcept>
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
bool running();
@@ -154,4 +155,6 @@ namespace jngl {
std::vector<std::string> getArgs();
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -72,10 +72,10 @@ namespace jngl {
}
int Drawable::getWidth() const {
- return width / getScaleFactor();
+ return int(width / getScaleFactor());
}
int Drawable::getHeight() const {
- return height / getScaleFactor();
+ return int(height / getScaleFactor());
}
}
View
@@ -7,7 +7,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "types.hpp"
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
class Drawable {
public:
@@ -57,4 +59,6 @@ namespace jngl {
int height;
};
}
+#ifndef _MSC_VER
#pragma GCC visibility pop
+#endif
View
@@ -23,7 +23,7 @@ namespace jngl {
std::stack<RGB> rgbs;
void pushFontColor(unsigned char red, unsigned char green, unsigned char blue) {
- rgbs.push({fontColorRed, fontColorGreen, fontColorBlue});
+ rgbs.push(RGB(fontColorRed, fontColorGreen, fontColorBlue));
setFontColor(red, green, blue);
}
View
@@ -8,7 +8,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include <string>
#include <boost/shared_ptr.hpp>
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
class FontImpl;
@@ -36,4 +38,6 @@ namespace jngl {
double getTextWidth(const std::string& text);
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -5,7 +5,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#pragma once
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
class FrameBufferImpl;
@@ -23,4 +25,6 @@ namespace jngl {
FrameBufferImpl* pImpl;
};
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -7,7 +7,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include <string>
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
namespace key {
enum KeyType {
@@ -115,4 +117,6 @@ namespace jngl {
void setMouse(int xposition, int yposition);
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -7,7 +7,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include <boost/shared_ptr.hpp>
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
class Job {
public:
@@ -18,4 +20,6 @@ namespace jngl {
void addJob(boost::shared_ptr<Job> job);
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -5,7 +5,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#pragma once
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
void rotate(double degree);
@@ -26,4 +28,6 @@ namespace jngl {
void reset();
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -7,7 +7,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "types.hpp"
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
Float getScaleFactor();
@@ -17,4 +19,6 @@ namespace jngl {
int getScreenHeight();
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -5,7 +5,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#pragma once
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
void setColor(unsigned char red, unsigned char green, unsigned char blue);
@@ -31,4 +33,6 @@ namespace jngl {
void drawPoint(double x, double y);
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -336,8 +336,8 @@ namespace jngl {
WebPInitDecoderConfig(&config);
if (getScaleFactor() != 1) {
config.options.use_scaling = true;
- width *= getScaleFactor();
- height *= getScaleFactor();
+ width = static_cast<int>(width * getScaleFactor());
+ height = static_cast<int>(height * getScaleFactor());
if (width < 1) width = 1;
if (height < 1) height = 1;
config.options.scaled_width = width;
View
@@ -13,7 +13,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include <string>
#include <vector>
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
class Texture;
@@ -66,4 +68,6 @@ namespace jngl {
void popSpriteAlpha();
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -35,7 +35,7 @@ namespace jngl {
}
void Text::draw() const {
- font->print(x, y, text);
+ font->print(int(x), int(y), text);
glColor4ub(spriteColorRed, spriteColorGreen, spriteColorBlue, spriteColorAlpha);
}
}
View
@@ -10,7 +10,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include <string>
#include <boost/shared_ptr.hpp>
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
enum Alignment {
LEFT,
@@ -35,4 +37,6 @@ namespace jngl {
Alignment align;
};
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
View
@@ -7,7 +7,9 @@ For conditions of distribution and use, see copyright notice in LICENSE.txt
#include <string>
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
+#endif
namespace jngl {
void showWindow(const std::string& title,
int width,
@@ -20,4 +22,6 @@ namespace jngl {
int getDesktopHeight();
}
-#pragma GCC visibility pop
+#ifndef _MSC_VER
+#pragma GCC visibility pop
+#endif
Oops, something went wrong.

0 comments on commit 90be245

Please sign in to comment.