]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
added entities
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 10 Sep 2015 15:31:30 +0000 (11:31 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 10 Sep 2015 15:31:30 +0000 (11:31 -0400)
doc/World.htm [new file with mode: 0644]
include/entities.h [new file with mode: 0644]
src/entities.cpp [new file with mode: 0644]

diff --git a/doc/World.htm b/doc/World.htm
new file mode 100644 (file)
index 0000000..d17c551
--- /dev/null
@@ -0,0 +1,40 @@
+<!DOCTYPE html>\r
+<html>\r
+<head>\r
+       <title>World</title>\r
+       <style>\r
+       .code{\r
+               background:#555;\r
+               color:white;\r
+               font-family:Consolas;\r
+               font-size:12px;\r
+               margin:auto 20px;\r
+               padding:20px;\r
+       }\r
+       </style>\r
+</head>\r
+<body>\r
+       <h1>World</h1>\r
+       <hr>\r
+       <h2>Description</h2>\r
+       <p>World.h contains functions to create and draw worlds, and provide basic object detection.</p>\r
+       <br>\r
+       <p>The standard form of world generation in World.h is an array of randomly sized vertical lines.\r
+The width of each line is defined as a single HLINE, a macro defined in common.h. ...</p>\r
+       <h3>class World</h3>\r
+       <div class="code"><b>private:</b><br>\r
+       struct line_t {<br>\r
+               float start;<br>\r
+       } *line;<br>\r
+       unsigned int lineCount;<br>\r
+<b>public:</b><br>\r
+       World(float width);<br>\r
+       void draw(void);<br>\r
+       void detect(vec2 *v,const float width);<br>\r
+       </div>\r
+       <ul>\r
+               <li>struct line_t: float <b>start</b>: Where the top of the line is located.</li>\r
+               <li>unsigned int <b>lineCount</b>: Contains the size of the array <i>line</i>.</li>\r
+       </ul>\r
+</body>\r
+</html>\r
diff --git a/include/entities.h b/include/entities.h
new file mode 100644 (file)
index 0000000..3ecf014
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef ENTITIES_H\r
+#define ENTITIES_H\r
+\r
+#include <common.h>\r
+\r
+\r
+class Entities{\r
+public:\r
+       float width;\r
+       float height;\r
+       float speed;\r
+       int type;\r
+       vec2 loc;\r
+\r
+       void spawn(float, float);\r
+\r
+\r
+};\r
+\r
+class Player : public Entities{\r
+public:\r
+       Player();\r
+       ~Player();\r
+};\r
+\r
+#endif //ENTITIES_H
\ No newline at end of file
diff --git a/src/entities.cpp b/src/entities.cpp
new file mode 100644 (file)
index 0000000..5e86b72
--- /dev/null
@@ -0,0 +1,16 @@
+#include <entities.h>\r
+\r
+void Entities::spawn(float x, float y){\r
+       loc.x = x;\r
+       loc.y = y;\r
+\r
+}\r
+\r
+Player::Player(){\r
+       width = 24;\r
+       height = 42;\r
+       speed = 1;\r
+       type = 0;\r
+}\r
+\r
+Player::~Player(){}
\ No newline at end of file