summaryrefslogtreecommitdiff
path: root/2d/_collisions/rectangle_rectangle
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2021-10-31 13:54:11 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2021-10-31 13:54:11 -0400
commit5c613a10364f30bd6add25f7950433f0c482c3ca (patch)
treeaf8f6e481b6400329eca12bd8cdb35e0237d63af /2d/_collisions/rectangle_rectangle
parenta214b4f8977a4b115710b5c9d152b392ac8e24f7 (diff)
(mkosarek) Working undamped spring motion
Diffstat (limited to '2d/_collisions/rectangle_rectangle')
-rw-r--r--2d/_collisions/rectangle_rectangle/main.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/2d/_collisions/rectangle_rectangle/main.cpp b/2d/_collisions/rectangle_rectangle/main.cpp
index 6913749..3cd4f46 100644
--- a/2d/_collisions/rectangle_rectangle/main.cpp
+++ b/2d/_collisions/rectangle_rectangle/main.cpp
@@ -1,4 +1,4 @@
-#include "../../../shared_cpp/OrthographicRenderer.h"
+#include "../../../shared_cpp/Renderer2d.h"
#include "../../../shared_cpp/types.h"
#include "../../../shared_cpp/WebglContext.h"
#include "../../../shared_cpp/mathlib.h"
@@ -67,14 +67,14 @@ struct Edge {
};
struct Rectangle {
- OrthographicShape shape;
+ Mesh2d shape;
Rigidbody body;
Rigidbody previousBody;
Vector4 color;
float32 width = 0.f;
float32 height = 0.f;
- void load(OrthographicRenderer* renderer, Vector4 inColor, float32 inWidth, float32 inHeight) {
+ void load(Renderer2d* renderer, Vector4 inColor, float32 inWidth, float32 inHeight) {
color = inColor.toNormalizedColor();
width = inWidth;;
height = inHeight;
@@ -82,7 +82,7 @@ struct Rectangle {
float32 halfWidth = width / 2.f;
float32 halfHeight = height / 2.f;
- OrthographicVertex vertices[6];
+ Vertex2d vertices[6];
vertices[0].position = Vector2 { -halfWidth, -halfHeight };
vertices[1].position = Vector2 { -halfWidth, halfHeight };
vertices[2].position = Vector2 { halfWidth, halfHeight };
@@ -106,7 +106,7 @@ struct Rectangle {
shape.model = Mat4x4().translateByVec2(body.position).rotate2D(body.rotation);
}
- void render(OrthographicRenderer* renderer) {
+ void render(Renderer2d* renderer) {
shape.render(renderer);
}
@@ -169,7 +169,7 @@ void update(float32 time, void* userData);
void unload();
WebglContext context;
-OrthographicRenderer renderer;
+Renderer2d renderer;
MainLoop mainLoop;
Rectangle rectangleList[4];