Commits

Anonymous committed 8c78f47

begin coding physics python wrapper and test world object(passed) Python test code is "import physics;world = physics.world();"

  • Participants
  • Parent commits e1bdd84
  • Branches physics

Comments (0)

Files changed (5)

Pygame_Physics.sln

 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
+		PythonDLL_Debug|Win32 = PythonDLL_Debug|Win32
+		PythonDLL_Release|Win32 = PythonDLL_Release|Win32
 		Release|Win32 = Release|Win32
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.Debug|Win32.ActiveCfg = Debug|Win32
 		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.Debug|Win32.Build.0 = Debug|Win32
+		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.PythonDLL_Debug|Win32.ActiveCfg = PythonDLL_Debug|Win32
+		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.PythonDLL_Debug|Win32.Build.0 = PythonDLL_Debug|Win32
+		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.PythonDLL_Release|Win32.ActiveCfg = PythonDLL_Release|Win32
+		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.PythonDLL_Release|Win32.Build.0 = PythonDLL_Release|Win32
 		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.Release|Win32.ActiveCfg = Release|Win32
 		{DCBBE6BC-CD5F-4F51-B5C0-66715D9A72D8}.Release|Win32.Build.0 = Release|Win32
 		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.Debug|Win32.ActiveCfg = Debug|Win32
 		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.Debug|Win32.Build.0 = Debug|Win32
+		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.PythonDLL_Debug|Win32.ActiveCfg = PythonDLL_Debug|Win32
+		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.PythonDLL_Debug|Win32.Build.0 = PythonDLL_Debug|Win32
+		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.PythonDLL_Release|Win32.ActiveCfg = PythonDLL_Release|Win32
+		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.PythonDLL_Release|Win32.Build.0 = PythonDLL_Release|Win32
 		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.Release|Win32.ActiveCfg = Release|Win32
 		{04AC4F22-E18F-4297-A791-A65126FAB7AA}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection

Pygame_Physics.vcproj

 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="PythonDLL_Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\physics.pyd"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="PythonDLL_Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=".\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\physics.pyd"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="PythonDLL_Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_TERMINATE_DEFINED"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\Debug\Pygame_Physics.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="PythonDLL_Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_TERMINATE_DEFINED"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\Debug\Pygame_Physics.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

src/pgBodyObject.c

 {
 	PyObject_HEAD_INIT(NULL)
 	0,
-	"physics.Body",            /* tp_name */
+	"physics.body",            /* tp_name */
 	sizeof(pgBodyObject),      /* tp_basicsize */
 	0,                          /* tp_itemsize */
 	(destructor)PG_BodyDestroy,/* tp_dealloc */

src/pgWorldObject.c

 {
 	PyObject_HEAD_INIT(NULL)
 	0,
-	"physics.World",            /* tp_name */
+	"physics.world",            /* tp_name */
 	sizeof(pgWorldObject),      /* tp_basicsize */
 	0,                          /* tp_itemsize */
 	(destructor) PG_WorldDestroy,/* tp_dealloc */
 	0,                          /* tp_subclasses */
 	0,                          /* tp_weaklist */
 	0                           /* tp_del */
-};
+};
+
+#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
+#define PyMODINIT_FUNC void
+#endif
+PyMODINIT_FUNC
+initphysics(void) 
+{
+	PyObject* m;
+
+	if (PyType_Ready(&pgWorldType) < 0)
+		return;
+
+	m = Py_InitModule3("physics", _pgWorld_methods,
+		"Example module that creates an extension type.");
+
+	if (m == NULL)
+		return;
+
+	Py_INCREF(&pgWorldType);
+	PyModule_AddObject(m, "world", (PyObject *)&pgWorldType);
+}