New IO structure, unexpexted error in C code
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "stdio.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
extern float* triangleVertexes;
|
||||
double previousTime = 0;
|
||||
double targetFPS = 60.0;
|
||||
@@ -43,14 +44,9 @@ STGSHARPGRAPHICS_API int* versionInfo = &version;
|
||||
// 这是导出函数的一个示例。
|
||||
|
||||
|
||||
STGSHARPGRAPHICS_API IOpackage initPackage(void)
|
||||
{
|
||||
IOpackage pack;
|
||||
pack.InitWindow = InitWindow;
|
||||
return pack;
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API void InitGL()
|
||||
|
||||
STGSHARPGRAPHICS_API void InitGL(void)
|
||||
{
|
||||
|
||||
glfwInit();
|
||||
@@ -139,7 +135,10 @@ STGSHARPGRAPHICS_API void CompileShader(shaderObject* shaderObj)
|
||||
/**/
|
||||
}
|
||||
|
||||
|
||||
STGSHARPGRAPHICS_API int SSGraphicWindowShouldClose(GLFWwindow* window)
|
||||
{
|
||||
return glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API void RenderWindow
|
||||
(
|
||||
@@ -148,14 +147,6 @@ STGSHARPGRAPHICS_API void RenderWindow
|
||||
shaderObject* shaderObj
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
if (1)
|
||||
{
|
||||
|
||||
}
|
||||
// input
|
||||
// -----
|
||||
|
||||
@@ -187,7 +178,6 @@ STGSHARPGRAPHICS_API void RenderWindow
|
||||
// -------------------------------------------------------------------------------
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
}
|
||||
|
||||
STGSHARPGRAPHICS_API void TerminateWindow(shaderObject* shaderObj)
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#ifndef StgSharpGraphic
|
||||
#define StgSharpGraphic
|
||||
|
||||
#include "glad/glad.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
#include "internal.h"
|
||||
#include "geometryHandler.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#define STGSHARPGRAPHICS_EXPORTS
|
||||
|
||||
@@ -17,22 +20,37 @@
|
||||
extern STGSHARPGRAPHICS_API int* versionInfo;
|
||||
/**/
|
||||
|
||||
/// <summary>
|
||||
/// Generate a struct contains all function pointers of
|
||||
/// OpenGL and StgSharp Graphic library Apis.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
STGSHARPGRAPHICS_API IOpackage loadGraphicApi(void);
|
||||
STGSHARPGRAPHICS_API IOpackage loadGraphicApi(void);
|
||||
|
||||
STGSHARPGRAPHICS_API void InitGL(void);
|
||||
|
||||
STGSHARPGRAPHICS_API basicWindowInfo* InitWindow(basicWindowInfo info);
|
||||
|
||||
STGSHARPGRAPHICS_API void CompileShader(shaderObject* shaderObj);
|
||||
|
||||
STGSHARPGRAPHICS_API int SSGraphicWindowShouldClose(GLFWwindow* window);
|
||||
|
||||
STGSHARPGRAPHICS_API void RenderWindow
|
||||
(
|
||||
GLFWwindow* window,
|
||||
basicWindowInfo info,
|
||||
shaderObject* shaderObj
|
||||
);
|
||||
|
||||
STGSHARPGRAPHICS_API void TerminateWindow(shaderObject* shaderObj);
|
||||
|
||||
STGSHARPGRAPHICS_API IOpackage initPackage(void);
|
||||
|
||||
STGSHARPGRAPHICS_API TriangleVertexHandler initTriangle(void);
|
||||
|
||||
STGSHARPGRAPHICS_API void inputTriangle(TriangleVertexHandler triangle);
|
||||
|
||||
STGSHARPGRAPHICS_API Polygon4VertexesHandler initPolygon4(void);
|
||||
|
||||
STGSHARPGRAPHICS_API Polygon5VertexesHandler initPolygon5(void);
|
||||
|
||||
STGSHARPGRAPHICS_API int isNextFrame(unsigned int fps);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
@@ -130,6 +130,7 @@
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -150,6 +151,7 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -171,7 +173,6 @@
|
||||
<ClInclude Include="GLFW\glfw3.h" />
|
||||
<ClInclude Include="GLFW\glfw3native.h" />
|
||||
<ClInclude Include="KHR\khrplatform.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="StgSharpGraphics.h" />
|
||||
<ClInclude Include="internal.h" />
|
||||
</ItemGroup>
|
||||
@@ -180,12 +181,7 @@
|
||||
<ClCompile Include="fpsControl.c" />
|
||||
<ClCompile Include="geometryHandler.c" />
|
||||
<ClCompile Include="glad.c" />
|
||||
<ClCompile Include="pch.c">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="loadApi.c" />
|
||||
<ClCompile Include="StgSharpGraphics.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -193,10 +189,6 @@
|
||||
<Library Include="glfw3dll.lib" />
|
||||
<Library Include="glfw3_mt.lib" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="closecallback.txt" />
|
||||
<Text Include="源.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
<ClInclude Include="StgSharpGraphics.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="glad\glad.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
@@ -53,9 +50,6 @@
|
||||
<ClCompile Include="dllmain.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="glad.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
@@ -65,6 +59,9 @@
|
||||
<ClCompile Include="fpsControl.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="loadApi.c">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="glfw3.lib">
|
||||
@@ -77,12 +74,4 @@
|
||||
<Filter>资源文件</Filter>
|
||||
</Library>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="源.txt">
|
||||
<Filter>资源文件</Filter>
|
||||
</Text>
|
||||
<Text Include="closecallback.txt">
|
||||
<Filter>资源文件</Filter>
|
||||
</Text>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "glad/glad.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
#include "StgSharpGraphics.h"
|
||||
#include "stdio.h"
|
||||
|
||||
typedef struct TriangleVertexHandler
|
||||
|
||||
@@ -2,15 +2,28 @@
|
||||
|
||||
#include "glad/glad.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
#include "StgSharpGraphics.h"
|
||||
#include "framework.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#define init InitProgram;
|
||||
float* triangleVertices;
|
||||
|
||||
#define LoadGL void(*loadOpenGL)(void);
|
||||
#define GLcreateWindow GLFWwindow*(*createWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
|
||||
#define GLmakeContextCurrent void(*MakeContextCurrent)(GLFWwindow* window);
|
||||
#define GLswapInterval void(*swapInterval)(int interval);
|
||||
#define GLwindowShouldClose int(*windowShouldClose)(GLFWwindow* window);
|
||||
#define GLclearColor void(*clearColor)(GLfloat red, GLfloat green, GLfloat blue,GLfloat alpha);
|
||||
|
||||
typedef struct internalIO
|
||||
{
|
||||
void (*InitWindow)(int width,int height);
|
||||
LoadGL;
|
||||
GLcreateWindow;
|
||||
GLmakeContextCurrent;
|
||||
GLswapInterval;
|
||||
GLwindowShouldClose;
|
||||
GLclearColor;
|
||||
}IOpackage;
|
||||
|
||||
typedef struct vec4d
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
#include "glad/glad.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
#include "StgSharpGraphics.h"
|
||||
#include "framework.h"
|
||||
#include "stdio.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
|
||||
STGSHARPGRAPHICS_API IOpackage loadGraphicApi(void)
|
||||
{
|
||||
IOpackage package;
|
||||
package.loadOpenGL = InitGL;
|
||||
package.createWindow = glfwCreateWindow;
|
||||
package.MakeContextCurrent = glfwMakeContextCurrent;
|
||||
package.swapInterval = glfwSwapInterval;
|
||||
package.clearColor = glClearColor;
|
||||
|
||||
return package;
|
||||
}
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1,2 +1,2 @@
|
||||
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
|
||||
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.20348.0:
|
||||
Debug|x64|D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\|
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user