Skip to content

Commit

Permalink
sprite: Test how broken this is with a ship image at offsets
Browse files Browse the repository at this point in the history
Signed-off-by: Ikey Doherty <ikey.doherty@lispysnake.com>
  • Loading branch information
ikeycode committed Nov 3, 2019
1 parent c5793db commit acc9754
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Binary file added assets/ship.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion source/app.d
Expand Up @@ -73,17 +73,20 @@ public:

/* Create our first player */
p = new Player();
p.reserve(1);
p.add();
p.setPosition(0, vec3f(20.0f, 20.0f));

/* Create 20 enemies */
e = new Enemy();
e.reserve(20);
auto offset = 10;
foreach (i; 0 .. 20)
{
e.add();
if (i % 2 == 0)
e.setFaction(i, Faction.GoodDudes);
e.setPosition(i, vec3f(offset, offset));
offset += 50;
}

context.display.scene.addEntity(p);
Expand Down
6 changes: 3 additions & 3 deletions source/serpent/graphics/renderer/sprite.d
Expand Up @@ -90,7 +90,7 @@ final class SpriteRenderer : Renderer
auto vertex = new Shader(vp);
auto fragment = new Shader(fp);
shader = new Program(vertex, fragment);
texture = new Texture("titlescreen.png");
texture = new Texture("assets/ship.png");
}

final override void render() @system
Expand Down Expand Up @@ -124,8 +124,8 @@ private:
position.z = 0.0f;
position.x = -position.x;

auto width = pipeline.display.width;
auto height = pipeline.display.height;
auto width = 99;
auto height = 75;

auto translation = mat4x4f.translation(position);
auto scale = mat4x4f.scaling(vec3f(width, height, 1.0f));
Expand Down

0 comments on commit acc9754

Please sign in to comment.