aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-09-09 00:34:03 +0800
committerchai <chaifix@163.com>2018-09-09 00:34:03 +0800
commite96eb0f4fb30f2781223a966e2a2deb597a9d1d2 (patch)
tree5bfdf917d1ad0ebc27ca1f8ae4cf37a286e9afff
parent081edca50b4d4fda365c09fad1e013c8467fb648 (diff)
*update
-rw-r--r--bin/Jin.exebin552960 -> 573440 bytes
-rw-r--r--bin/jin.exebin552960 -> 573440 bytes
-rw-r--r--bin/main.lua2
-rw-r--r--build/vc++/jin.vcxproj6
-rw-r--r--build/vc++/libjin/libjin.vcxproj2
-rw-r--r--src/libjin/Graphics/Drawable.cpp4
-rw-r--r--src/libjin/Graphics/Font.cpp6
-rw-r--r--src/libjin/Graphics/Shapes.cpp12
-rw-r--r--src/libjin/Graphics/Window.cpp8
9 files changed, 13 insertions, 27 deletions
diff --git a/bin/Jin.exe b/bin/Jin.exe
index 5690063..074879b 100644
--- a/bin/Jin.exe
+++ b/bin/Jin.exe
Binary files differ
diff --git a/bin/jin.exe b/bin/jin.exe
index 5690063..074879b 100644
--- a/bin/jin.exe
+++ b/bin/jin.exe
Binary files differ
diff --git a/bin/main.lua b/bin/main.lua
index e98eb39..eeec09e 100644
--- a/bin/main.lua
+++ b/bin/main.lua
@@ -48,5 +48,5 @@ function jin.core.onDraw()
jin.graphics.draw(img, 0, 0, 1, 1)
jin.graphics.unuseShader()
jin.graphics.unbindCanvas()
- jin.graphics.draw(canvas, 0, 0, 1, 1)
+ jin.graphics.draw(canvas, 0, 0, 2, 2)
end \ No newline at end of file
diff --git a/build/vc++/jin.vcxproj b/build/vc++/jin.vcxproj
index a5cfb92..bf6cf82 100644
--- a/build/vc++/jin.vcxproj
+++ b/build/vc++/jin.vcxproj
@@ -21,7 +21,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{A3E35ECA-62EB-45CE-8152-674FBC7F7A3B}</ProjectGuid>
<RootNamespace>jin</RootNamespace>
- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<ProjectName>jin(min version)</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -82,7 +82,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
- <Optimization>MinSpace</Optimization>
+ <Optimization>Custom</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)libs\SDL2-2.0.5\include;$(SolutionDir)libs\LuaJIT-2.0.5\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -109,7 +109,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
- <Optimization>MinSpace</Optimization>
+ <Optimization>Custom</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
diff --git a/build/vc++/libjin/libjin.vcxproj b/build/vc++/libjin/libjin.vcxproj
index dc0ed9b..76d6226 100644
--- a/build/vc++/libjin/libjin.vcxproj
+++ b/build/vc++/libjin/libjin.vcxproj
@@ -22,7 +22,7 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{9EE02090-C15E-4520-9C05-C435E45EF2FC}</ProjectGuid>
<RootNamespace>libjin</RootNamespace>
- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<ProjectName>libjin(min version)</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
diff --git a/src/libjin/Graphics/Drawable.cpp b/src/libjin/Graphics/Drawable.cpp
index dc1c8dd..008d54e 100644
--- a/src/libjin/Graphics/Drawable.cpp
+++ b/src/libjin/Graphics/Drawable.cpp
@@ -42,13 +42,9 @@ namespace graphics
glPushMatrix();
glMultMatrixf((const GLfloat*)t.getElements());
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, textCoord);
glVertexPointer(2, GL_FLOAT, 0, vertCoord);
glDrawArrays(GL_QUADS, 0, 4);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
/* pop the model matrix */
glPopMatrix();
diff --git a/src/libjin/Graphics/Font.cpp b/src/libjin/Graphics/Font.cpp
index 1d88280..4988702 100644
--- a/src/libjin/Graphics/Font.cpp
+++ b/src/libjin/Graphics/Font.cpp
@@ -80,9 +80,6 @@ namespace graphics
glBindTexture(GL_TEXTURE_2D, texture);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
// for saving clip quad
stbtt_aligned_quad q;
@@ -141,9 +138,6 @@ namespace graphics
glDrawArrays(GL_QUADS, 0, 4);
}
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
-
glBindTexture(GL_TEXTURE_2D, 0);
}
diff --git a/src/libjin/Graphics/Shapes.cpp b/src/libjin/Graphics/Shapes.cpp
index f4c5093..13935d2 100644
--- a/src/libjin/Graphics/Shapes.cpp
+++ b/src/libjin/Graphics/Shapes.cpp
@@ -14,20 +14,14 @@ 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)
@@ -37,10 +31,8 @@ namespace graphics
x2, y2
};
- glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, (GLvoid*)verts);
glDrawArrays(GL_LINES, 0, 2);
- glDisableClientState(GL_VERTEX_ARRAY);
}
void circle(RenderMode mode, int x, int y, int r)
@@ -92,10 +84,8 @@ namespace graphics
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;
}
@@ -108,10 +98,8 @@ namespace graphics
}
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);
}
}
diff --git a/src/libjin/Graphics/Window.cpp b/src/libjin/Graphics/Window.cpp
index 8d42bbf..68ebe47 100644
--- a/src/libjin/Graphics/Window.cpp
+++ b/src/libjin/Graphics/Window.cpp
@@ -73,6 +73,8 @@ namespace graphics
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
/* avoid white screen blink on windows */
swapBuffers();
/* bind to default canvas */
@@ -82,6 +84,12 @@ namespace graphics
void Window::quitSystem()
{
+ /* disable opengl */
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ /* close window */
SDL_DestroyWindow(wnd);
SDL_Quit();
}