aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/je_graphic.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-12-22 10:58:06 +0800
committerchai <chaifix@163.com>2018-12-22 10:58:06 +0800
commit6cb616689535c340b0b4f441c12ef8eb1ee42cb0 (patch)
tree1013294d114d18fd10f363e4645d421e7efbd285 /src/libjin/graphics/je_graphic.cpp
parent71416cb4b388956d6132f6c8b5b77b0fb38b7a27 (diff)
*修改vector访问方式
Diffstat (limited to 'src/libjin/graphics/je_graphic.cpp')
-rw-r--r--src/libjin/graphics/je_graphic.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libjin/graphics/je_graphic.cpp b/src/libjin/graphics/je_graphic.cpp
index 1e18995..964d0e5 100644
--- a/src/libjin/graphics/je_graphic.cpp
+++ b/src/libjin/graphics/je_graphic.cpp
@@ -27,8 +27,8 @@ namespace JinEngine
Graphic::Graphic(const Bitmap* bitmap)
: mTexture(0)
{
- mSize.w = bitmap->getWidth();
- mSize.h = bitmap->getHeight();
+ mSize.w() = bitmap->getWidth();
+ mSize.h() = bitmap->getHeight();
const Color* pixels = bitmap->getPixels();
@@ -36,7 +36,7 @@ namespace JinEngine
gl.bindTexture(mTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- gl.texImage(GL_RGBA8, mSize.w, mSize.h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ gl.texImage(GL_RGBA8, mSize.w(), mSize.h(), GL_RGBA, GL_UNSIGNED_BYTE, pixels);
gl.bindTexture(0);
}
@@ -94,10 +94,10 @@ namespace JinEngine
vertexCoords[4] = slice.w; vertexCoords[5] = slice.h;
vertexCoords[6] = slice.w; vertexCoords[7] = 0;
// Set texture coordinates.
- float slx = slice.x / mSize.w;
- float sly = slice.y / mSize.h;
- float slw = slice.w / mSize.w;
- float slh = slice.h / mSize.h;
+ float slx = slice.x / mSize.w();
+ float sly = slice.y / mSize.h();
+ float slw = slice.w / mSize.w();
+ float slh = slice.h / mSize.h();
textureCoords[0] = slx; textureCoords[1] = sly;
textureCoords[2] = slx; textureCoords[3] = sly + slh;
textureCoords[4] = slx + slw; textureCoords[5] = sly + slh;
@@ -124,7 +124,7 @@ namespace JinEngine
Vector2<float> origin = transform.getOrigin();
Vector2<float> scale = transform.getScale();
float angle = transform.getRotation();
- render(position.x, position.y, scale.x, scale.y, angle, origin.x, origin.y);
+ render(position.x(), position.y(), scale.x(), scale.y(), angle, origin.x(), origin.y());
}
void Graphic::render(const Math::Quad& slice, const Math::Transform& transform) const
@@ -133,7 +133,7 @@ namespace JinEngine
Vector2<float> origin = transform.getOrigin();
Vector2<float> scale = transform.getScale();
float angle = transform.getRotation();
- render(slice, position.x, position.y, scale.x, scale.y, angle, origin.x, origin.y);
+ render(slice, position.x(), position.y(), scale.x(), scale.y(), angle, origin.x(), origin.y());
}
//void Graphic::setFilter(GLint min, GLint max)