aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-22 14:01:31 +0800
committerchai <chaifix@163.com>2018-08-22 14:01:31 +0800
commit4013357b9dd88c614906263cd5b0657b535bd9cb (patch)
treefde8bb6f4f99b46f453e9e290bc5d7b122d9fbf1
parent36621e6be9604517c900adc0d97665e975c2b325 (diff)
*update
-rw-r--r--bin/jin.exebin548352 -> 548352 bytes
-rw-r--r--build/vs2015/libjin/libjin.vcxproj4
-rw-r--r--build/vs2015/libjin/libjin.vcxproj.filters12
-rw-r--r--src/libjin/Graphics/Geometry.cpp122
-rw-r--r--src/libjin/Graphics/Geometry.h43
-rw-r--r--src/libjin/Graphics/Graphics.h2
6 files changed, 9 insertions, 174 deletions
diff --git a/bin/jin.exe b/bin/jin.exe
index 64a392d..874ca50 100644
--- a/bin/jin.exe
+++ b/bin/jin.exe
Binary files differ
diff --git a/build/vs2015/libjin/libjin.vcxproj b/build/vs2015/libjin/libjin.vcxproj
index 97562ee..48bdb6f 100644
--- a/build/vs2015/libjin/libjin.vcxproj
+++ b/build/vs2015/libjin/libjin.vcxproj
@@ -157,7 +157,7 @@
<ClInclude Include="..\..\..\src\libjin\Graphics\Color.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\Drawable.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\Font.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Geometry.h" />
+ <ClInclude Include="..\..\..\src\libjin\Graphics\Shapes.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\Graphics.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\JSL.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\Texture.h" />
@@ -210,7 +210,7 @@
<ClCompile Include="..\..\..\src\libjin\Graphics\Canvas.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\Drawable.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\Font.cpp" />
- <ClCompile Include="..\..\..\src\libjin\Graphics\Geometry.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\Graphics\Shapes.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\JSL.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\Texture.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\Window.cpp" />
diff --git a/build/vs2015/libjin/libjin.vcxproj.filters b/build/vs2015/libjin/libjin.vcxproj.filters
index 5d35e1e..7452651 100644
--- a/build/vs2015/libjin/libjin.vcxproj.filters
+++ b/build/vs2015/libjin/libjin.vcxproj.filters
@@ -237,9 +237,6 @@
<ClInclude Include="..\..\..\src\libjin\Graphics\Font.h">
<Filter>Source\Graphics</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Geometry.h">
- <Filter>Source\Graphics</Filter>
- </ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\Graphics.h">
<Filter>Source\Graphics</Filter>
</ClInclude>
@@ -255,6 +252,9 @@
<ClInclude Include="..\..\..\src\libjin\Time\Timer.h">
<Filter>Source\Time</Filter>
</ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Graphics\Shapes.h">
+ <Filter>Source\Graphics</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\src\libjin\README.md">
@@ -349,9 +349,6 @@
<ClCompile Include="..\..\..\src\libjin\Graphics\Font.cpp">
<Filter>Source\Graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Graphics\Geometry.cpp">
- <Filter>Source\Graphics</Filter>
- </ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\JSL.cpp">
<Filter>Source\Graphics</Filter>
</ClCompile>
@@ -364,5 +361,8 @@
<ClCompile Include="..\..\..\src\libjin\Time\Timer.cpp">
<Filter>Source\Time</Filter>
</ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\Graphics\Shapes.cpp">
+ <Filter>Source\Graphics</Filter>
+ </ClCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/src/libjin/Graphics/Geometry.cpp b/src/libjin/Graphics/Geometry.cpp
deleted file mode 100644
index 69e3596..0000000
--- a/src/libjin/Graphics/Geometry.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#include "../modules.h"
-#if JIN_MODULES_RENDER
-
-#include "Geometry.h"
-#include "../math/matrix.h"
-#include "../math/constant.h"
-#include <string>
-
-namespace jin
-{
-namespace graphics
-{
-
- void point(int x, int y)
- {
- float vers[] = { x + 0.5f , y + 0.5f };
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, (GLvoid*)vers);
- glDrawArrays(GL_POINTS, 0, 1);
- glDisableClientState(GL_VERTEX_ARRAY);
- }
-
- void points(int n, GLshort* p)
- {
- glEnableClientState(GL_VERTEX_ARRAY);
-
- glVertexPointer(2, GL_SHORT, 0, (GLvoid*)p);
- glDrawArrays(GL_POINTS, 0, n);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- }
-
- void line(int x1, int y1, int x2, int y2)
- {
- glDisable(GL_TEXTURE_2D);
- float verts[] = {
- x1, y1,
- x2, y2
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, (GLvoid*)verts);
- glDrawArrays(GL_LINES, 0, 2);
- glDisableClientState(GL_VERTEX_ARRAY);
- }
-
- void circle(RENDER_MODE mode, int x, int y, int r)
- {
- r = r < 0 ? 0 : r;
-
- int points = 40;
- float two_pi = static_cast<float>(PI * 2);
- if (points <= 0) points = 1;
- float angle_shift = (two_pi / points);
- float phi = .0f;
-
- float *coords = new float[2 * (points + 1)];
- for (int i = 0; i < points; ++i, phi += angle_shift)
- {
- coords[2 * i] = x + r * cos(phi);
- coords[2 * i + 1] = y + r * sin(phi);
- }
-
- coords[2 * points] = coords[0];
- coords[2 * points + 1] = coords[1];
-
- polygon(mode, coords, points);
-
- delete[] coords;
- }
-
- void rect(RENDER_MODE mode, int x, int y, int w, int h)
- {
- float coords[] = { x, y, x + w, y, x + w, y + h, x, y + h };
- polygon(mode, coords, 4);
- }
-
- void triangle(RENDER_MODE mode, int x1, int y1, int x2, int y2, int x3, int y3)
- {
- float coords[] = { x1, y1, x2, y2, x3, y3 };
- polygon(mode, coords, 3);
- }
-
- void polygon_line(float* p, int count)
- {
- float* verts = new float[count * 4];
- for (int i = 0; i < count; ++i)
- {
- // each line has two point n,n+1
- verts[i * 4] = p[i * 2];
- verts[i * 4 + 1] = p[i * 2 + 1];
- verts[i * 4 + 2] = p[(i + 1) % count * 2];
- verts[i * 4 + 3] = p[(i + 1) % count * 2 + 1];
- }
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, (GLvoid*)verts);
- glDrawArrays(GL_LINES, 0, count * 2);
- glDisableClientState(GL_VERTEX_ARRAY);
-
- delete[] verts;
- }
-
- void polygon(RENDER_MODE mode, float* p, int count)
- {
- if (mode == LINE)
- {
- polygon_line(p, count);
- }
- else if (mode == FILL)
- {
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, (const GLvoid*)p);
- glDrawArrays(GL_POLYGON, 0, count);
- glDisableClientState(GL_VERTEX_ARRAY);
- }
- }
-
-}
-}
-
-#endif // JIN_MODULES_RENDER \ No newline at end of file
diff --git a/src/libjin/Graphics/Geometry.h b/src/libjin/Graphics/Geometry.h
deleted file mode 100644
index afd4f7a..0000000
--- a/src/libjin/Graphics/Geometry.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __JIN_GEOMETRY_H
-#define __JIN_GEOMETRY_H
-#include "../modules.h"
-#if JIN_MODULES_RENDER
-
-#include "color.h"
-#include "canvas.h"
-#include "texture.h"
-
-namespace jin
-{
-namespace graphics
-{
-
- typedef enum {
- NONE = 0,
- FILL ,
- LINE
- }RENDER_MODE;
-
- /**
- * TODO:
- * drawPixels(int n, points)
- */
- extern void line(int x1, int y1, int x2, int y2);
-
- extern void rect(RENDER_MODE mode, int x, int y, int w, int h);
-
- extern void triangle(RENDER_MODE mode, int x1, int y1, int x2, int y2, int x3, int y3);
-
- extern void circle(RENDER_MODE mode, int x, int y, int r);
-
- extern void point(int x, int y);
-
- extern void points(int n, GLshort* p, GLubyte* c);
-
- extern void polygon(RENDER_MODE mode, float* p, int count);
-
-}
-}
-
-#endif // JIN_MODULES_RENDER
-#endif // __JIN_GEOMETRY_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Graphics.h b/src/libjin/Graphics/Graphics.h
index 0823978..210dadf 100644
--- a/src/libjin/Graphics/Graphics.h
+++ b/src/libjin/Graphics/Graphics.h
@@ -6,7 +6,7 @@
#include "canvas.h"
#include "color.h"
#include "font.h"
-#include "Geometry.h"
+#include "Shapes.h"
#include "texture.h"
#include "jsl.h"
#include "window.h"