summaryrefslogtreecommitdiff
path: root/engine-ocean/Game/Components/DrawComponent.cpp
diff options
context:
space:
mode:
authorjjesswan <jessica_wan@brown.edu>2024-04-22 21:56:26 -0400
committerjjesswan <jessica_wan@brown.edu>2024-04-22 21:56:26 -0400
commita556b45abf18f1bd509daaf63b66b7d55e9fd291 (patch)
treebc9b8a2d184c12aee236e7f9f276a34b84ca552d /engine-ocean/Game/Components/DrawComponent.cpp
parentcd7c76017a12bb548036571c1ff13e551369d06d (diff)
add engine version
Diffstat (limited to 'engine-ocean/Game/Components/DrawComponent.cpp')
-rw-r--r--engine-ocean/Game/Components/DrawComponent.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/engine-ocean/Game/Components/DrawComponent.cpp b/engine-ocean/Game/Components/DrawComponent.cpp
new file mode 100644
index 0000000..28640dd
--- /dev/null
+++ b/engine-ocean/Game/Components/DrawComponent.cpp
@@ -0,0 +1,54 @@
+#include "drawcomponent.h"
+#include <string>
+
+DrawComponent::DrawComponent(std::shared_ptr<Shape> shape, std::string shape_name)
+{
+ m_shape = shape;
+ m_shape_name = shape_name;
+}
+
+DrawComponent::DrawComponent(std::shared_ptr<Shape> shape)
+{
+ m_shape = shape;
+}
+
+DrawComponent::DrawComponent(std::vector<std::shared_ptr<Shape>> shapes)
+{
+ m_shapes = shapes;
+ hasMultipleShapes = true;
+}
+
+
+void DrawComponent::addMaterial(std::string material_name, std::string material_filepath){
+ Global::graphics.addMaterial(material_name, material_filepath);
+ m_material_name = material_name;
+ hasMaterial = true;
+}
+
+std::shared_ptr<Shape> DrawComponent::getShape(){
+ return m_shape;
+}
+
+std::vector<std::shared_ptr<Shape>> DrawComponent::getShapesWithMaterials(){
+ if (hasMultipleShapes){
+ return m_shapes;
+ }
+}
+
+std::string DrawComponent::getShapeName(){
+ return m_shape_name;
+}
+
+std::shared_ptr<Material> DrawComponent::getMaterial(){
+ return Global::graphics.getMaterial(m_material_name);
+}
+
+bool DrawComponent::objHasMaterial(){
+ return hasMaterial;
+}
+
+bool DrawComponent::objHasMultipleShapes(){
+ return hasMultipleShapes;
+}
+
+