1
0
Fork 0

Fixing a bunch of compiler warnings.

This commit is contained in:
Henrik Hautakoski 2018-05-12 19:31:34 +02:00
parent ede60da544
commit ebd598b2b0
4 changed files with 11 additions and 11 deletions

View file

@ -221,7 +221,7 @@ unsigned int BatchRenderer2D::addRenderable(Vertex2D* buffer, const Renderable2D
// Pretransform vertex positions to skip setting a uniform model
// matrix in the shader for each renderable reducing the number of draw calls.
for(int i = 0; i < vertices.size(); i++) {
for(size_t i = 0; i < vertices.size(); i++) {
buffer[i].position = transform * vertices[i].position;
buffer[i].color = vertices[i].color;
buffer[i].uv = vertices[i].uv;

View file

@ -37,7 +37,7 @@ void DefaultRenderer2D::render()
glEnableVertexAttribArray(VertexAttribColor0);
glEnableVertexAttribArray(VertexAttribTexCoord0);
for(int i = 0; i < m_queue.size(); i++) {
for(size_t i = 0; i < m_queue.size(); i++) {
const Renderable2D* obj = m_queue[i];
const std::vector<Vertex2D> vertices = obj->getVertices();

View file

@ -19,7 +19,7 @@ void Image::create(unsigned width, unsigned height, const Color& color)
m_pixels.resize(m_size.x * m_size.y * (getBpp() / 8));
for(int i = 0; i < m_pixels.size(); i += 4) {
for(size_t i = 0; i < m_pixels.size(); i += 4) {
m_pixels[i+0] = color.r;
m_pixels[i+1] = color.g;
@ -42,7 +42,7 @@ void Image::create(PixelFormat format, unsigned width, unsigned height, const Co
m_pixels.resize(m_size.x * m_size.y * (getBpp() / 8));
if (getBpp() == 32) {
for(int i = 0; i < m_pixels.size(); i += 4) {
for(size_t i = 0; i < m_pixels.size(); i += 4) {
m_pixels[i+0] = color.r;
m_pixels[i+1] = color.g;
@ -50,14 +50,14 @@ void Image::create(PixelFormat format, unsigned width, unsigned height, const Co
m_pixels[i+3] = color.a;
}
} else if (getBpp() == 24) {
for(int i = 0; i < m_pixels.size(); i += 3) {
for(size_t i = 0; i < m_pixels.size(); i += 3) {
m_pixels[i+0] = color.r;
m_pixels[i+1] = color.g;
m_pixels[i+2] = color.b;
}
} else {
for(int i = 0; i < m_pixels.size(); i += 1) {
for(size_t i = 0; i < m_pixels.size(); i += 1) {
m_pixels[i] = color.a;
}
}
@ -163,7 +163,7 @@ Color Image::getPixel(unsigned x, unsigned y) const
if (m_format == PixelFormat::PF_RGBA) {
c.a = base[3];
} else {
c.a = 1.0f;
c.a = 255;
}
}
// Alpha, single channel format.
@ -178,12 +178,12 @@ void Image::flipY()
unsigned int stride = getStride();
// The quick and dirty way :)
for(int y = 0; y < m_size.y / 2; y++) {
for(size_t y = 0; y < m_size.y / 2; y++) {
int row0 = y * stride;
int row1 = (m_size.y - y - 1) * stride;
for(int x = 0; x < stride; x++) {
for(size_t x = 0; x < stride; x++) {
unsigned char tmp = m_pixels[row0 + x];
m_pixels[row0 + x] = m_pixels[row1 + x];
m_pixels[row1 + x] = tmp;

View file

@ -90,7 +90,7 @@ Vector2f Text::getSize() const
{
Vector2f size;
for(int i = 0; i < m_string.size(); i++) {
for(size_t i = 0; i < m_string.size(); i++) {
Font::Glyph glyph = m_font->getGlyph(m_string[i]);
@ -136,7 +136,7 @@ void Text::updateGeometry() const
m_vertices.clear();
for(int i = 0; i < m_string.length(); i++) {
for(size_t i = 0; i < m_string.length(); i++) {
Vertex2D v1, v2, v3, v4;