├── .vs └── BankaiSimple │ └── v15 │ └── .suo ├── BankaiSimple.dsp ├── BankaiSimple.dsw ├── BankaiSimple.ncb ├── BankaiSimple.opt ├── BankaiSimple.plg ├── BankaiSimple.sdf ├── BankaiSimple.sln ├── BankaiSimple.sln.old ├── BankaiSimple.suo ├── BankaiSimple.suo.old ├── BankaiSimple.vcproj ├── BankaiSimple.vcproj.C82DB6ABE0DB485.alex.user ├── BankaiSimple.vcproj.INTRUSO-VAGINAL.alex.user ├── BankaiSimple.vcproj.SILICON_GRAPHIC.alex.user ├── BankaiSimple.vcproj.alex-PC.alex.user ├── BankaiSimple.vcxproj ├── BankaiSimple.vcxproj.filters ├── BankaiSimple.vcxproj.user ├── CODE_OF_CONDUCT.md ├── Debug ├── BankaiSimple.Build.CppClean.log ├── BankaiSimple.exe ├── BankaiSimple.ilk ├── BankaiSimple.lastbuildstate ├── BankaiSimple.log ├── BankaiSimple.pdb ├── BankaiSimple.tlog │ ├── BankaiSimple.lastbuildstate │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ └── link.write.1.tlog ├── BuildLog.htm ├── Frustum.obj ├── HiResTimer.obj ├── InputSystem.obj ├── Joystick.obj ├── Keyboard.obj ├── Mouse.obj ├── Q3Loader.obj ├── SDL.dll ├── SDL_image.dll ├── SDL_mixer.dll ├── SDL_net.dll ├── audio.obj ├── audiosystem.obj ├── bezier.obj ├── camera.obj ├── engine.obj ├── entity.obj ├── font.obj ├── jpeg.dll ├── libpng12.dll ├── libtiff.dll ├── md2.obj ├── mt.dep ├── nivel.obj ├── object.obj ├── ogg.dll ├── oglwindow.obj ├── simpengine.obj ├── smpeg.dll ├── terrain.obj ├── texture.obj ├── tree.obj ├── vc141.idb ├── vc141.pdb ├── vector.obj ├── vorbis.dll ├── vorbisfile.dll ├── winmain.obj ├── world.obj └── zlib1.dll ├── LICENSE ├── README.md ├── UpgradeLog.XML ├── _UpgradeReport_Files ├── UpgradeReport.css ├── UpgradeReport.xslt ├── UpgradeReport_Minus.gif └── UpgradeReport_Plus.gif ├── include └── SDL │ ├── SDL.h │ ├── SDL_active.h │ ├── SDL_audio.h │ ├── SDL_byteorder.h │ ├── SDL_cdrom.h │ ├── SDL_config.h │ ├── SDL_config.h.default │ ├── SDL_config.h.in │ ├── SDL_config_amiga.h │ ├── SDL_config_dreamcast.h │ ├── SDL_config_macos.h │ ├── SDL_config_macosx.h │ ├── SDL_config_minimal.h │ ├── SDL_config_os2.h │ ├── SDL_config_win32.h │ ├── SDL_copying.h │ ├── SDL_cpuinfo.h │ ├── SDL_endian.h │ ├── SDL_error.h │ ├── SDL_events.h │ ├── SDL_getenv.h │ ├── SDL_image.h │ ├── SDL_joystick.h │ ├── SDL_keyboard.h │ ├── SDL_keysym.h │ ├── SDL_loadso.h │ ├── SDL_main.h │ ├── SDL_mixer.h │ ├── SDL_mouse.h │ ├── SDL_mutex.h │ ├── SDL_name.h │ ├── SDL_net.h │ ├── SDL_opengl.h │ ├── SDL_platform.h │ ├── SDL_quit.h │ ├── SDL_rwops.h │ ├── SDL_stdinc.h │ ├── SDL_syswm.h │ ├── SDL_thread.h │ ├── SDL_timer.h │ ├── SDL_types.h │ ├── SDL_version.h │ ├── SDL_video.h │ ├── begin_code.h │ └── close_code.h ├── lib ├── SDL.lib ├── SDL_image.lib ├── SDL_mixer.lib ├── SDL_net.lib └── SDLmain.lib ├── models ├── T8dm6.bsp ├── ascend.bsp ├── ciudad.bsp ├── final.bsp ├── final3.bsp ├── newmap.bsp ├── nivel.bsp ├── ogro │ ├── Ogro.txt │ ├── igdosh.pcx │ ├── ogrobase.pcx │ ├── tris.md2 │ ├── weapon.md2 │ └── weapon.pcx ├── q3dm7.bsp └── sodf8 │ ├── SFOD8.txt │ ├── abarlith.pcx │ ├── tris.md2 │ ├── weapon.md2 │ └── weapon.pcx ├── screenshots ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png └── 6.png ├── sounds ├── CANYON.MID └── ambient.wav ├── src ├── Frustum.cpp ├── Frustum.h ├── Glext.h ├── HiResTimer.cpp ├── HiResTimer.h ├── InputSystem.cpp ├── InputSystem.h ├── Joystick.cpp ├── Joystick.h ├── Keyboard.cpp ├── Keyboard.h ├── Mouse.cpp ├── Mouse.h ├── Q3Loader.cpp ├── Q3Loader.h ├── audio.cpp ├── audio.h ├── audiosystem.cpp ├── audiosystem.h ├── bezier.cpp ├── bezier.h ├── camera.cpp ├── camera.h ├── engine.cpp ├── engine.h ├── entity.cpp ├── entity.h ├── font.cpp ├── font.h ├── md2.cpp ├── md2.h ├── nivel.cpp ├── nivel.h ├── object.cpp ├── object.h ├── oglwindow.cpp ├── oglwindow.h ├── simpengine.cpp ├── simpengine.h ├── terrain.cpp ├── terrain.h ├── texture.cpp ├── texture.h ├── tree.cpp ├── tree.h ├── vector.cpp ├── vector.h ├── winmain.cpp ├── world.cpp └── world.h └── textures ├── Sky.tga ├── Thumbs.db ├── egyptians ├── ankhlite_wht.jpg ├── ankhlite_ylw.blend.jpg ├── ankhlite_ylw.jpg ├── bounce_effects.jpg ├── gold_groove.jpg ├── gold_trim01.jpg ├── gold_trim02.jpg ├── gold_trim03.jpg ├── heiro_01.jpg ├── leaf.tga ├── oldbrk_01.jpg ├── oldbrk_01broken13.jpg ├── oldbrk_03.jpg ├── oldbrk_03_bloody.jpg ├── oldstone2.jpg ├── oldstone2_bas01.jpg ├── oldstone2_bas03.jpg ├── oldstone2_bas04.jpg ├── oldstone2_bas05.jpg ├── oldstone2_bas06.jpg ├── oldstone2_bas07.jpg ├── oldstone2_step.jpg ├── oldstone2_trim01.jpg ├── oldstone2_trim02.jpg ├── oldstone2grooved.jpg ├── oldstone_ramses.jpg ├── plant_egy.tga ├── sand_egy.jpg └── stei_tele2.jpg └── ground.tga /.vs/BankaiSimple/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/.vs/BankaiSimple/v15/.suo -------------------------------------------------------------------------------- /BankaiSimple.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "BankaiSimple"=".\BankaiSimple.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /BankaiSimple.ncb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/BankaiSimple.ncb -------------------------------------------------------------------------------- /BankaiSimple.opt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/BankaiSimple.opt -------------------------------------------------------------------------------- /BankaiSimple.plg: -------------------------------------------------------------------------------- 1 | 2 | 3 |
 4 | 

Build Log

5 |

6 | --------------------Configuration: BankaiSimple - Win32 Debug-------------------- 7 |

8 |

Command Lines

9 | Creating temporary file "C:\DOCUME~1\jose\CONFIG~1\Temp\RSP34.tmp" with contents 10 | [ 11 | /nologo /MLd /W3 /Gm /GR /GX /ZI /Od /I "include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/BankaiSimple.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 12 | "C:\Documents and Settings\jose\Escritorio\BankaiSimple\src\winmain.cpp" 13 | ] 14 | Creating command line "cl.exe @C:\DOCUME~1\jose\CONFIG~1\Temp\RSP34.tmp" 15 | Creating temporary file "C:\DOCUME~1\jose\CONFIG~1\Temp\RSP35.tmp" with contents 16 | [ 17 | SDL_image.lib SDL_mixer.lib SDL.lib OpenGL32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/BankaiSimple.pdb" /debug /machine:I386 /out:"Debug/BankaiSimple.exe" /pdbtype:sept /libpath:"lib" 18 | ".\Debug\audio.obj" 19 | ".\Debug\audiosystem.obj" 20 | ".\Debug\camera.obj" 21 | ".\Debug\engine.obj" 22 | ".\Debug\entity.obj" 23 | ".\Debug\font.obj" 24 | ".\Debug\HiResTimer.obj" 25 | ".\Debug\InputSystem.obj" 26 | ".\Debug\Joystick.obj" 27 | ".\Debug\Keyboard.obj" 28 | ".\Debug\md2.obj" 29 | ".\Debug\Mouse.obj" 30 | ".\Debug\object.obj" 31 | ".\Debug\oglwindow.obj" 32 | ".\Debug\simpengine.obj" 33 | ".\Debug\terrain.obj" 34 | ".\Debug\texture.obj" 35 | ".\Debug\tree.obj" 36 | ".\Debug\vector.obj" 37 | ".\Debug\winmain.obj" 38 | ".\Debug\world.obj" 39 | ] 40 | Creating command line "link.exe @C:\DOCUME~1\jose\CONFIG~1\Temp\RSP35.tmp" 41 |

Output Window

42 | Compiling... 43 | winmain.cpp 44 | C:\Documents and Settings\jose\Escritorio\BankaiSimple\src\winmain.cpp(25) : warning C4007: 'WinMain' : must be '__stdcall' 45 | Linking... 46 | 47 | 48 | 49 |

Results

50 | BankaiSimple.exe - 0 error(s), 1 warning(s) 51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /BankaiSimple.sdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/BankaiSimple.sdf -------------------------------------------------------------------------------- /BankaiSimple.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BankaiSimple", "BankaiSimple.vcxproj", "{35CCED3D-CB4C-4F83-A72A-1ED103E3727D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Debug|Win32.Build.0 = Debug|Win32 14 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Release|Win32.ActiveCfg = Release|Win32 15 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /BankaiSimple.sln.old: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BankaiSimple", "BankaiSimple.vcproj", "{35CCED3D-CB4C-4F83-A72A-1ED103E3727D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Debug|Win32.Build.0 = Debug|Win32 14 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Release|Win32.ActiveCfg = Release|Win32 15 | {35CCED3D-CB4C-4F83-A72A-1ED103E3727D}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /BankaiSimple.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/BankaiSimple.suo -------------------------------------------------------------------------------- /BankaiSimple.suo.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/BankaiSimple.suo.old -------------------------------------------------------------------------------- /BankaiSimple.vcproj.C82DB6ABE0DB485.alex.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /BankaiSimple.vcproj.INTRUSO-VAGINAL.alex.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /BankaiSimple.vcproj.SILICON_GRAPHIC.alex.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /BankaiSimple.vcproj.alex-PC.alex.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /BankaiSimple.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at alejandro.villey@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /Debug/BankaiSimple.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.exe -------------------------------------------------------------------------------- /Debug/BankaiSimple.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.ilk -------------------------------------------------------------------------------- /Debug/BankaiSimple.lastbuildstate: -------------------------------------------------------------------------------- 1 | #v4.0:v100 2 | Debug|Win32|J:\bankaiultimo\BankaiSimple\| 3 | -------------------------------------------------------------------------------- /Debug/BankaiSimple.log: -------------------------------------------------------------------------------- 1 | cl : Línea de comandos warning D9035: La opción 'Gm' está desusada y se quitará en próximas versiones 2 | nivel.cpp 3 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(297): warning C4018: '<': no coinciden signed/unsigned 4 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(316): warning C4244: '=': conversión de 'double' a 'float'; posible pérdida de datos 5 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(317): warning C4244: '=': conversión de 'double' a 'float'; posible pérdida de datos 6 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(318): warning C4244: '=': conversión de 'double' a 'float'; posible pérdida de datos 7 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(355): warning C4018: '<': no coinciden signed/unsigned 8 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(371): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 9 | c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h(208): note: vea la declaración de 'fopen' 10 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(374): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 11 | c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\string.h(133): note: vea la declaración de 'strcpy' 12 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(378): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 13 | c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h(208): note: vea la declaración de 'fopen' 14 | c:\users\alex\desktop\bankaiultimo\bankaisimple\src\nivel.cpp(381): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 15 | c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\string.h(133): note: vea la declaración de 'strcpy' 16 | BankaiSimple.vcxproj -> C:\Users\alex\Desktop\bankaiultimo\BankaiSimple\.\Debug\BankaiSimple.exe 17 | -------------------------------------------------------------------------------- /Debug/BankaiSimple.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.pdb -------------------------------------------------------------------------------- /Debug/BankaiSimple.tlog/BankaiSimple.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0 2 | Debug|Win32|C:\Users\alex\Desktop\bankaiultimo\BankaiSimple\| 3 | -------------------------------------------------------------------------------- /Debug/BankaiSimple.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /Debug/BankaiSimple.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Debug/BankaiSimple.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Debug/BankaiSimple.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Debug/BankaiSimple.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Debug/BankaiSimple.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BankaiSimple.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Debug/BuildLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/BuildLog.htm -------------------------------------------------------------------------------- /Debug/Frustum.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/Frustum.obj -------------------------------------------------------------------------------- /Debug/HiResTimer.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/HiResTimer.obj -------------------------------------------------------------------------------- /Debug/InputSystem.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/InputSystem.obj -------------------------------------------------------------------------------- /Debug/Joystick.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/Joystick.obj -------------------------------------------------------------------------------- /Debug/Keyboard.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/Keyboard.obj -------------------------------------------------------------------------------- /Debug/Mouse.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/Mouse.obj -------------------------------------------------------------------------------- /Debug/Q3Loader.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/Q3Loader.obj -------------------------------------------------------------------------------- /Debug/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/SDL.dll -------------------------------------------------------------------------------- /Debug/SDL_image.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/SDL_image.dll -------------------------------------------------------------------------------- /Debug/SDL_mixer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/SDL_mixer.dll -------------------------------------------------------------------------------- /Debug/SDL_net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/SDL_net.dll -------------------------------------------------------------------------------- /Debug/audio.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/audio.obj -------------------------------------------------------------------------------- /Debug/audiosystem.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/audiosystem.obj -------------------------------------------------------------------------------- /Debug/bezier.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/bezier.obj -------------------------------------------------------------------------------- /Debug/camera.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/camera.obj -------------------------------------------------------------------------------- /Debug/engine.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/engine.obj -------------------------------------------------------------------------------- /Debug/entity.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/entity.obj -------------------------------------------------------------------------------- /Debug/font.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/font.obj -------------------------------------------------------------------------------- /Debug/jpeg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/jpeg.dll -------------------------------------------------------------------------------- /Debug/libpng12.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/libpng12.dll -------------------------------------------------------------------------------- /Debug/libtiff.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/libtiff.dll -------------------------------------------------------------------------------- /Debug/md2.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/md2.obj -------------------------------------------------------------------------------- /Debug/mt.dep: -------------------------------------------------------------------------------- 1 | Manifest resource last updated at 11:08:45,21 on 11/06/2009 2 | -------------------------------------------------------------------------------- /Debug/nivel.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/nivel.obj -------------------------------------------------------------------------------- /Debug/object.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/object.obj -------------------------------------------------------------------------------- /Debug/ogg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/ogg.dll -------------------------------------------------------------------------------- /Debug/oglwindow.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/oglwindow.obj -------------------------------------------------------------------------------- /Debug/simpengine.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/simpengine.obj -------------------------------------------------------------------------------- /Debug/smpeg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/smpeg.dll -------------------------------------------------------------------------------- /Debug/terrain.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/terrain.obj -------------------------------------------------------------------------------- /Debug/texture.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/texture.obj -------------------------------------------------------------------------------- /Debug/tree.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/tree.obj -------------------------------------------------------------------------------- /Debug/vc141.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/vc141.idb -------------------------------------------------------------------------------- /Debug/vc141.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/vc141.pdb -------------------------------------------------------------------------------- /Debug/vector.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/vector.obj -------------------------------------------------------------------------------- /Debug/vorbis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/vorbis.dll -------------------------------------------------------------------------------- /Debug/vorbisfile.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/vorbisfile.dll -------------------------------------------------------------------------------- /Debug/winmain.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/winmain.obj -------------------------------------------------------------------------------- /Debug/world.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/world.obj -------------------------------------------------------------------------------- /Debug/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/Debug/zlib1.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 3dEngineOpenGL 2 | 3 | This is a 3d engine written from scratch in my last semester on the university (Spring 2009) 4 | ### Features 5 | 6 | * Write in C++ using OpenGL and SDL 7 | * Frustrum Culling 8 | * BSP trees 9 | * Collisions with BSP Trees 10 | * Lightmaps 11 | 12 | ## Captures 13 | ![1](https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/master/screenshots/1.png) 14 | ![2](https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/master/screenshots/2.png) 15 | ![3](https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/master/screenshots/3.png) 16 | ![4](https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/master/screenshots/4.png) 17 | ![5](https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/master/screenshots/5.png) 18 | ![6](https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/master/screenshots/6.png) 19 | 20 | ## Video 21 | ![video](https://img.youtube.com/vi/BfZUrH3YuSM/0.jpg)(https://www.youtube.com/watch?v=BfZUrH3YuSM 22 | -------------------------------------------------------------------------------- /UpgradeLog.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /_UpgradeReport_Files/UpgradeReport.css: -------------------------------------------------------------------------------- 1 | BODY 2 | { 3 | BACKGROUND-COLOR: white; 4 | FONT-FAMILY: "Verdana", sans-serif; 5 | FONT-SIZE: 100%; 6 | MARGIN-LEFT: 0px; 7 | MARGIN-TOP: 0px 8 | } 9 | P 10 | { 11 | FONT-FAMILY: "Verdana", sans-serif; 12 | FONT-SIZE: 70%; 13 | LINE-HEIGHT: 12pt; 14 | MARGIN-BOTTOM: 0px; 15 | MARGIN-LEFT: 10px; 16 | MARGIN-TOP: 10px 17 | } 18 | .note 19 | { 20 | BACKGROUND-COLOR: #ffffff; 21 | COLOR: #336699; 22 | FONT-FAMILY: "Verdana", sans-serif; 23 | FONT-SIZE: 100%; 24 | MARGIN-BOTTOM: 0px; 25 | MARGIN-LEFT: 0px; 26 | MARGIN-TOP: 0px; 27 | PADDING-RIGHT: 10px 28 | } 29 | .infotable 30 | { 31 | BACKGROUND-COLOR: #f0f0e0; 32 | BORDER-BOTTOM: #ffffff 0px solid; 33 | BORDER-COLLAPSE: collapse; 34 | BORDER-LEFT: #ffffff 0px solid; 35 | BORDER-RIGHT: #ffffff 0px solid; 36 | BORDER-TOP: #ffffff 0px solid; 37 | FONT-SIZE: 70%; 38 | MARGIN-LEFT: 10px 39 | } 40 | .issuetable 41 | { 42 | BACKGROUND-COLOR: #ffffe8; 43 | BORDER-COLLAPSE: collapse; 44 | COLOR: #000000; 45 | FONT-SIZE: 100%; 46 | MARGIN-BOTTOM: 10px; 47 | MARGIN-LEFT: 13px; 48 | MARGIN-TOP: 0px 49 | } 50 | .issuetitle 51 | { 52 | BACKGROUND-COLOR: #ffffff; 53 | BORDER-BOTTOM: #dcdcdc 1px solid; 54 | BORDER-TOP: #dcdcdc 1px; 55 | COLOR: #003366; 56 | FONT-WEIGHT: normal 57 | } 58 | .header 59 | { 60 | BACKGROUND-COLOR: #cecf9c; 61 | BORDER-BOTTOM: #ffffff 1px solid; 62 | BORDER-LEFT: #ffffff 1px solid; 63 | BORDER-RIGHT: #ffffff 1px solid; 64 | BORDER-TOP: #ffffff 1px solid; 65 | COLOR: #000000; 66 | FONT-WEIGHT: bold 67 | } 68 | .issuehdr 69 | { 70 | BACKGROUND-COLOR: #E0EBF5; 71 | BORDER-BOTTOM: #dcdcdc 1px solid; 72 | BORDER-TOP: #dcdcdc 1px solid; 73 | COLOR: #000000; 74 | FONT-WEIGHT: normal 75 | } 76 | .issuenone 77 | { 78 | BACKGROUND-COLOR: #ffffff; 79 | BORDER-BOTTOM: 0px; 80 | BORDER-LEFT: 0px; 81 | BORDER-RIGHT: 0px; 82 | BORDER-TOP: 0px; 83 | COLOR: #000000; 84 | FONT-WEIGHT: normal 85 | } 86 | .content 87 | { 88 | BACKGROUND-COLOR: #e7e7ce; 89 | BORDER-BOTTOM: #ffffff 1px solid; 90 | BORDER-LEFT: #ffffff 1px solid; 91 | BORDER-RIGHT: #ffffff 1px solid; 92 | BORDER-TOP: #ffffff 1px solid; 93 | PADDING-LEFT: 3px 94 | } 95 | .issuecontent 96 | { 97 | BACKGROUND-COLOR: #ffffff; 98 | BORDER-BOTTOM: #dcdcdc 1px solid; 99 | BORDER-TOP: #dcdcdc 1px solid; 100 | PADDING-LEFT: 3px 101 | } 102 | A:link 103 | { 104 | COLOR: #cc6633; 105 | TEXT-DECORATION: underline 106 | } 107 | A:visited 108 | { 109 | COLOR: #cc6633; 110 | } 111 | A:active 112 | { 113 | COLOR: #cc6633; 114 | } 115 | A:hover 116 | { 117 | COLOR: #cc3300; 118 | TEXT-DECORATION: underline 119 | } 120 | H1 121 | { 122 | BACKGROUND-COLOR: #003366; 123 | BORDER-BOTTOM: #336699 6px solid; 124 | COLOR: #ffffff; 125 | FONT-SIZE: 130%; 126 | FONT-WEIGHT: normal; 127 | MARGIN: 0em 0em 0em -20px; 128 | PADDING-BOTTOM: 8px; 129 | PADDING-LEFT: 30px; 130 | PADDING-TOP: 16px 131 | } 132 | H2 133 | { 134 | COLOR: #000000; 135 | FONT-SIZE: 80%; 136 | FONT-WEIGHT: bold; 137 | MARGIN-BOTTOM: 3px; 138 | MARGIN-LEFT: 10px; 139 | MARGIN-TOP: 20px; 140 | PADDING-LEFT: 0px 141 | } 142 | H3 143 | { 144 | COLOR: #000000; 145 | FONT-SIZE: 80%; 146 | FONT-WEIGHT: bold; 147 | MARGIN-BOTTOM: -5px; 148 | MARGIN-LEFT: 10px; 149 | MARGIN-TOP: 20px 150 | } 151 | H4 152 | { 153 | COLOR: #000000; 154 | FONT-SIZE: 70%; 155 | FONT-WEIGHT: bold; 156 | MARGIN-BOTTOM: 0px; 157 | MARGIN-TOP: 15px; 158 | PADDING-BOTTOM: 0px 159 | } 160 | UL 161 | { 162 | COLOR: #000000; 163 | FONT-SIZE: 70%; 164 | LIST-STYLE: square; 165 | MARGIN-BOTTOM: 0pt; 166 | MARGIN-TOP: 0pt 167 | } 168 | OL 169 | { 170 | COLOR: #000000; 171 | FONT-SIZE: 70%; 172 | LIST-STYLE: square; 173 | MARGIN-BOTTOM: 0pt; 174 | MARGIN-TOP: 0pt 175 | } 176 | LI 177 | { 178 | LIST-STYLE: square; 179 | MARGIN-LEFT: 0px 180 | } 181 | .expandable 182 | { 183 | CURSOR: hand 184 | } 185 | .expanded 186 | { 187 | color: black 188 | } 189 | .collapsed 190 | { 191 | DISPLAY: none 192 | } 193 | .foot 194 | { 195 | BACKGROUND-COLOR: #ffffff; 196 | BORDER-BOTTOM: #cecf9c 1px solid; 197 | BORDER-TOP: #cecf9c 2px solid 198 | } 199 | .settings 200 | { 201 | MARGIN-LEFT: 25PX; 202 | } 203 | .help 204 | { 205 | TEXT-ALIGN: right; 206 | margin-right: 10px; 207 | } 208 | -------------------------------------------------------------------------------- /_UpgradeReport_Files/UpgradeReport_Minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/_UpgradeReport_Files/UpgradeReport_Minus.gif -------------------------------------------------------------------------------- /_UpgradeReport_Files/UpgradeReport_Plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/_UpgradeReport_Files/UpgradeReport_Plus.gif -------------------------------------------------------------------------------- /include/SDL/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* Main include header for the SDL library */ 24 | 25 | #ifndef _SDL_H 26 | #define _SDL_H 27 | 28 | #include "SDL_main.h" 29 | #include "SDL_stdinc.h" 30 | #include "SDL_audio.h" 31 | #include "SDL_cdrom.h" 32 | #include "SDL_cpuinfo.h" 33 | #include "SDL_endian.h" 34 | #include "SDL_error.h" 35 | #include "SDL_events.h" 36 | #include "SDL_loadso.h" 37 | #include "SDL_mutex.h" 38 | #include "SDL_rwops.h" 39 | #include "SDL_thread.h" 40 | #include "SDL_timer.h" 41 | #include "SDL_video.h" 42 | #include "SDL_version.h" 43 | 44 | #include "begin_code.h" 45 | /* Set up for C function definitions, even when using C++ */ 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | /* As of version 0.5, SDL is loaded dynamically into the application */ 51 | 52 | /* These are the flags which may be passed to SDL_Init() -- you should 53 | specify the subsystems which you will be using in your application. 54 | */ 55 | #define SDL_INIT_TIMER 0x00000001 56 | #define SDL_INIT_AUDIO 0x00000010 57 | #define SDL_INIT_VIDEO 0x00000020 58 | #define SDL_INIT_CDROM 0x00000100 59 | #define SDL_INIT_JOYSTICK 0x00000200 60 | #define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */ 61 | #define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */ 62 | #define SDL_INIT_EVERYTHING 0x0000FFFF 63 | 64 | /* This function loads the SDL dynamically linked library and initializes 65 | * the subsystems specified by 'flags' (and those satisfying dependencies) 66 | * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup 67 | * signal handlers for some commonly ignored fatal signals (like SIGSEGV) 68 | */ 69 | extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); 70 | 71 | /* This function initializes specific SDL subsystems */ 72 | extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); 73 | 74 | /* This function cleans up specific SDL subsystems */ 75 | extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); 76 | 77 | /* This function returns mask of the specified subsystems which have 78 | been initialized. 79 | If 'flags' is 0, it returns a mask of all initialized subsystems. 80 | */ 81 | extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); 82 | 83 | /* This function cleans up all initialized subsystems and unloads the 84 | * dynamically linked library. You should call it upon all exit conditions. 85 | */ 86 | extern DECLSPEC void SDLCALL SDL_Quit(void); 87 | 88 | /* Ends C function definitions when using C++ */ 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | #include "close_code.h" 93 | 94 | #endif /* _SDL_H */ 95 | -------------------------------------------------------------------------------- /include/SDL/SDL_active.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* Include file for SDL application focus event handling */ 24 | 25 | #ifndef _SDL_active_h 26 | #define _SDL_active_h 27 | 28 | #include "SDL_stdinc.h" 29 | #include "SDL_error.h" 30 | 31 | #include "begin_code.h" 32 | /* Set up for C function definitions, even when using C++ */ 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* The available application states */ 38 | #define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */ 39 | #define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */ 40 | #define SDL_APPACTIVE 0x04 /* The application is active */ 41 | 42 | /* Function prototypes */ 43 | /* 44 | * This function returns the current state of the application, which is a 45 | * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and 46 | * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to 47 | * see your application, otherwise it has been iconified or disabled. 48 | */ 49 | extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); 50 | 51 | 52 | /* Ends C function definitions when using C++ */ 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | #include "close_code.h" 57 | 58 | #endif /* _SDL_active_h */ 59 | -------------------------------------------------------------------------------- /include/SDL/SDL_byteorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* DEPRECATED */ 24 | #include "SDL_endian.h" 25 | -------------------------------------------------------------------------------- /include/SDL/SDL_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* Add any platform that doesn't build using the configure system */ 29 | #if defined(__AMIGA__) 30 | #include "SDL_config_amiga.h" 31 | #elif defined(__DREAMCAST__) 32 | #include "SDL_config_dreamcast.h" 33 | #elif defined(__MACOS__) 34 | #include "SDL_config_macos.h" 35 | #elif defined(__MACOSX__) 36 | #include "SDL_config_macosx.h" 37 | #elif defined(__WIN32__) 38 | #include "SDL_config_win32.h" 39 | #elif defined(__OS2__) 40 | #include "SDL_config_os2.h" 41 | #else 42 | #include "SDL_config_minimal.h" 43 | #endif /* platform config */ 44 | 45 | #endif /* _SDL_config_h */ 46 | -------------------------------------------------------------------------------- /include/SDL/SDL_config.h.default: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* Add any platform that doesn't build using the configure system */ 29 | #if defined(__AMIGA__) 30 | #include "SDL_config_amiga.h" 31 | #elif defined(__DREAMCAST__) 32 | #include "SDL_config_dreamcast.h" 33 | #elif defined(__MACOS__) 34 | #include "SDL_config_macos.h" 35 | #elif defined(__MACOSX__) 36 | #include "SDL_config_macosx.h" 37 | #elif defined(__WIN32__) 38 | #include "SDL_config_win32.h" 39 | #elif defined(__OS2__) 40 | #include "SDL_config_os2.h" 41 | #else 42 | #include "SDL_config_minimal.h" 43 | #endif /* platform config */ 44 | 45 | #endif /* _SDL_config_h */ 46 | -------------------------------------------------------------------------------- /include/SDL/SDL_config_amiga.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_amiga_h 24 | #define _SDL_config_amiga_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | #define SDL_HAS_64BIT_TYPE 1 31 | 32 | /* Useful headers */ 33 | #define HAVE_SYS_TYPES_H 1 34 | #define HAVE_STDIO_H 1 35 | #define STDC_HEADERS 1 36 | #define HAVE_STRING_H 1 37 | #define HAVE_INTTYPES_H 1 38 | #define HAVE_SIGNAL_H 1 39 | 40 | /* C library functions */ 41 | #define HAVE_MALLOC 1 42 | #define HAVE_CALLOC 1 43 | #define HAVE_REALLOC 1 44 | #define HAVE_FREE 1 45 | #define HAVE_ALLOCA 1 46 | #define HAVE_GETENV 1 47 | #define HAVE_PUTENV 1 48 | #define HAVE_MEMSET 1 49 | #define HAVE_MEMCPY 1 50 | #define HAVE_MEMMOVE 1 51 | #define HAVE_MEMCMP 1 52 | 53 | /* Enable various audio drivers */ 54 | #define SDL_AUDIO_DRIVER_AHI 1 55 | #define SDL_AUDIO_DRIVER_DISK 1 56 | #define SDL_AUDIO_DRIVER_DUMMY 1 57 | 58 | /* Enable various cdrom drivers */ 59 | #define SDL_CDROM_DUMMY 1 60 | 61 | /* Enable various input drivers */ 62 | #define SDL_JOYSTICK_AMIGA 1 63 | 64 | /* Enable various shared object loading systems */ 65 | #define SDL_LOADSO_DUMMY 1 66 | 67 | /* Enable various threading systems */ 68 | #define SDL_THREAD_AMIGA 1 69 | 70 | /* Enable various timer systems */ 71 | #define SDL_TIMER_AMIGA 1 72 | 73 | /* Enable various video drivers */ 74 | #define SDL_VIDEO_DRIVER_CYBERGRAPHICS 1 75 | #define SDL_VIDEO_DRIVER_DUMMY 1 76 | 77 | /* Enable OpenGL support */ 78 | #define SDL_VIDEO_OPENGL 1 79 | 80 | #endif /* _SDL_config_amiga_h */ 81 | -------------------------------------------------------------------------------- /include/SDL/SDL_config_dreamcast.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_dreamcast_h 24 | #define _SDL_config_dreamcast_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | typedef signed char int8_t; 31 | typedef unsigned char uint8_t; 32 | typedef signed short int16_t; 33 | typedef unsigned short uint16_t; 34 | typedef signed int int32_t; 35 | typedef unsigned int uint32_t; 36 | typedef signed long long int64_t; 37 | typedef unsigned long long uint64_t; 38 | typedef unsigned long uintptr_t; 39 | #define SDL_HAS_64BIT_TYPE 1 40 | 41 | /* Useful headers */ 42 | #define HAVE_SYS_TYPES_H 1 43 | #define HAVE_STDIO_H 1 44 | #define STDC_HEADERS 1 45 | #define HAVE_STRING_H 1 46 | #define HAVE_CTYPE_H 1 47 | 48 | /* C library functions */ 49 | #define HAVE_MALLOC 1 50 | #define HAVE_CALLOC 1 51 | #define HAVE_REALLOC 1 52 | #define HAVE_FREE 1 53 | #define HAVE_ALLOCA 1 54 | #define HAVE_GETENV 1 55 | #define HAVE_PUTENV 1 56 | #define HAVE_QSORT 1 57 | #define HAVE_ABS 1 58 | #define HAVE_BCOPY 1 59 | #define HAVE_MEMSET 1 60 | #define HAVE_MEMCPY 1 61 | #define HAVE_MEMMOVE 1 62 | #define HAVE_MEMCMP 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRDUP 1 65 | #define HAVE_INDEX 1 66 | #define HAVE_RINDEX 1 67 | #define HAVE_STRCHR 1 68 | #define HAVE_STRRCHR 1 69 | #define HAVE_STRSTR 1 70 | #define HAVE_STRTOL 1 71 | #define HAVE_STRTOD 1 72 | #define HAVE_ATOI 1 73 | #define HAVE_ATOF 1 74 | #define HAVE_STRCMP 1 75 | #define HAVE_STRNCMP 1 76 | #define HAVE_STRICMP 1 77 | #define HAVE_STRCASECMP 1 78 | #define HAVE_SSCANF 1 79 | #define HAVE_SNPRINTF 1 80 | #define HAVE_VSNPRINTF 1 81 | 82 | /* Enable various audio drivers */ 83 | #define SDL_AUDIO_DRIVER_DC 1 84 | #define SDL_AUDIO_DRIVER_DISK 1 85 | #define SDL_AUDIO_DRIVER_DUMMY 1 86 | 87 | /* Enable various cdrom drivers */ 88 | #define SDL_CDROM_DC 1 89 | 90 | /* Enable various input drivers */ 91 | #define SDL_JOYSTICK_DC 1 92 | 93 | /* Enable various shared object loading systems */ 94 | #define SDL_LOADSO_DUMMY 1 95 | 96 | /* Enable various threading systems */ 97 | #define SDL_THREAD_DC 1 98 | 99 | /* Enable various timer systems */ 100 | #define SDL_TIMER_DC 1 101 | 102 | /* Enable various video drivers */ 103 | #define SDL_VIDEO_DRIVER_DC 1 104 | #define SDL_VIDEO_DRIVER_DUMMY 1 105 | 106 | #endif /* _SDL_config_dreamcast_h */ 107 | -------------------------------------------------------------------------------- /include/SDL/SDL_config_macos.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_macos_h 24 | #define _SDL_config_macos_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | #include 31 | 32 | typedef SInt8 int8_t; 33 | typedef UInt8 uint8_t; 34 | typedef SInt16 int16_t; 35 | typedef UInt16 uint16_t; 36 | typedef SInt32 int32_t; 37 | typedef UInt32 uint32_t; 38 | typedef SInt64 int64_t; 39 | typedef UInt64 uint64_t; 40 | typedef unsigned long uintptr_t; 41 | 42 | #define SDL_HAS_64BIT_TYPE 1 43 | 44 | /* Useful headers */ 45 | #define HAVE_STDIO_H 1 46 | #define STDC_HEADERS 1 47 | #define HAVE_STRING_H 1 48 | #define HAVE_CTYPE_H 1 49 | #define HAVE_MATH_H 1 50 | #define HAVE_SIGNAL_H 1 51 | 52 | /* C library functions */ 53 | #define HAVE_MALLOC 1 54 | #define HAVE_CALLOC 1 55 | #define HAVE_REALLOC 1 56 | #define HAVE_FREE 1 57 | #define HAVE_ALLOCA 1 58 | #define HAVE_ABS 1 59 | #define HAVE_MEMSET 1 60 | #define HAVE_MEMCPY 1 61 | #define HAVE_MEMMOVE 1 62 | #define HAVE_MEMCMP 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRCHR 1 65 | #define HAVE_STRRCHR 1 66 | #define HAVE_STRSTR 1 67 | #define HAVE_ITOA 1 68 | #define HAVE_STRTOL 1 69 | #define HAVE_STRTOD 1 70 | #define HAVE_ATOI 1 71 | #define HAVE_ATOF 1 72 | #define HAVE_STRCMP 1 73 | #define HAVE_STRNCMP 1 74 | #define HAVE_SSCANF 1 75 | 76 | /* Enable various audio drivers */ 77 | #define SDL_AUDIO_DRIVER_SNDMGR 1 78 | #define SDL_AUDIO_DRIVER_DISK 1 79 | #define SDL_AUDIO_DRIVER_DUMMY 1 80 | 81 | /* Enable various cdrom drivers */ 82 | #if TARGET_API_MAC_CARBON 83 | #define SDL_CDROM_DUMMY 1 84 | #else 85 | #define SDL_CDROM_MACOS 1 86 | #endif 87 | 88 | /* Enable various input drivers */ 89 | #if TARGET_API_MAC_CARBON 90 | #define SDL_JOYSTICK_DUMMY 1 91 | #else 92 | #define SDL_JOYSTICK_MACOS 1 93 | #endif 94 | 95 | /* Enable various shared object loading systems */ 96 | #define SDL_LOADSO_MACOS 1 97 | 98 | /* Enable various threading systems */ 99 | #define SDL_THREADS_DISABLED 1 100 | 101 | /* Enable various timer systems */ 102 | #define SDL_TIMER_MACOS 1 103 | 104 | /* Enable various video drivers */ 105 | #define SDL_VIDEO_DRIVER_DUMMY 1 106 | #define SDL_VIDEO_DRIVER_DRAWSPROCKET 1 107 | #define SDL_VIDEO_DRIVER_TOOLBOX 1 108 | 109 | /* Enable OpenGL support */ 110 | #define SDL_VIDEO_OPENGL 1 111 | 112 | #endif /* _SDL_config_macos_h */ 113 | -------------------------------------------------------------------------------- /include/SDL/SDL_config_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_macosx_h 24 | #define _SDL_config_macosx_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | #define SDL_HAS_64BIT_TYPE 1 31 | 32 | /* Useful headers */ 33 | /* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */ 34 | #if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) ) 35 | #define HAVE_ALLOCA_H 1 36 | #endif 37 | #define HAVE_SYS_TYPES_H 1 38 | #define HAVE_STDIO_H 1 39 | #define STDC_HEADERS 1 40 | #define HAVE_STRING_H 1 41 | #define HAVE_INTTYPES_H 1 42 | #define HAVE_STDINT_H 1 43 | #define HAVE_CTYPE_H 1 44 | #define HAVE_MATH_H 1 45 | #define HAVE_SIGNAL_H 1 46 | 47 | /* C library functions */ 48 | #define HAVE_MALLOC 1 49 | #define HAVE_CALLOC 1 50 | #define HAVE_REALLOC 1 51 | #define HAVE_FREE 1 52 | #define HAVE_ALLOCA 1 53 | #define HAVE_GETENV 1 54 | #define HAVE_PUTENV 1 55 | #define HAVE_UNSETENV 1 56 | #define HAVE_QSORT 1 57 | #define HAVE_ABS 1 58 | #define HAVE_BCOPY 1 59 | #define HAVE_MEMSET 1 60 | #define HAVE_MEMCPY 1 61 | #define HAVE_MEMMOVE 1 62 | #define HAVE_MEMCMP 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRLCPY 1 65 | #define HAVE_STRLCAT 1 66 | #define HAVE_STRDUP 1 67 | #define HAVE_STRCHR 1 68 | #define HAVE_STRRCHR 1 69 | #define HAVE_STRSTR 1 70 | #define HAVE_STRTOL 1 71 | #define HAVE_STRTOUL 1 72 | #define HAVE_STRTOLL 1 73 | #define HAVE_STRTOULL 1 74 | #define HAVE_STRTOD 1 75 | #define HAVE_ATOI 1 76 | #define HAVE_ATOF 1 77 | #define HAVE_STRCMP 1 78 | #define HAVE_STRNCMP 1 79 | #define HAVE_STRCASECMP 1 80 | #define HAVE_STRNCASECMP 1 81 | #define HAVE_SSCANF 1 82 | #define HAVE_SNPRINTF 1 83 | #define HAVE_VSNPRINTF 1 84 | #define HAVE_SIGACTION 1 85 | #define HAVE_SETJMP 1 86 | #define HAVE_NANOSLEEP 1 87 | 88 | /* Enable various audio drivers */ 89 | #define SDL_AUDIO_DRIVER_COREAUDIO 1 90 | #define SDL_AUDIO_DRIVER_SNDMGR 1 91 | #define SDL_AUDIO_DRIVER_DISK 1 92 | #define SDL_AUDIO_DRIVER_DUMMY 1 93 | 94 | /* Enable various cdrom drivers */ 95 | #define SDL_CDROM_MACOSX 1 96 | 97 | /* Enable various input drivers */ 98 | #define SDL_JOYSTICK_IOKIT 1 99 | 100 | /* Enable various shared object loading systems */ 101 | #ifdef __ppc__ 102 | /* For Mac OS X 10.2 compatibility */ 103 | #define SDL_LOADSO_DLCOMPAT 1 104 | #else 105 | #define SDL_LOADSO_DLOPEN 1 106 | #endif 107 | 108 | /* Enable various threading systems */ 109 | #define SDL_THREAD_PTHREAD 1 110 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 111 | 112 | /* Enable various timer systems */ 113 | #define SDL_TIMER_UNIX 1 114 | 115 | /* Enable various video drivers */ 116 | #define SDL_VIDEO_DRIVER_DUMMY 1 117 | #if TARGET_API_MAC_CARBON 118 | #define SDL_VIDEO_DRIVER_TOOLBOX 1 119 | #else 120 | #define SDL_VIDEO_DRIVER_QUARTZ 1 121 | #endif 122 | 123 | /* Enable OpenGL support */ 124 | #define SDL_VIDEO_OPENGL 1 125 | 126 | /* Enable assembly routines */ 127 | #define SDL_ASSEMBLY_ROUTINES 1 128 | #ifdef __ppc__ 129 | #define SDL_ALTIVEC_BLITTERS 1 130 | #endif 131 | 132 | #endif /* _SDL_config_macosx_h */ 133 | -------------------------------------------------------------------------------- /include/SDL/SDL_config_minimal.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_minimal_h 24 | #define _SDL_config_minimal_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is the minimal configuration that can be used to build SDL */ 29 | 30 | #include 31 | 32 | typedef signed char int8_t; 33 | typedef unsigned char uint8_t; 34 | typedef signed short int16_t; 35 | typedef unsigned short uint16_t; 36 | typedef signed int int32_t; 37 | typedef unsigned int uint32_t; 38 | typedef unsigned int size_t; 39 | typedef unsigned long uintptr_t; 40 | 41 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 42 | #define SDL_AUDIO_DRIVER_DUMMY 1 43 | 44 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 45 | #define SDL_CDROM_DISABLED 1 46 | 47 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 48 | #define SDL_JOYSTICK_DISABLED 1 49 | 50 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 51 | #define SDL_LOADSO_DISABLED 1 52 | 53 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 54 | #define SDL_THREADS_DISABLED 1 55 | 56 | /* Enable the stub timer support (src/timer/dummy/\*.c) */ 57 | #define SDL_TIMERS_DISABLED 1 58 | 59 | /* Enable the dummy video driver (src/video/dummy/\*.c) */ 60 | #define SDL_VIDEO_DRIVER_DUMMY 1 61 | 62 | #endif /* _SDL_config_minimal_h */ 63 | -------------------------------------------------------------------------------- /include/SDL/SDL_config_os2.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_os2_h 24 | #define _SDL_config_os2_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | typedef signed char int8_t; 31 | typedef unsigned char uint8_t; 32 | typedef signed short int16_t; 33 | typedef unsigned short uint16_t; 34 | typedef signed int int32_t; 35 | typedef unsigned int uint32_t; 36 | typedef unsigned int size_t; 37 | typedef unsigned long uintptr_t; 38 | typedef signed long long int64_t; 39 | typedef unsigned long long uint64_t; 40 | 41 | #define SDL_HAS_64BIT_TYPE 1 42 | 43 | /* Use Watcom's LIBC */ 44 | #define HAVE_LIBC 1 45 | 46 | /* Useful headers */ 47 | #define HAVE_SYS_TYPES_H 1 48 | #define HAVE_STDIO_H 1 49 | #define STDC_HEADERS 1 50 | #define HAVE_STDLIB_H 1 51 | #define HAVE_STDARG_H 1 52 | #define HAVE_MALLOC_H 1 53 | #define HAVE_MEMORY_H 1 54 | #define HAVE_STRING_H 1 55 | #define HAVE_STRINGS_H 1 56 | #define HAVE_INTTYPES_H 1 57 | #define HAVE_STDINT_H 1 58 | #define HAVE_CTYPE_H 1 59 | #define HAVE_MATH_H 1 60 | #define HAVE_SIGNAL_H 1 61 | 62 | /* C library functions */ 63 | #define HAVE_MALLOC 1 64 | #define HAVE_CALLOC 1 65 | #define HAVE_REALLOC 1 66 | #define HAVE_FREE 1 67 | #define HAVE_ALLOCA 1 68 | #define HAVE_GETENV 1 69 | #define HAVE_PUTENV 1 70 | #define HAVE_UNSETENV 1 71 | #define HAVE_QSORT 1 72 | #define HAVE_ABS 1 73 | #define HAVE_BCOPY 1 74 | #define HAVE_MEMSET 1 75 | #define HAVE_MEMCPY 1 76 | #define HAVE_MEMMOVE 1 77 | #define HAVE_MEMCMP 1 78 | #define HAVE_STRLEN 1 79 | #define HAVE_STRLCPY 1 80 | #define HAVE_STRLCAT 1 81 | #define HAVE_STRDUP 1 82 | #define HAVE__STRREV 1 83 | #define HAVE__STRUPR 1 84 | #define HAVE__STRLWR 1 85 | #define HAVE_INDEX 1 86 | #define HAVE_RINDEX 1 87 | #define HAVE_STRCHR 1 88 | #define HAVE_STRRCHR 1 89 | #define HAVE_STRSTR 1 90 | #define HAVE_ITOA 1 91 | #define HAVE__LTOA 1 92 | #define HAVE__UITOA 1 93 | #define HAVE__ULTOA 1 94 | #define HAVE_STRTOL 1 95 | #define HAVE__I64TOA 1 96 | #define HAVE__UI64TOA 1 97 | #define HAVE_STRTOLL 1 98 | #define HAVE_STRTOD 1 99 | #define HAVE_ATOI 1 100 | #define HAVE_ATOF 1 101 | #define HAVE_STRCMP 1 102 | #define HAVE_STRNCMP 1 103 | #define HAVE_STRICMP 1 104 | #define HAVE_STRCASECMP 1 105 | #define HAVE_SSCANF 1 106 | #define HAVE_SNPRINTF 1 107 | #define HAVE_VSNPRINTF 1 108 | #define HAVE_SETJMP 1 109 | #define HAVE_CLOCK_GETTIME 1 110 | 111 | /* Enable various audio drivers */ 112 | #define SDL_AUDIO_DRIVER_DART 1 113 | #define SDL_AUDIO_DRIVER_DISK 1 114 | #define SDL_AUDIO_DRIVER_DUMMY 1 115 | 116 | /* Enable various cdrom drivers */ 117 | #define SDL_CDROM_OS2 1 118 | 119 | /* Enable various input drivers */ 120 | #define SDL_JOYSTICK_OS2 1 121 | 122 | /* Enable various shared object loading systems */ 123 | #define SDL_LOADSO_OS2 1 124 | 125 | /* Enable various threading systems */ 126 | #define SDL_THREAD_OS2 1 127 | 128 | /* Enable various timer systems */ 129 | #define SDL_TIMER_OS2 1 130 | 131 | /* Enable various video drivers */ 132 | #define SDL_VIDEO_DRIVER_DUMMY 1 133 | #define SDL_VIDEO_DRIVER_OS2FS 1 134 | 135 | /* Enable OpenGL support */ 136 | /* Nothing here yet for OS/2... :( */ 137 | 138 | /* Enable assembly routines where available */ 139 | #define SDL_ASSEMBLY_ROUTINES 1 140 | 141 | #endif /* _SDL_config_os2_h */ 142 | -------------------------------------------------------------------------------- /include/SDL/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | -------------------------------------------------------------------------------- /include/SDL/SDL_cpuinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 24 | /* CPU feature detection for SDL */ 25 | 26 | #ifndef _SDL_cpuinfo_h 27 | #define _SDL_cpuinfo_h 28 | 29 | #include "SDL_stdinc.h" 30 | 31 | #include "begin_code.h" 32 | /* Set up for C function definitions, even when using C++ */ 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* This function returns true if the CPU has the RDTSC instruction 38 | */ 39 | extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); 40 | 41 | /* This function returns true if the CPU has MMX features 42 | */ 43 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); 44 | 45 | /* This function returns true if the CPU has MMX Ext. features 46 | */ 47 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void); 48 | 49 | /* This function returns true if the CPU has 3DNow features 50 | */ 51 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); 52 | 53 | /* This function returns true if the CPU has 3DNow! Ext. features 54 | */ 55 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void); 56 | 57 | /* This function returns true if the CPU has SSE features 58 | */ 59 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); 60 | 61 | /* This function returns true if the CPU has SSE2 features 62 | */ 63 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); 64 | 65 | /* This function returns true if the CPU has AltiVec features 66 | */ 67 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); 68 | 69 | /* Ends C function definitions when using C++ */ 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | #include "close_code.h" 74 | 75 | #endif /* _SDL_cpuinfo_h */ 76 | -------------------------------------------------------------------------------- /include/SDL/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* Simple error message routines for SDL */ 24 | 25 | #ifndef _SDL_error_h 26 | #define _SDL_error_h 27 | 28 | #include "SDL_stdinc.h" 29 | 30 | #include "begin_code.h" 31 | /* Set up for C function definitions, even when using C++ */ 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Public functions */ 37 | extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); 38 | extern DECLSPEC char * SDLCALL SDL_GetError(void); 39 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 40 | 41 | /* Private error message function - used internally */ 42 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 43 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 44 | typedef enum { 45 | SDL_ENOMEM, 46 | SDL_EFREAD, 47 | SDL_EFWRITE, 48 | SDL_EFSEEK, 49 | SDL_UNSUPPORTED, 50 | SDL_LASTERROR 51 | } SDL_errorcode; 52 | extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* _SDL_error_h */ 62 | -------------------------------------------------------------------------------- /include/SDL/SDL_getenv.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* DEPRECATED */ 24 | #include "SDL_stdinc.h" 25 | -------------------------------------------------------------------------------- /include/SDL/SDL_keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* Include file for SDL keyboard event handling */ 24 | 25 | #ifndef _SDL_keyboard_h 26 | #define _SDL_keyboard_h 27 | 28 | #include "SDL_stdinc.h" 29 | #include "SDL_error.h" 30 | #include "SDL_keysym.h" 31 | 32 | #include "begin_code.h" 33 | /* Set up for C function definitions, even when using C++ */ 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /* Keysym structure 39 | - The scancode is hardware dependent, and should not be used by general 40 | applications. If no hardware scancode is available, it will be 0. 41 | 42 | - The 'unicode' translated character is only available when character 43 | translation is enabled by the SDL_EnableUNICODE() API. If non-zero, 44 | this is a UNICODE character corresponding to the keypress. If the 45 | high 9 bits of the character are 0, then this maps to the equivalent 46 | ASCII character: 47 | char ch; 48 | if ( (keysym.unicode & 0xFF80) == 0 ) { 49 | ch = keysym.unicode & 0x7F; 50 | } else { 51 | An international character.. 52 | } 53 | */ 54 | typedef struct SDL_keysym { 55 | Uint8 scancode; /* hardware specific scancode */ 56 | SDLKey sym; /* SDL virtual keysym */ 57 | SDLMod mod; /* current key modifiers */ 58 | Uint16 unicode; /* translated character */ 59 | } SDL_keysym; 60 | 61 | /* This is the mask which refers to all hotkey bindings */ 62 | #define SDL_ALL_HOTKEYS 0xFFFFFFFF 63 | 64 | /* Function prototypes */ 65 | /* 66 | * Enable/Disable UNICODE translation of keyboard input. 67 | * This translation has some overhead, so translation defaults off. 68 | * If 'enable' is 1, translation is enabled. 69 | * If 'enable' is 0, translation is disabled. 70 | * If 'enable' is -1, the translation state is not changed. 71 | * It returns the previous state of keyboard translation. 72 | */ 73 | extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); 74 | 75 | /* 76 | * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. 77 | * 'delay' is the initial delay in ms between the time when a key is 78 | * pressed, and keyboard repeat begins. 79 | * 'interval' is the time in ms between keyboard repeat events. 80 | */ 81 | #define SDL_DEFAULT_REPEAT_DELAY 500 82 | #define SDL_DEFAULT_REPEAT_INTERVAL 30 83 | /* 84 | * If 'delay' is set to 0, keyboard repeat is disabled. 85 | */ 86 | extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); 87 | extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); 88 | 89 | /* 90 | * Get a snapshot of the current state of the keyboard. 91 | * Returns an array of keystates, indexed by the SDLK_* syms. 92 | * Used: 93 | * Uint8 *keystate = SDL_GetKeyState(NULL); 94 | * if ( keystate[SDLK_RETURN] ) ... is pressed. 95 | */ 96 | extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); 97 | 98 | /* 99 | * Get the current key modifier state 100 | */ 101 | extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); 102 | 103 | /* 104 | * Set the current key modifier state 105 | * This does not change the keyboard state, only the key modifier flags. 106 | */ 107 | extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); 108 | 109 | /* 110 | * Get the name of an SDL virtual keysym 111 | */ 112 | extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key); 113 | 114 | 115 | /* Ends C function definitions when using C++ */ 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | #include "close_code.h" 120 | 121 | #endif /* _SDL_keyboard_h */ 122 | -------------------------------------------------------------------------------- /include/SDL/SDL_loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 24 | /* System dependent library loading routines */ 25 | 26 | /* Some things to keep in mind: 27 | - These functions only work on C function names. Other languages may 28 | have name mangling and intrinsic language support that varies from 29 | compiler to compiler. 30 | - Make sure you declare your function pointers with the same calling 31 | convention as the actual library function. Your code will crash 32 | mysteriously if you do not do this. 33 | - Avoid namespace collisions. If you load a symbol from the library, 34 | it is not defined whether or not it goes into the global symbol 35 | namespace for the application. If it does and it conflicts with 36 | symbols in your code or other shared libraries, you will not get 37 | the results you expect. :) 38 | */ 39 | 40 | 41 | #ifndef _SDL_loadso_h 42 | #define _SDL_loadso_h 43 | 44 | #include "SDL_stdinc.h" 45 | #include "SDL_error.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* This function dynamically loads a shared object and returns a pointer 54 | * to the object handle (or NULL if there was an error). 55 | * The 'sofile' parameter is a system dependent name of the object file. 56 | */ 57 | extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile); 58 | 59 | /* Given an object handle, this function looks up the address of the 60 | * named function in the shared object and returns it. This address 61 | * is no longer valid after calling SDL_UnloadObject(). 62 | */ 63 | extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name); 64 | 65 | /* Unload a shared object from memory */ 66 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 67 | 68 | /* Ends C function definitions when using C++ */ 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | #include "close_code.h" 73 | 74 | #endif /* _SDL_loadso_h */ 75 | -------------------------------------------------------------------------------- /include/SDL/SDL_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_main_h 24 | #define _SDL_main_h 25 | 26 | #include "SDL_stdinc.h" 27 | 28 | /* Redefine main() on Win32 and MacOS so that it is called by winmain.c */ 29 | 30 | #if defined(__WIN32__) || \ 31 | (defined(__MWERKS__) && !defined(__BEOS__)) || \ 32 | defined(__MACOS__) || defined(__MACOSX__) || \ 33 | defined(__SYMBIAN32__) || defined(QWS) 34 | 35 | #ifdef __cplusplus 36 | #define C_LINKAGE "C" 37 | #else 38 | #define C_LINKAGE 39 | #endif /* __cplusplus */ 40 | 41 | /* The application's main() function must be called with C linkage, 42 | and should be declared like this: 43 | #ifdef __cplusplus 44 | extern "C" 45 | #endif 46 | int main(int argc, char *argv[]) 47 | { 48 | } 49 | */ 50 | #define main SDL_main 51 | 52 | /* The prototype for the application's main() function */ 53 | extern C_LINKAGE int SDL_main(int argc, char *argv[]); 54 | 55 | 56 | /* From the SDL library code -- needed for registering the app on Win32 */ 57 | #ifdef __WIN32__ 58 | 59 | #include "begin_code.h" 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | /* This should be called from your WinMain() function, if any */ 65 | extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); 66 | /* This can also be called, but is no longer necessary */ 67 | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); 68 | /* This can also be called, but is no longer necessary (SDL_Quit calls it) */ 69 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | #include "close_code.h" 74 | #endif 75 | 76 | /* From the SDL library code -- needed for registering QuickDraw on MacOS */ 77 | #if defined(__MACOS__) 78 | 79 | #include "begin_code.h" 80 | #ifdef __cplusplus 81 | extern "C" { 82 | #endif 83 | 84 | /* Forward declaration so we don't need to include QuickDraw.h */ 85 | struct QDGlobals; 86 | 87 | /* This should be called from your main() function, if any */ 88 | extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | #include "close_code.h" 94 | #endif 95 | 96 | #endif /* Need to redefine main()? */ 97 | 98 | #endif /* _SDL_main_h */ 99 | -------------------------------------------------------------------------------- /include/SDL/SDL_name.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SDLname_h_ 3 | #define _SDLname_h_ 4 | 5 | #if defined(__STDC__) || defined(__cplusplus) 6 | #define NeedFunctionPrototypes 1 7 | #endif 8 | 9 | #define SDL_NAME(X) SDL_##X 10 | 11 | #endif /* _SDLname_h_ */ 12 | -------------------------------------------------------------------------------- /include/SDL/SDL_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* Try to get a standard set of platform defines */ 24 | 25 | #ifndef _SDL_platform_h 26 | #define _SDL_platform_h 27 | 28 | #if defined(_AIX) 29 | #undef __AIX__ 30 | #define __AIX__ 1 31 | #endif 32 | #if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__) 33 | #undef __AMIGA__ 34 | #define __AMIGA__ 1 35 | #endif 36 | #if defined(__BEOS__) 37 | #undef __BEOS__ 38 | #define __BEOS__ 1 39 | #endif 40 | #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) 41 | #undef __BSDI__ 42 | #define __BSDI__ 1 43 | #endif 44 | #if defined(_arch_dreamcast) 45 | #undef __DREAMCAST__ 46 | #define __DREAMCAST__ 1 47 | #endif 48 | #if defined(__FreeBSD__) || defined(__DragonFly__) 49 | #undef __FREEBSD__ 50 | #define __FREEBSD__ 1 51 | #endif 52 | #if defined(hpux) || defined(__hpux) || defined(__hpux__) 53 | #undef __HPUX__ 54 | #define __HPUX__ 1 55 | #endif 56 | #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) 57 | #undef __IRIX__ 58 | #define __IRIX__ 1 59 | #endif 60 | #if defined(linux) || defined(__linux) || defined(__linux__) 61 | #undef __LINUX__ 62 | #define __LINUX__ 1 63 | #endif 64 | #if defined(__APPLE__) 65 | #undef __MACOSX__ 66 | #define __MACOSX__ 1 67 | #elif defined(macintosh) 68 | #undef __MACOS__ 69 | #define __MACOS__ 1 70 | #endif 71 | #if defined(__NetBSD__) 72 | #undef __NETBSD__ 73 | #define __NETBSD__ 1 74 | #endif 75 | #if defined(__OpenBSD__) 76 | #undef __OPENBSD__ 77 | #define __OPENBSD__ 1 78 | #endif 79 | #if defined(__OS2__) 80 | #undef __OS2__ 81 | #define __OS2__ 1 82 | #endif 83 | #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) 84 | #undef __OSF__ 85 | #define __OSF__ 1 86 | #endif 87 | #if defined(__QNXNTO__) 88 | #undef __QNXNTO__ 89 | #define __QNXNTO__ 1 90 | #endif 91 | #if defined(riscos) || defined(__riscos) || defined(__riscos__) 92 | #undef __RISCOS__ 93 | #define __RISCOS__ 1 94 | #endif 95 | #if defined(__SVR4) 96 | #undef __SOLARIS__ 97 | #define __SOLARIS__ 1 98 | #endif 99 | #if defined(WIN32) || defined(_WIN32) 100 | #undef __WIN32__ 101 | #define __WIN32__ 1 102 | #endif 103 | 104 | #endif /* _SDL_platform_h */ 105 | -------------------------------------------------------------------------------- /include/SDL/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* Include file for SDL quit event handling */ 24 | 25 | #ifndef _SDL_quit_h 26 | #define _SDL_quit_h 27 | 28 | #include "SDL_stdinc.h" 29 | #include "SDL_error.h" 30 | 31 | /* 32 | An SDL_QUITEVENT is generated when the user tries to close the application 33 | window. If it is ignored or filtered out, the window will remain open. 34 | If it is not ignored or filtered, it is queued normally and the window 35 | is allowed to close. When the window is closed, screen updates will 36 | complete, but have no effect. 37 | 38 | SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 39 | and SIGTERM (system termination request), if handlers do not already 40 | exist, that generate SDL_QUITEVENT events as well. There is no way 41 | to determine the cause of an SDL_QUITEVENT, but setting a signal 42 | handler in your application will override the default generation of 43 | quit events for that signal. 44 | */ 45 | 46 | /* There are no functions directly affecting the quit event */ 47 | #define SDL_QuitRequested() \ 48 | (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) 49 | 50 | #endif /* _SDL_quit_h */ 51 | -------------------------------------------------------------------------------- /include/SDL/SDL_thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_thread_h 24 | #define _SDL_thread_h 25 | 26 | /* Header for the SDL thread management routines 27 | 28 | These are independent of the other SDL routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /* Thread synchronization primitives */ 35 | #include "SDL_mutex.h" 36 | 37 | #include "begin_code.h" 38 | /* Set up for C function definitions, even when using C++ */ 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /* The SDL thread structure, defined in SDL_thread.c */ 44 | struct SDL_Thread; 45 | typedef struct SDL_Thread SDL_Thread; 46 | 47 | /* Create a thread */ 48 | #if (defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__) 49 | /* 50 | We compile SDL into a DLL on OS/2. This means, that it's the DLL which 51 | creates a new thread for the calling process with the SDL_CreateThread() 52 | API. There is a problem with this, that only the RTL of the SDL.DLL will 53 | be initialized for those threads, and not the RTL of the calling application! 54 | To solve this, we make a little hack here. 55 | We'll always use the caller's _beginthread() and _endthread() APIs to 56 | start a new thread. This way, if it's the SDL.DLL which uses this API, 57 | then the RTL of SDL.DLL will be used to create the new thread, and if it's 58 | the application, then the RTL of the application will be used. 59 | So, in short: 60 | Always use the _beginthread() and _endthread() of the calling runtime library! 61 | */ 62 | #define SDL_PASSED_BEGINTHREAD_ENDTHREAD 63 | #ifndef _WIN32_WCE 64 | #include /* This has _beginthread() and _endthread() defined! */ 65 | #endif 66 | 67 | #ifdef __OS2__ 68 | typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg); 69 | typedef void (*pfnSDL_CurrentEndThread)(void); 70 | #elif __GNUC__ 71 | typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, 72 | unsigned (__stdcall *func)(void *), void *arg, 73 | unsigned, unsigned *threadID); 74 | typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); 75 | #else 76 | typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, 77 | unsigned (__stdcall *func)(void *), void *arg, 78 | unsigned, unsigned *threadID); 79 | typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); 80 | #endif 81 | 82 | extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); 83 | 84 | #ifdef __OS2__ 85 | #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread) 86 | #elif defined(_WIN32_WCE) 87 | #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL) 88 | #else 89 | #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex) 90 | #endif 91 | #else 92 | extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data); 93 | #endif 94 | 95 | /* Get the 32-bit thread identifier for the current thread */ 96 | extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); 97 | 98 | /* Get the 32-bit thread identifier for the specified thread, 99 | equivalent to SDL_ThreadID() if the specified thread is NULL. 100 | */ 101 | extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread); 102 | 103 | /* Wait for a thread to finish. 104 | The return code for the thread function is placed in the area 105 | pointed to by 'status', if 'status' is not NULL. 106 | */ 107 | extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status); 108 | 109 | /* Forcefully kill a thread without worrying about its state */ 110 | extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread); 111 | 112 | 113 | /* Ends C function definitions when using C++ */ 114 | #ifdef __cplusplus 115 | } 116 | #endif 117 | #include "close_code.h" 118 | 119 | #endif /* _SDL_thread_h */ 120 | -------------------------------------------------------------------------------- /include/SDL/SDL_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_timer_h 24 | #define _SDL_timer_h 25 | 26 | /* Header for the SDL time management routines */ 27 | 28 | #include "SDL_stdinc.h" 29 | #include "SDL_error.h" 30 | 31 | #include "begin_code.h" 32 | /* Set up for C function definitions, even when using C++ */ 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* This is the OS scheduler timeslice, in milliseconds */ 38 | #define SDL_TIMESLICE 10 39 | 40 | /* This is the maximum resolution of the SDL timer on all platforms */ 41 | #define TIMER_RESOLUTION 10 /* Experimentally determined */ 42 | 43 | /* Get the number of milliseconds since the SDL library initialization. 44 | * Note that this value wraps if the program runs for more than ~49 days. 45 | */ 46 | extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); 47 | 48 | /* Wait a specified number of milliseconds before returning */ 49 | extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); 50 | 51 | /* Function prototype for the timer callback function */ 52 | typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval); 53 | 54 | /* Set a callback to run after the specified number of milliseconds has 55 | * elapsed. The callback function is passed the current timer interval 56 | * and returns the next timer interval. If the returned value is the 57 | * same as the one passed in, the periodic alarm continues, otherwise a 58 | * new alarm is scheduled. If the callback returns 0, the periodic alarm 59 | * is cancelled. 60 | * 61 | * To cancel a currently running timer, call SDL_SetTimer(0, NULL); 62 | * 63 | * The timer callback function may run in a different thread than your 64 | * main code, and so shouldn't call any functions from within itself. 65 | * 66 | * The maximum resolution of this timer is 10 ms, which means that if 67 | * you request a 16 ms timer, your callback will run approximately 20 ms 68 | * later on an unloaded system. If you wanted to set a flag signaling 69 | * a frame update at 30 frames per second (every 33 ms), you might set a 70 | * timer for 30 ms: 71 | * SDL_SetTimer((33/10)*10, flag_update); 72 | * 73 | * If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init(). 74 | * 75 | * Under UNIX, you should not use raise or use SIGALRM and this function 76 | * in the same program, as it is implemented using setitimer(). You also 77 | * should not use this function in multi-threaded applications as signals 78 | * to multi-threaded apps have undefined behavior in some implementations. 79 | * 80 | * This function returns 0 if successful, or -1 if there was an error. 81 | */ 82 | extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); 83 | 84 | /* New timer API, supports multiple timers 85 | * Written by Stephane Peter 86 | */ 87 | 88 | /* Function prototype for the new timer callback function. 89 | * The callback function is passed the current timer interval and returns 90 | * the next timer interval. If the returned value is the same as the one 91 | * passed in, the periodic alarm continues, otherwise a new alarm is 92 | * scheduled. If the callback returns 0, the periodic alarm is cancelled. 93 | */ 94 | typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param); 95 | 96 | /* Definition of the timer ID type */ 97 | typedef struct _SDL_TimerID *SDL_TimerID; 98 | 99 | /* Add a new timer to the pool of timers already running. 100 | Returns a timer ID, or NULL when an error occurs. 101 | */ 102 | extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param); 103 | 104 | /* Remove one of the multiple timers knowing its ID. 105 | * Returns a boolean value indicating success. 106 | */ 107 | extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); 108 | 109 | /* Ends C function definitions when using C++ */ 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | #include "close_code.h" 114 | 115 | #endif /* _SDL_timer_h */ 116 | -------------------------------------------------------------------------------- /include/SDL/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* DEPRECATED */ 24 | #include "SDL_stdinc.h" 25 | -------------------------------------------------------------------------------- /include/SDL/SDL_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2006 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* This header defines the current SDL version */ 24 | 25 | #ifndef _SDL_version_h 26 | #define _SDL_version_h 27 | 28 | #include "SDL_stdinc.h" 29 | 30 | #include "begin_code.h" 31 | /* Set up for C function definitions, even when using C++ */ 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL 37 | */ 38 | #define SDL_MAJOR_VERSION 1 39 | #define SDL_MINOR_VERSION 2 40 | #define SDL_PATCHLEVEL 11 41 | 42 | typedef struct SDL_version { 43 | Uint8 major; 44 | Uint8 minor; 45 | Uint8 patch; 46 | } SDL_version; 47 | 48 | /* This macro can be used to fill a version structure with the compile-time 49 | * version of the SDL library. 50 | */ 51 | #define SDL_VERSION(X) \ 52 | { \ 53 | (X)->major = SDL_MAJOR_VERSION; \ 54 | (X)->minor = SDL_MINOR_VERSION; \ 55 | (X)->patch = SDL_PATCHLEVEL; \ 56 | } 57 | 58 | /* This macro turns the version numbers into a numeric value: 59 | (1,2,3) -> (1203) 60 | This assumes that there will never be more than 100 patchlevels 61 | */ 62 | #define SDL_VERSIONNUM(X, Y, Z) \ 63 | ((X)*1000 + (Y)*100 + (Z)) 64 | 65 | /* This is the version number macro for the current SDL version */ 66 | #define SDL_COMPILEDVERSION \ 67 | SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) 68 | 69 | /* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ 70 | #define SDL_VERSION_ATLEAST(X, Y, Z) \ 71 | (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) 72 | 73 | /* This function gets the version of the dynamically linked SDL library. 74 | it should NOT be used to fill a version structure, instead you should 75 | use the SDL_Version() macro. 76 | */ 77 | extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void); 78 | 79 | /* Ends C function definitions when using C++ */ 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #include "close_code.h" 84 | 85 | #endif /* _SDL_version_h */ 86 | -------------------------------------------------------------------------------- /include/SDL/begin_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2004 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* This file sets things up for C dynamic library function definitions, 24 | static inlined functions, and structures aligned at 4-byte alignment. 25 | If you don't like ugly C preprocessor code, don't look at this file. :) 26 | */ 27 | 28 | /* This shouldn't be nested -- included it around code only. */ 29 | #ifdef _begin_code_h 30 | #error Nested inclusion of begin_code.h 31 | #endif 32 | #define _begin_code_h 33 | 34 | /* Some compilers use a special export keyword */ 35 | #ifndef DECLSPEC 36 | # if defined(__BEOS__) 37 | # if defined(__GNUC__) 38 | # define DECLSPEC __declspec(dllexport) 39 | # else 40 | # define DECLSPEC __declspec(export) 41 | # endif 42 | # elif defined(__WIN32__) 43 | # ifdef __BORLANDC__ 44 | # ifdef BUILD_SDL 45 | # define DECLSPEC 46 | # else 47 | # define DECLSPEC __declspec(dllimport) 48 | # endif 49 | # else 50 | # define DECLSPEC __declspec(dllexport) 51 | # endif 52 | # elif defined(__OS2__) 53 | # ifdef __WATCOMC__ 54 | # ifdef BUILD_SDL 55 | # define DECLSPEC __declspec(dllexport) 56 | # else 57 | # define DECLSPEC 58 | # endif 59 | # else 60 | # define DECLSPEC 61 | # endif 62 | # else 63 | # if defined(__GNUC__) && __GNUC__ >= 4 64 | # define DECLSPEC __attribute__ ((visibility("default"))) 65 | # else 66 | # define DECLSPEC 67 | # endif 68 | # endif 69 | #endif 70 | 71 | /* By default SDL uses the C calling convention */ 72 | #ifndef SDLCALL 73 | #if defined(__WIN32__) && !defined(__GNUC__) 74 | #define SDLCALL __cdecl 75 | #else 76 | #ifdef __OS2__ 77 | /* But on OS/2, we use the _System calling convention */ 78 | /* to be compatible with every compiler */ 79 | #define SDLCALL _System 80 | #else 81 | #define SDLCALL 82 | #endif 83 | #endif 84 | #endif /* SDLCALL */ 85 | 86 | /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ 87 | #ifdef __SYMBIAN32__ 88 | #undef DECLSPEC 89 | #define DECLSPEC 90 | #endif /* __SYMBIAN32__ */ 91 | 92 | /* Force structure packing at 4 byte alignment. 93 | This is necessary if the header is included in code which has structure 94 | packing set to an alternate value, say for loading structures from disk. 95 | The packing is reset to the previous value in close_code.h 96 | */ 97 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 98 | #ifdef _MSC_VER 99 | #pragma warning(disable: 4103) 100 | #endif 101 | #ifdef __BORLANDC__ 102 | #pragma nopackwarning 103 | #endif 104 | #pragma pack(push,4) 105 | #elif (defined(__MWERKS__) && defined(__MACOS__)) 106 | #pragma options align=mac68k4byte 107 | #pragma enumsalwaysint on 108 | #endif /* Compiler needs structure packing set */ 109 | 110 | /* Set up compiler-specific options for inlining functions */ 111 | #ifndef SDL_INLINE_OKAY 112 | #ifdef __GNUC__ 113 | #define SDL_INLINE_OKAY 114 | #else 115 | /* Add any special compiler-specific cases here */ 116 | #if defined(_MSC_VER) || defined(__BORLANDC__) || \ 117 | defined(__DMC__) || defined(__SC__) || \ 118 | defined(__WATCOMC__) || defined(__LCC__) || \ 119 | defined(__DECC) 120 | #ifndef __inline__ 121 | #define __inline__ __inline 122 | #endif 123 | #define SDL_INLINE_OKAY 124 | #else 125 | #if !defined(__MRC__) && !defined(_SGI_SOURCE) 126 | #define __inline__ inline 127 | #define SDL_INLINE_OKAY 128 | #endif /* Not a funky compiler */ 129 | #endif /* Visual C++ */ 130 | #endif /* GNU C */ 131 | #endif /* SDL_INLINE_OKAY */ 132 | 133 | /* If inlining isn't supported, remove "__inline__", turning static 134 | inlined functions into static functions (resulting in code bloat 135 | in all files which include the offending header files) 136 | */ 137 | #ifndef SDL_INLINE_OKAY 138 | #define __inline__ 139 | #endif 140 | 141 | /* Apparently this is needed by several Windows compilers */ 142 | #if !defined(__MACH__) 143 | #ifndef NULL 144 | #ifdef __cplusplus 145 | #define NULL 0 146 | #else 147 | #define NULL ((void *)0) 148 | #endif 149 | #endif /* NULL */ 150 | #endif /* ! Mac OS X - breaks precompiled headers */ 151 | -------------------------------------------------------------------------------- /include/SDL/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2004 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* This file reverses the effects of begin_code.h and should be included 24 | after you finish any function and structure declarations in your headers 25 | */ 26 | 27 | #undef _begin_code_h 28 | 29 | /* Reset structure packing at previous byte alignment */ 30 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) 31 | #ifdef __BORLANDC__ 32 | #pragma nopackwarning 33 | #endif 34 | #if (defined(__MWERKS__) && defined(__MACOS__)) 35 | #pragma options align=reset 36 | #pragma enumsalwaysint reset 37 | #else 38 | #pragma pack(pop) 39 | #endif 40 | #endif /* Compiler needs structure packing set */ 41 | 42 | -------------------------------------------------------------------------------- /lib/SDL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/lib/SDL.lib -------------------------------------------------------------------------------- /lib/SDL_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/lib/SDL_image.lib -------------------------------------------------------------------------------- /lib/SDL_mixer.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/lib/SDL_mixer.lib -------------------------------------------------------------------------------- /lib/SDL_net.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/lib/SDL_net.lib -------------------------------------------------------------------------------- /lib/SDLmain.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/lib/SDLmain.lib -------------------------------------------------------------------------------- /models/T8dm6.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/T8dm6.bsp -------------------------------------------------------------------------------- /models/ascend.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/ascend.bsp -------------------------------------------------------------------------------- /models/ciudad.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/ciudad.bsp -------------------------------------------------------------------------------- /models/final.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/final.bsp -------------------------------------------------------------------------------- /models/final3.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/final3.bsp -------------------------------------------------------------------------------- /models/newmap.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/newmap.bsp -------------------------------------------------------------------------------- /models/nivel.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/nivel.bsp -------------------------------------------------------------------------------- /models/ogro/igdosh.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/ogro/igdosh.pcx -------------------------------------------------------------------------------- /models/ogro/ogrobase.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/ogro/ogrobase.pcx -------------------------------------------------------------------------------- /models/ogro/tris.md2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/ogro/tris.md2 -------------------------------------------------------------------------------- /models/ogro/weapon.md2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/ogro/weapon.md2 -------------------------------------------------------------------------------- /models/ogro/weapon.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/ogro/weapon.pcx -------------------------------------------------------------------------------- /models/q3dm7.bsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/q3dm7.bsp -------------------------------------------------------------------------------- /models/sodf8/SFOD8.txt: -------------------------------------------------------------------------------- 1 | 12-03-00 - metric 2 | 3 | ***THIS MODEL IS NOT TO BE RATED OR REVIEWED*** (Just the skins) ***BUT NOT THE MODEL!!!**** 4 | 5 | =========================================================================================== 6 | 7 | Model Name : SuperFlashOmegaDragon8 (SFOD8) 8 | 9 | install dir : quake2/baseq2/players/SFOD8/ 10 | 11 | Authors : Burnt Kona, Crash, Firestarter, OgrO_FiX, Sgt. Science 12 | 13 | Email : science@pathcom.com 14 | 15 | Model Description : Gah. My nightmare. A project I started a long time ago and enlisted the help of some very 16 | talented skinners to help me out. Things were going good, and I had high hopes for this 17 | model, then I got distracted by some crap, like moving, left him to rot on my HD for ages. 18 | Every time I came back to tweak him and finish it off, something fucked up. I can no 19 | Longer edit the files cause of software version differences, the files are all over my HD, 20 | and I can't even see him in Q2 since it doesn't like my new video card and won't load. The 21 | last time I even saw this model was months ago. But I showed it to Firestarter cause I 22 | felt like a flake, and he encouraged my to send it out anyways, and have faith that people 23 | would look past his short comings. And even though the model has problems, you can still 24 | check out the great skins, cause I owe the skinners that much at least. Read further to 25 | see his problems. 26 | 27 | 28 | 29 | Credits : FIRESTARTER! OgrO_FIX! BURNT KONA! CRASH! 30 | Idsoftware 31 | NST 32 | Qtip 33 | 34 | Thanks go out to : FIRESTARTER! OgrO_FIX! BURNT KONA! CRASH! 35 | I gave them a nightmare of a skin map, and they all said "Ya! Painting on this segmented piece of 36 | crap may be like having a rusty hook gouge my eyes out over a long period of time, but 37 | hey! We love you Science! I'll do anything to skin your great model!" ok... they might 38 | not have said that EXACTLY, but that's how I remember it, and I now that's how they were 39 | feeling. 40 | My sincerest apologies guys. You did great work. 41 | 42 | (please don't kill me) 43 | =========================================================================================== 44 | * play Info * 45 | 46 | New Sounds : I'm a flake, remember? 47 | 48 | CTF Skins : I'm a flake, remember? 49 | 50 | VWEP Support : I'm a flake, remember? 51 | 52 | * Construction * 53 | 54 | Poly Count: 55 | 56 | Tris Weapon Total 57 | 732 109 841 58 | 59 | 60 | 61 | Vert Count: 62 | 63 | Tris Weapon Total 64 | 395 70 465 65 | 66 | 67 | 68 | 69 | Skin Count : 4 DM 70 | Reiger by Burnt Kona 71 | 72 | Tengu by Firestarter 73 | 74 | skin01cs by Crash 75 | 76 | abarlith by OgrO_FiX 77 | 78 | 79 | 80 | 81 | Editors Used :this model is crap! forget it! it doesn't count! Why do you care? 82 | 83 | Other Rants: 84 | on my failings: 85 | 86 | 1. First! this started as a decent model! so construction and poly count are alright... still break 87 | 800, but better than @'s count. 88 | 89 | 2. Second! the big problems! If i remember right... uh... don't even bother looking at the wave 90 | animation or you may go blind! really! and the sad part is, I was just messing with a new anim. 91 | I had a fairly good flying spin kick in there before, and now I can't even change it back! It 92 | could be a half decent model if not for that! dammit! and man... the crouch walk... *sigh* I was 93 | doing some experimentation there too... I think the CRdeath is about 2 keyframes as well,,, 1 94 | crouching at the first frame, then 1 dead at the last frame... *double sigh* The stand anim too.. 95 | it loops fairly poorly. I was editing that too, but thankfully I was almost done... I think the 96 | only other problems are the pain anims 1 and 3... more experimentation, but pain 2 should be ok. 97 | 98 | 3. this isn't really a problem since I took them out but... I even had like, 7 Vweps done, but they 99 | would be floating all over the model trying to match animations that don't exist, So I got rid of 100 | them. Man do I ever suck. 101 | 102 | any questions, concerns, flames, send them my way... I don't know if the skinners want to be bothered, of if I 103 | should put their addresses in here or not so.... if u have anything to say to them, just send it though me and 104 | I'll pass it along 105 | 106 | Jones, the Sergeant of Science 107 | 108 | I REALLY hope these are the right files... -------------------------------------------------------------------------------- /models/sodf8/abarlith.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/sodf8/abarlith.pcx -------------------------------------------------------------------------------- /models/sodf8/tris.md2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/sodf8/tris.md2 -------------------------------------------------------------------------------- /models/sodf8/weapon.md2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/sodf8/weapon.md2 -------------------------------------------------------------------------------- /models/sodf8/weapon.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/models/sodf8/weapon.pcx -------------------------------------------------------------------------------- /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/screenshots/2.png -------------------------------------------------------------------------------- /screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/screenshots/3.png -------------------------------------------------------------------------------- /screenshots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/screenshots/4.png -------------------------------------------------------------------------------- /screenshots/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/screenshots/5.png -------------------------------------------------------------------------------- /screenshots/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/screenshots/6.png -------------------------------------------------------------------------------- /sounds/CANYON.MID: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/sounds/CANYON.MID -------------------------------------------------------------------------------- /sounds/ambient.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/sounds/ambient.wav -------------------------------------------------------------------------------- /src/Frustum.h: -------------------------------------------------------------------------------- 1 | #ifndef _FRUSTUM_H 2 | #define _FRUSTUM_H 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | // This will allow us to create an object to keep track of our frustum 10 | class CFrustum { 11 | 12 | public: 13 | 14 | // Call this every time the camera moves to update the frustum 15 | void CalculateFrustum(); 16 | 17 | // This takes a 3D point and returns TRUE if it's inside of the frustum 18 | bool PointInFrustum(float x, float y, float z); 19 | 20 | // This takes a 3D point and a radius and returns TRUE if the sphere is inside of the frustum 21 | bool SphereInFrustum(float x, float y, float z, float radius); 22 | 23 | // This takes the center and half the length of the cube. 24 | bool CubeInFrustum(float x, float y, float z, float size); 25 | 26 | 27 | /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * 28 | 29 | // This checks if a box is in the frustum 30 | bool BoxInFrustum(float x, float y, float z, float sizeX, float sizeY, float sizeZ); 31 | 32 | /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * 33 | 34 | 35 | private: 36 | 37 | // This holds the A B C and D values for each side of our frustum. 38 | float m_Frustum[6][4]; 39 | }; 40 | 41 | #endif 42 | // This is our debug lines class to view the octree visually 43 | -------------------------------------------------------------------------------- /src/HiResTimer.cpp: -------------------------------------------------------------------------------- 1 | #include "HiResTimer.h" 2 | 3 | /****************************************************************************/ 4 | /** \file HiResTimer.cpp 5 | \brief Contains the CHiResTimer implementation */ 6 | 7 | 8 | /****************************************************************************/ 9 | /** 10 | If the hi-res timer is present, the tick rate is stored and the function 11 | returns true. Otherwise, the function returns false, and the timer should 12 | not be used. 13 | *****************************************************************************/ 14 | bool CHiResTimer::Init() 15 | { 16 | m_startTime = SDL_GetTicks(); 17 | return true; 18 | } // end Init() 19 | 20 | 21 | /****************************************************************************/ 22 | /** \return Number of seconds since the last call to GetElapsedSeconds 23 | \param elapsedFrames Number of frames since last call 24 | *****************************************************************************/ 25 | float CHiResTimer::GetElapsedSeconds(unsigned long elapsedFrames) 26 | { 27 | static Uint32 s_lastTime = m_startTime; 28 | Uint32 currentTime; 29 | 30 | currentTime = SDL_GetTicks(); 31 | float seconds = ((float)currentTime - (float)s_lastTime) / 1000.0; 32 | 33 | s_lastTime = currentTime; 34 | 35 | return seconds; 36 | } // end GetElapsedSeconds() 37 | 38 | 39 | /**************************************************************************/ 40 | /** 41 | Returns the average frames per second over elapsedFrames, which defaults to 42 | one. If this is not called every frame, the client should track the number 43 | of frames itself, and reset the value after this is called. 44 | ***************************************************************************/ 45 | float CHiResTimer::GetFPS(unsigned long elapsedFrames) 46 | { 47 | static Uint32 s_lastTime = m_startTime; 48 | Uint32 currentTime; 49 | 50 | currentTime = SDL_GetTicks(); 51 | float fps = (float)elapsedFrames * 1000.0 / ((float)currentTime - (float)s_lastTime); 52 | 53 | s_lastTime = currentTime; 54 | 55 | return fps; 56 | } // end GetFPS 57 | 58 | 59 | /**************************************************************************/ 60 | /** 61 | Used to lock the frame rate to a set amount. This will block until enough 62 | time has passed to ensure that the fps won't go over the requested amount. 63 | Note that this can only keep the fps from going above the specified level; 64 | it can still drop below it. It is assumed that if used, this function will 65 | be called every frame. The value returned is the instantaneous fps, which 66 | will be <= targetFPS. 67 | ***************************************************************************/ 68 | float CHiResTimer::LockFPS(unsigned char targetFPS) 69 | { 70 | if (targetFPS == 0) 71 | targetFPS = 1; 72 | 73 | static Uint32 s_lastTime = m_startTime; 74 | Uint32 currentTime; 75 | float fps; 76 | 77 | do{ 78 | currentTime = SDL_GetTicks(); 79 | fps = 1000.0 / ((float)(currentTime - s_lastTime)); 80 | }while(fps > (float)targetFPS); 81 | 82 | s_lastTime = currentTime; 83 | 84 | return fps; 85 | } // end LockFPS() 86 | 87 | -------------------------------------------------------------------------------- /src/HiResTimer.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /** \file HiResTimer.h 3 | 4 | \brief Contains the CHiResTimer class 5 | \author Dave Astle 6 | \date 2/1/2001 7 | 8 | Modificado por José María Arnau el 11/09/2006 9 | ****************************************************************************/ 10 | 11 | #ifndef __TIMER_H_INCLUDED__ 12 | #define __TIMER_H_INCLUDED__ 13 | 14 | #include 15 | 16 | /***************************************************************************/ 17 | /** \class CHiResTimer 18 | 19 | \brief Wrapper for the high-resolution timer. This class uses the SDL 20 | high resolution timers. 21 | ****************************************************************************/ 22 | class CHiResTimer 23 | { 24 | public: 25 | CHiResTimer() {} 26 | ~CHiResTimer() {} 27 | 28 | bool Init(); 29 | float GetElapsedSeconds(unsigned long elapsedFrames = 1); 30 | float GetFPS(unsigned long elapsedFrames = 1); 31 | float LockFPS(unsigned char targetFPS); 32 | 33 | private: 34 | /** Object creation instant */ 35 | Uint32 m_startTime; 36 | }; 37 | 38 | #endif // __TIMER_H_INCLUDED_ 39 | -------------------------------------------------------------------------------- /src/InputSystem.cpp: -------------------------------------------------------------------------------- 1 | #include "InputSystem.h" 2 | 3 | /*********************************************************************************************/ 4 | /** \file InputSystem.cpp 5 | \brief The CInputSystem class implementation */ 6 | 7 | 8 | /*********************************************************************************************/ 9 | /** CInputSystem class constructor 10 | \param flags valid flags: IS_USEKEYBOARD, IS_USEMOUSE and IS_USEJOYSTICK. 11 | 12 | Use (IS_USEKEYBOARD | IS_USEMOUSE) to get keyboard and mouse control. 13 | Joystick control is not yet implemented. 14 | **********************************************************************************************/ 15 | CInputSystem::CInputSystem(int flags): m_pKeyboard(NULL), m_pMouse(NULL), m_pJoystick(NULL) 16 | { 17 | if (flags & IS_USEKEYBOARD) 18 | { 19 | m_pKeyboard = new CKeyboard; 20 | } 21 | if (flags & IS_USEMOUSE) 22 | { 23 | m_pMouse = new CMouse; 24 | } 25 | if (flags & IS_USEJOYSTICK) 26 | { 27 | SDL_InitSubSystem(SDL_INIT_JOYSTICK); 28 | m_pJoystick = new CJoystick; 29 | } 30 | } 31 | 32 | 33 | /*********************************************************************************************/ 34 | /** CInputSystem class desstructor 35 | **********************************************************************************************/ 36 | CInputSystem::~CInputSystem() 37 | { 38 | delete m_pKeyboard; 39 | delete m_pMouse; 40 | 41 | if (m_pJoystick) 42 | { 43 | delete m_pJoystick; 44 | SDL_QuitSubSystem(SDL_INIT_JOYSTICK); 45 | } 46 | } 47 | 48 | 49 | /*********************************************************************************************/ 50 | /** Check input events to update keyboard and mouse state. 51 | **********************************************************************************************/ 52 | bool CInputSystem::Update() 53 | { 54 | /* Pumps the event loop, gathering events from the input devices */ 55 | SDL_PumpEvents(); 56 | 57 | if (m_pKeyboard) 58 | m_pKeyboard->Update(); 59 | if (m_pMouse) 60 | m_pMouse->Update(); 61 | if (m_pJoystick) 62 | m_pJoystick->Update(); 63 | 64 | return true; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /src/InputSystem.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /** \file InputSystem.h 3 | \brief Contains the CInputSystem class 4 | 5 | \author José Mª Arnau 6 | \date 11/09/2006 7 | ***************************************************************************/ 8 | 9 | #ifndef __INPUT_SYSTEM_INCLUDED__ 10 | #define __INPUT_SYSTEM_INCLUDED__ 11 | 12 | #include 13 | #include "Keyboard.h" 14 | #include "Mouse.h" 15 | #include "Joystick.h" 16 | 17 | #define IS_USEKEYBOARD 1 18 | #define IS_USEMOUSE 2 19 | #define IS_USEJOYSTICK 4 20 | 21 | /**************************************************************************/ 22 | /** \class CInputSystem 23 | \brief This class controls input events: keyboard, mouse and 24 | joysticks events. 25 | ***************************************************************************/ 26 | class CInputSystem 27 | { 28 | public: 29 | CInputSystem(int flags); 30 | ~CInputSystem(); 31 | 32 | CKeyboard *GetKeyboard() { return m_pKeyboard; } 33 | CMouse *GetMouse() { return m_pMouse; } 34 | CJoystick *GetJoystick() { return m_pJoystick; } 35 | 36 | bool Update(); 37 | 38 | bool KeyDown(SDLKey key) { return (m_pKeyboard && m_pKeyboard->KeyDown(key)); } 39 | bool KeyUp(SDLKey key) { return (m_pKeyboard && m_pKeyboard->KeyUp(key)); } 40 | 41 | bool ButtonDown(int button) { return (m_pMouse && m_pMouse->ButtonDown(button)); } 42 | bool ButtonUp(int button) { return (m_pMouse && m_pMouse->ButtonUp(button)); } 43 | 44 | /** dx and dy are set to the change in the mouse position since the last call */ 45 | void GetMouseMovement(int &dx, int &dy) { if (m_pMouse) m_pMouse->GetMovement(dx, dy); } 46 | 47 | private: 48 | CKeyboard *m_pKeyboard; 49 | CMouse *m_pMouse; 50 | CJoystick *m_pJoystick; 51 | }; 52 | 53 | /*************************************************************************** 54 | SDL mouse constants: 55 | SDL_BUTTON_LEFT 56 | SDL_BUTTON_MIDDLE 57 | SDL_BUTTON_RIGHT 58 | SDL_BUTTON_WHEELUP 59 | SDL_BUTTON_WHEELDOWN 60 | 61 | Some SDL keyboard constants: 62 | 63 | *** SDLKey *** *** Common name *** 64 | SDLK_BACKSPACE backspace 65 | SDLK_TAB tab 66 | SDLK_CLEAR clear 67 | SDLK_RETURN return 68 | SDLK_ESCAPE escape 69 | SDLK_SPACE space 70 | SDLK_DOLLAR dollar 71 | SDLK_AMPERSAND ampersand 72 | SDLK_ASTERISK asterisk 73 | SDLK_PLUS plus sign 74 | SDLK_COMMA comma 75 | SDLK_MINUS minus sign 76 | SDLK_PERIOD period / full stop 77 | SDLK_0 0 78 | SDLK_1 1 79 | SDLK_2 2 80 | SDLK_3 3 81 | SDLK_4 4 82 | SDLK_5 5 83 | SDLK_6 6 84 | SDLK_7 7 85 | SDLK_8 8 86 | SDLK_9 9 87 | SDLK_a a 88 | SDLK_b b 89 | SDLK_c c 90 | SDLK_d d 91 | SDLK_e e 92 | SDLK_f f 93 | SDLK_g g 94 | SDLK_h h 95 | SDLK_i i 96 | SDLK_j j 97 | SDLK_k k 98 | SDLK_l l 99 | SDLK_m m 100 | SDLK_n n 101 | SDLK_o o 102 | SDLK_p p 103 | SDLK_q q 104 | SDLK_r r 105 | SDLK_s s 106 | SDLK_t t 107 | SDLK_u u 108 | SDLK_v v 109 | SDLK_w w 110 | SDLK_x x 111 | SDLK_y y 112 | SDLK_z z 113 | SDLK_DELETE delete 114 | SDLK_KP0 keypad 0 115 | SDLK_KP1 keypad 1 116 | SDLK_KP2 keypad 2 117 | SDLK_KP3 keypad 3 118 | SDLK_KP4 keypad 4 119 | SDLK_KP5 keypad 5 120 | SDLK_KP6 keypad 6 121 | SDLK_KP7 keypad 7 122 | SDLK_KP8 keypad 8 123 | SDLK_KP9 keypad 9 124 | SDLK_UP up arrow 125 | SDLK_DOWN down arrow 126 | SDLK_RIGHT right arrow 127 | SDLK_LEFT left arrow 128 | SDLK_INSERT insert 129 | SDLK_HOME home 130 | SDLK_END end 131 | SDLK_PAGEUP page up 132 | SDLK_PAGEDOWN page down 133 | SDLK_F1 F1 134 | SDLK_F2 F2 135 | SDLK_F3 F3 136 | SDLK_F4 F4 137 | SDLK_F5 F5 138 | SDLK_F6 F6 139 | SDLK_F7 F7 140 | SDLK_F8 F8 141 | SDLK_F9 F9 142 | SDLK_F10 F10 143 | SDLK_F11 F11 144 | SDLK_F12 F12 145 | SDLK_F13 F13 146 | SDLK_F14 F14 147 | SDLK_F15 F15 148 | SDLK_RSHIFT right shift 149 | SDLK_LSHIFT left shift 150 | SDLK_RCTRL right ctrl 151 | SDLK_LCTRL left ctrl 152 | SDLK_RALT right alt / alt gr 153 | SDLK_LALT left alt 154 | SDLK_RMETA right meta 155 | SDLK_LMETA left meta 156 | SDLK_PRINT print-screen 157 | SDLK_UNDO undo 158 | 159 | ***************************************************************************/ 160 | 161 | #endif 162 | -------------------------------------------------------------------------------- /src/Joystick.cpp: -------------------------------------------------------------------------------- 1 | #include "Joystick.h" 2 | 3 | /***************************************************/ 4 | /** \file Joystick.cpp 5 | \brief CJoystick class is not yet implemented */ 6 | 7 | 8 | CJoystick::CJoystick() 9 | { 10 | } 11 | 12 | CJoystick::~CJoystick() 13 | { 14 | } 15 | 16 | bool CJoystick::Update() 17 | { 18 | return true; 19 | } 20 | -------------------------------------------------------------------------------- /src/Joystick.h: -------------------------------------------------------------------------------- 1 | /********************************************************/ 2 | /** \file Joystick.h 3 | \brief Contains the CJoystick class 4 | 5 | \author José Maria Arnau 6 | \date 11/09/2006 7 | *********************************************************/ 8 | 9 | #ifndef __JOYSTICK_INCLUDED__ 10 | #define __JOYSTICK_INCLUDED__ 11 | 12 | 13 | #include 14 | 15 | /********************************************************/ 16 | /** \class CJoystick 17 | \brief This class controls a joystick or gamepad. 18 | *********************************************************/ 19 | class CJoystick 20 | { 21 | public: 22 | CJoystick(); 23 | ~CJoystick(); 24 | 25 | bool Update(); 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/Keyboard.cpp: -------------------------------------------------------------------------------- 1 | #include "Keyboard.h" 2 | 3 | /****************************************************/ 4 | /** \file Keyboard.cpp 5 | \brief The CKeyboard class implementation */ 6 | 7 | 8 | /****************************************************/ 9 | /** \return True if 'key' is pressed 10 | *****************************************************/ 11 | bool CKeyboard::KeyDown(SDLKey key) 12 | { 13 | return m_keys[key]; 14 | } 15 | 16 | 17 | /****************************************************/ 18 | /** \return False if 'key' is pressed 19 | *****************************************************/ 20 | bool CKeyboard::KeyUp(SDLKey key) 21 | { 22 | return !(m_keys[key]); 23 | } 24 | 25 | 26 | /****************************************************/ 27 | /** Update keyboard state 28 | *****************************************************/ 29 | bool CKeyboard::Update() 30 | { 31 | m_keys = SDL_GetKeyState(NULL); 32 | return true; 33 | } 34 | -------------------------------------------------------------------------------- /src/Keyboard.h: -------------------------------------------------------------------------------- 1 | /*******************************************************/ 2 | /** \file Keyboard.h 3 | \brief Contains the CKeyboard class 4 | 5 | \author José Mª Arnau 6 | \date 11/09/2006 7 | ********************************************************/ 8 | 9 | #ifndef __KEYBOARD_INCLUDED__ 10 | #define __KEYBOARD_INCLUDED__ 11 | 12 | 13 | #include 14 | 15 | /*******************************************************/ 16 | /** \class CKeyboard 17 | \brief This class controls the keyboard 18 | ********************************************************/ 19 | class CKeyboard 20 | { 21 | public: 22 | bool KeyDown(SDLKey key); 23 | bool KeyUp(SDLKey key); 24 | 25 | bool Update(); 26 | 27 | private: 28 | Uint8 *m_keys; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/Mouse.cpp: -------------------------------------------------------------------------------- 1 | #include "Mouse.h" 2 | 3 | /********************************************************************/ 4 | /** \file Mouse.cpp 5 | \brief Contains the CMouse implementation */ 6 | 7 | 8 | /********************************************************************/ 9 | /** \return True if 'button' is pressed 10 | \param button SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, 11 | SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, 12 | SDL_BUTTON_WHEELDOWN 13 | *********************************************************************/ 14 | bool CMouse::ButtonDown(int button) 15 | { 16 | return m_state.buttons[button]; 17 | } 18 | 19 | 20 | /********************************************************************/ 21 | /** \return False if 'button' is pressed 22 | \param button SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, 23 | SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, 24 | SDL_BUTTON_WHEELDOWN 25 | *********************************************************************/ 26 | bool CMouse::ButtonUp(int button) 27 | { 28 | return !(m_state.buttons[button]); 29 | } 30 | 31 | 32 | /********************************************************************/ 33 | /** dx and dy are set to the change in the mouse position 34 | since the last call 35 | *********************************************************************/ 36 | void CMouse::GetMovement(int &dx, int &dy) 37 | { 38 | dx = m_state.x; 39 | dy = m_state.y; 40 | } 41 | 42 | 43 | /********************************************************************/ 44 | /** Update mouse state 45 | *********************************************************************/ 46 | bool CMouse::Update() 47 | { 48 | Uint8 button_mask; 49 | button_mask = SDL_GetRelativeMouseState(&m_state.x, &m_state.y); 50 | for(int i=1; i<= N_MOUSE_BUTTONS; i++) 51 | m_state.buttons[i] = button_mask & SDL_BUTTON(i); 52 | 53 | return true; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/Mouse.h: -------------------------------------------------------------------------------- 1 | /********************************************************/ 2 | /** \file Mouse.h 3 | \brief Contains the CMouse class 4 | 5 | \author José Mª Arnau 6 | \date 11/09/2006 7 | 8 | *********************************************************/ 9 | 10 | #ifndef __MOUSE_INCLUDED__ 11 | #define __MOUSE_INCLUDED__ 12 | 13 | #include 14 | 15 | #define N_MOUSE_BUTTONS 5 16 | 17 | /* 18 | SDL_BUTTON_LEFT = 1 19 | SDL_BUTTON_MIDDLE = 2 20 | SDL_BUTTON_RIGHT = 3 21 | SDL_BUTTON_WHEELUP = 4 22 | SDL_BUTTON_WHEELDOWN = 5 23 | */ 24 | 25 | struct MouseState 26 | { 27 | int x,y; 28 | bool buttons[N_MOUSE_BUTTONS+1]; 29 | }; 30 | 31 | 32 | /********************************************************/ 33 | /** \class CMouse 34 | \brief This class controls the mouse 35 | *********************************************************/ 36 | class CMouse 37 | { 38 | public: 39 | bool ButtonDown(int button); 40 | bool ButtonUp(int button); 41 | void GetMovement(int &dx, int &dy); 42 | 43 | bool Update(); 44 | 45 | private: 46 | MouseState m_state; 47 | }; 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/Q3Loader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/src/Q3Loader.h -------------------------------------------------------------------------------- /src/audio.cpp: -------------------------------------------------------------------------------- 1 | #include "audio.h" 2 | 3 | /***************************************************************/ 4 | /** \file audio.cpp 5 | \brief The CAudio implementation */ 6 | 7 | 8 | /***************************************************************/ 9 | /** The CAudio class constructor 10 | ****************************************************************/ 11 | CAudio::CAudio() { 12 | sound = NULL; 13 | channel = -1; 14 | } 15 | 16 | 17 | /***************************************************************/ 18 | /** The CAudio class destructor 19 | ****************************************************************/ 20 | CAudio::~CAudio() { 21 | if (sound) 22 | Mix_FreeChunk(sound); 23 | sound = NULL; 24 | } 25 | 26 | 27 | /***************************************************************/ 28 | /** Set the new buffer for sound data 29 | (and free the old buffer if it is not NULL). 30 | \param s Pointer to the new sound data buffer 31 | ****************************************************************/ 32 | void CAudio::SetSound(Mix_Chunk * s) { 33 | if (sound) 34 | Mix_FreeChunk(sound); 35 | sound = s; 36 | } 37 | 38 | 39 | /***************************************************************/ 40 | /** \param volume number between 0 and MIX_MAX_VOLUME (128) 41 | ****************************************************************/ 42 | void CAudio::SetVolume(float volume) 43 | { 44 | int v = int(volume); 45 | 46 | if (sound) 47 | Mix_VolumeChunk(sound, v); 48 | 49 | if (channel != -1) 50 | Mix_Volume(channel, v); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/audio.h: -------------------------------------------------------------------------------- 1 | /***********************************************************************************/ 2 | /** \file audio.h 3 | \brief Contains the CAudio class 4 | 5 | \author Jose Maria Arnau 6 | \date 01/12/2006 7 | ************************************************************************************/ 8 | 9 | #ifndef __AUDIO_H 10 | #define __AUDIO_H 11 | 12 | #include 13 | #include 14 | 15 | 16 | /***********************************************************************************/ 17 | /** \class CAudio 18 | 19 | \brief The CAudio class represents a single sound object, such as a song, 20 | ambient sound, an object's sound, etc. 21 | ************************************************************************************/ 22 | class CAudio 23 | { 24 | private: 25 | /** Pointer to the sound data buffer */ 26 | Mix_Chunk *sound; 27 | 28 | /** Channel number where the sound will be played. 29 | If this sound has no assigned channel, channel = -1 */ 30 | int channel; 31 | 32 | public: 33 | CAudio(); 34 | ~CAudio(); 35 | 36 | void SetSound(Mix_Chunk * s); 37 | Mix_Chunk* GetSound() { return sound; } 38 | 39 | int GetChannel() { return channel; } 40 | void SetChannel(int channel) { channel = channel; } 41 | 42 | void SetVolume(float volume); 43 | 44 | void Set3DPos(float x, float y, float z) {} 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/audiosystem.cpp: -------------------------------------------------------------------------------- 1 | #include "audiosystem.h" 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | /********************************************************************/ 7 | /** \file audiosystem.cpp 8 | \brief The CAudioSystem implementation */ 9 | 10 | 11 | /********************************************************************/ 12 | /** CAudioSystem class Constructor. 13 | 14 | Start SDL_mixer library. 15 | \param num_channels Number of channels to play sounds 16 | *********************************************************************/ 17 | CAudioSystem::CAudioSystem(int num_channels) 18 | { 19 | if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) == -1) { 20 | cerr << "Mix_OpenAudio: " << Mix_GetError() << endl; 21 | exit(-1); 22 | } 23 | 24 | NumChannels = num_channels; 25 | Mix_AllocateChannels(NumChannels); 26 | music = NULL; 27 | } 28 | 29 | 30 | /********************************************************************/ 31 | /** CAudioSystem class destructor 32 | Close SDL_mixer library 33 | *********************************************************************/ 34 | CAudioSystem::~CAudioSystem() 35 | { 36 | Mix_CloseAudio(); 37 | if (music) 38 | Mix_FreeMusic(music); 39 | } 40 | 41 | 42 | /********************************************************************/ 43 | /** \brief Play a CAudio object 44 | \param audio Pointer to the CAudio object 45 | \param loop True for infinite loops, False to play only one time 46 | *********************************************************************/ 47 | void CAudioSystem::Play(CAudio *audio, bool loop) 48 | { 49 | int repeat = loop ? -1:0; 50 | int channel = Mix_PlayChannel(-1, audio->GetSound(), repeat); 51 | audio->SetChannel(channel); 52 | } 53 | 54 | 55 | /********************************************************************/ 56 | /** \brief Stop a CAudio object from playing 57 | *********************************************************************/ 58 | void CAudioSystem::Stop(CAudio *audio) 59 | { 60 | Mix_HaltChannel(audio->GetChannel()); 61 | } 62 | 63 | 64 | /********************************************************************/ 65 | /** \return True if the source is playing, False otherwise 66 | *********************************************************************/ 67 | bool CAudioSystem::IsPlaying(CAudio *audio) 68 | { 69 | return Mix_Playing(audio->GetChannel()); 70 | } 71 | 72 | 73 | /********************************************************************/ 74 | /** \brief Create a CAudio object 75 | \param filename File with sound data (WAVE format only) 76 | \param Is3DSound True to apply 3D effects 77 | *********************************************************************/ 78 | CAudio *CAudioSystem::Create(char *filename, bool Is3DSound) 79 | { 80 | CAudio *audio = new CAudio; 81 | Mix_Chunk *sample = Mix_LoadWAV(filename); 82 | 83 | audio->SetSound(sample); 84 | return audio; 85 | } 86 | 87 | 88 | /********************************************************************/ 89 | /** \brief Play an audio file in any format 90 | \param filename File with sound data 91 | \param repeat Number of times to play through the music, 92 | -1 plays the music forever 93 | *********************************************************************/ 94 | void CAudioSystem::PlayMusic(char *filename, int repeat) { 95 | music = Mix_LoadMUS(filename); 96 | Mix_PlayMusic(music,repeat); 97 | } 98 | 99 | 100 | /********************************************************************/ 101 | /** \brief Stop music from playing 102 | *********************************************************************/ 103 | void CAudioSystem::StopMusic() { 104 | Mix_HaltMusic(); 105 | } 106 | 107 | 108 | /********************************************************************/ 109 | /** \brief Change music volume 110 | \param volume Number between 0 and MIX_MAX_VOLUME (128) 111 | *********************************************************************/ 112 | void CAudioSystem::SetMusicVolume(int volume) { 113 | Mix_VolumeMusic(volume); 114 | } 115 | 116 | 117 | /********************************************************************/ 118 | /** \return True if music channel is playing now 119 | *********************************************************************/ 120 | bool CAudioSystem::IsMusicPlaying() { 121 | return Mix_PlayingMusic(); 122 | } 123 | 124 | -------------------------------------------------------------------------------- /src/audiosystem.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /** \file audiosystem.h 3 | \brief Contains the CAudioSystem class 4 | 5 | \author Jose Maria Arnau 6 | \date 01/12/2006 7 | *******************************************************************************/ 8 | 9 | #ifndef __AUDIOSYSTEM_H 10 | #define __AUDIOSYSTEM_H 11 | 12 | #include 13 | #include 14 | #include "audio.h" 15 | 16 | 17 | /******************************************************************************/ 18 | /** 19 | \class CAudioSystem 20 | \brief The CAudioSystem class is the controller for creating and 21 | playing CAudio objects. 22 | 23 | The CAudioSystem class has been developed using SDL_mixer. This library 24 | provides one channel to play music in any format (WAVE, MOD, MIDI, OGG, 25 | MP3...) and many other channels to play sounds in WAVE format. 26 | *******************************************************************************/ 27 | class CAudioSystem 28 | { 29 | private: 30 | /** Number of channels to play sounds */ 31 | int NumChannels; 32 | 33 | /** Pointer to music data buffer */ 34 | Mix_Music *music; 35 | 36 | public: 37 | CAudioSystem(int num_channels = 64); 38 | ~CAudioSystem(); 39 | 40 | CAudio *Create(char *filename, bool is3DSound); 41 | 42 | void Play(CAudio *audio, bool loop); 43 | void Stop(CAudio *audio); 44 | 45 | bool IsPlaying(CAudio *audio); 46 | 47 | void PlayMusic(char *filename, int repeat); 48 | void StopMusic(); 49 | void SetMusicVolume(int volume); 50 | bool IsMusicPlaying(); 51 | 52 | void SetListenerPos(float cameraX, float cameraY, float cameraZ) {} 53 | void SetListenerOrientation(float forwardX, float forwardY, float forwardZ, float topX, float topY, float topZ) {} 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/bezier.cpp: -------------------------------------------------------------------------------- 1 | #include "bezier.h" 2 | 3 | bezier::bezier(void) 4 | { 5 | } 6 | 7 | bezier::~bezier(void) 8 | { 9 | } 10 | void bezier::tessellate(int L) { 11 | level = L; 12 | 13 | // The number of vertices along a side is 1 + num edges 14 | const int L1 = L + 1; 15 | 16 | vertex.resize(L1 * L1); 17 | 18 | // Compute the vertices 19 | int i; 20 | 21 | for (i = 0; i <= L; ++i) { 22 | double a = (double)i / L; 23 | double b = 1 - a; 24 | 25 | vertex[i] = 26 | controls[0] * (b * b) + 27 | controls[3] * (2 * b * a) + 28 | controls[6] * (a * a); 29 | } 30 | 31 | for (i = 1; i <= L; ++i) { 32 | double a = (double)i / L; 33 | double b = 1.0 - a; 34 | 35 | TVertex temp[3]; 36 | 37 | int j; 38 | for (j = 0; j < 3; ++j) { 39 | int k = 3 * j; 40 | temp[j] = 41 | controls[k + 0] * (b * b) + 42 | controls[k + 1] * (2 * b * a) + 43 | controls[k + 2] * (a * a); 44 | } 45 | 46 | for(j = 0; j <= L; ++j) { 47 | double a = (double)j / L; 48 | double b = 1.0 - a; 49 | 50 | vertex[i * L1 + j]= 51 | temp[0] * (b * b) + 52 | temp[1] * (2 * b * a) + 53 | temp[2] * (a * a); 54 | } 55 | } 56 | 57 | 58 | // Compute the indices 59 | int row; 60 | indexes.resize(L * (L + 1) * 2); 61 | 62 | for (row = 0; row < L; ++row) { 63 | for(int col = 0; col <= L; ++col) { 64 | indexes[(row * (L + 1) + col) * 2 + 1] = row * L1 + col; 65 | indexes[(row * (L + 1) + col) * 2] = (row + 1) * L1 + col; 66 | } 67 | } 68 | 69 | trianglesPerRow.resize(L); 70 | rowIndexes.resize(L); 71 | for (row = 0; row < L; ++row) { 72 | trianglesPerRow[row] = 2 * L1; 73 | rowIndexes[row] = indexes[row * 2 * L1]; 74 | } 75 | 76 | } 77 | void bezier::render() { 78 | 79 | } -------------------------------------------------------------------------------- /src/bezier.h: -------------------------------------------------------------------------------- 1 | #ifndef BEZIER_H 2 | #define BEZIER_H 3 | #include "q3loader.h" 4 | 5 | class bezier 6 | { 7 | private: 8 | int level; 9 | std::vector vertex; 10 | std::vector indexes; 11 | std::vector trianglesPerRow; 12 | std::vector rowIndexes; 13 | 14 | public: 15 | TVertex controls[9]; 16 | 17 | void tessellate(int level); 18 | void render(); 19 | 20 | bezier(void); 21 | ~bezier(void); 22 | }; 23 | #endif -------------------------------------------------------------------------------- /src/camera.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/src/camera.cpp -------------------------------------------------------------------------------- /src/camera.h: -------------------------------------------------------------------------------- 1 | /*******************************************************************************/ 2 | /** \file camera.h 3 | 4 | \brief The interface for CCamera - the camera system 5 | 6 | \author: Kevin Hawkins 7 | \date: 3/29/2001 8 | 9 | ********************************************************************************/ 10 | 11 | #ifndef __CAMERA_H 12 | #define __CAMERA_H 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include "vector.h" 19 | 20 | class CObject; 21 | 22 | /*******************************************************************************/ 23 | /** \class CCamera 24 | 25 | \brief The CCamera class is the camera system 26 | ********************************************************************************/ 27 | class CCamera 28 | { 29 | private: 30 | // these are used for moving and changing camera orientation 31 | // through the MoveTo/LookTo methods 32 | CVector initPosition, finalPosition; 33 | CVector initLookAt, finalLookAt; 34 | 35 | /** velocity for looking at objects */ 36 | CVector lookAtVel; 37 | 38 | /** acceleration for looking at objects */ 39 | CVector lookAtAccel; 40 | 41 | void UpdateLookAt(); 42 | void UpdateMoveTo(); 43 | 44 | public: 45 | CVector position; // position of camera 46 | 47 | CVector velocity; // velocity of camera 48 | CVector acceleration; // acceleration of camera 49 | CVector lookAt; // lookat vector 50 | 51 | // up, forward, right vectors 52 | CVector up; 53 | CVector forward; 54 | CVector right; 55 | 56 | // yaw and pitch angles 57 | float yaw; 58 | float pitch; 59 | 60 | int screenWidth, screenHeight; 61 | int centerX, centerY; 62 | CVector posicion_antigua; 63 | CCamera(); 64 | CCamera(int width, int height) {} 65 | CCamera(CVector *look); 66 | CCamera(CVector *pos, CVector *look); 67 | ~CCamera(); 68 | 69 | void LookAt(CObject *object); 70 | void LookAtNow(CObject *object); 71 | void MoveTo(CObject *object); 72 | void MoveToNow(CObject *object); 73 | void MoveToNow(scalar_t x, scalar_t y, scalar_t z); 74 | 75 | // right rotation along y-axis (yaw) 76 | void RotateYaw(scalar_t radians); 77 | void RotatePitch(scalar_t radians); 78 | void RotateRoll(scalar_t radians); 79 | 80 | /** do physics calculations */ 81 | void Animate(scalar_t deltaTime); 82 | }; 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /src/engine.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "engine.h" 4 | #include "HiResTimer.h" 5 | #include "camera.h" 6 | #include "world.h" 7 | 8 | /**********************************************************************************/ 9 | /** \file engine.cpp 10 | \brief Contains the CEngine class implementation */ 11 | 12 | 13 | /**********************************************************************************/ 14 | /** Check the input system for new events from mouse, keyboard or joysticks 15 | ***********************************************************************************/ 16 | void CEngine::CheckInput(float deltaTime) 17 | { 18 | static float buttonDelta = 0.0f; 19 | 20 | int mouseDeltaX, mouseDeltaY; // changes in the mouse position 21 | 22 | // decrease amount of time until next possible recognized button pressing 23 | buttonDelta -= deltaTime; 24 | 25 | if (buttonDelta < 0.0f) 26 | buttonDelta = 0.0f; 27 | 28 | // update devices 29 | inputSystem->Update(); 30 | 31 | // retrieve the latest mouse movements 32 | inputSystem->GetMouseMovement(mouseDeltaX, mouseDeltaY); 33 | OnMouseMove(mouseDeltaX, mouseDeltaY); 34 | 35 | if (inputSystem->KeyDown(SDLK_w)) 36 | OnKeyDown(SDLK_UP); 37 | if (inputSystem->KeyDown(SDLK_s)) 38 | OnKeyDown(SDLK_DOWN); 39 | if (inputSystem->KeyDown(SDLK_a)) 40 | OnKeyDown(SDLK_LEFT); 41 | if (inputSystem->KeyDown(SDLK_d)) 42 | OnKeyDown(SDLK_RIGHT); 43 | if (inputSystem->KeyDown(SDLK_f)) 44 | OnKeyDown(SDLK_f); 45 | if (inputSystem->KeyDown(SDLK_g)) 46 | OnKeyDown(SDLK_g); 47 | if (inputSystem->KeyDown(SDLK_PLUS)) 48 | OnKeyDown(SDLK_PLUS); 49 | if (inputSystem->KeyDown(SDLK_MINUS)) 50 | OnKeyDown(SDLK_MINUS); 51 | if (inputSystem->KeyDown(SDLK_ESCAPE)) 52 | OnKeyDown(SDLK_ESCAPE); 53 | if (inputSystem->ButtonDown(SDL_BUTTON_LEFT)) 54 | { 55 | if (buttonDelta == 0.0f) 56 | { 57 | OnMouseDownL(0,0); 58 | buttonDelta = 0.5f; 59 | } 60 | } 61 | } 62 | 63 | /**********************************************************************************/ 64 | /** The basic game cycle: perform collisions, prepare, animate and draw objects 65 | ***********************************************************************************/ 66 | void CEngine::GameCycle(float deltaTime) 67 | { 68 | CCamera *camera = OnGetCamera(); // get the camera 69 | CWorld *world = OnGetWorld(); // get the world 70 | 71 | if (useInput) 72 | CheckInput(deltaTime); 73 | 74 | // setup opengl for frame (clear, identity) 75 | OnPrepare(); 76 | 77 | // prepare objects and perform collisions 78 | world->Prepare(); 79 | 80 | // move/orient camera 81 | camera->Animate(deltaTime); 82 | 83 | // move/orient objects 84 | world->Animate(deltaTime); 85 | 86 | // draw objects 87 | world->Draw(camera); 88 | 89 | // swap buffers 90 | SwapBuffers(); 91 | } 92 | 93 | /**********************************************************************************/ 94 | /** The application message loop 95 | ***********************************************************************************/ 96 | int CEngine::EnterMessageLoop() 97 | { 98 | // Message loop 99 | SDL_Event event; 100 | timer = new CHiResTimer; 101 | 102 | timer->Init(); 103 | 104 | for (;;) 105 | { 106 | GameCycle(timer->GetElapsedSeconds(1)); 107 | //timer->LockFPS(50); 108 | while (SDL_PollEvent(&event)) 109 | { 110 | WndProcOGL(event); 111 | } 112 | } 113 | 114 | delete timer; 115 | 116 | return 0; 117 | } 118 | -------------------------------------------------------------------------------- /src/engine.h: -------------------------------------------------------------------------------- 1 | /***********************************************************************************/ 2 | /** \file engine.h 3 | 4 | \brief Contains the main engine class 5 | 6 | \author Kevin Hawkins 7 | \date 3/29/2001 8 | ************************************************************************************/ 9 | 10 | #ifndef __ENGINE_H 11 | #define __ENGINE_H 12 | 13 | #include "world.h" 14 | #include "oglwindow.h" 15 | #include "camera.h" 16 | #include "HiResTimer.h" 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | /***********************************************************************************/ 24 | /** \class CEngine 25 | \brief CEngine represents the main engine class. 26 | 27 | CEngine is the main engine class, derived from COGLWindow. 28 | It holds virtual functions GameCycle, OnPrepare, OnGetCamera, 29 | and OnGetWorld. CEngine is also the location of the main 30 | Windows message loop. 31 | ************************************************************************************/ 32 | class CEngine : public COGLWindow 33 | { 34 | protected: 35 | /** high performance timer */ 36 | CHiResTimer *timer; 37 | 38 | virtual void GameCycle(float deltaTime); 39 | 40 | /** setup OpenGL for frame */ 41 | virtual void OnPrepare() {} 42 | 43 | /** override in derived engine */ 44 | virtual CCamera *OnGetCamera() { return NULL; } 45 | virtual CWorld *OnGetWorld() { return NULL; } 46 | 47 | /** Check the input system for new events */ 48 | virtual void CheckInput(float deltaTime); 49 | 50 | void SwapBuffers() { SDL_GL_SwapBuffers(); } 51 | 52 | public: 53 | CEngine() {} 54 | CEngine(const char *szName, bool fscreen, int w, int h, int b) : 55 | COGLWindow(szName, fscreen, w, h, b) {} 56 | ~CEngine() {} 57 | int EnterMessageLoop(); 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/entity.cpp: -------------------------------------------------------------------------------- 1 | #include "entity.h" 2 | 3 | /***************************************************************/ 4 | /** \file entity.cpp 5 | \brief The CEntity implementation */ 6 | 7 | 8 | CEntity::CEntity() 9 | { 10 | interpol = 3.0f; 11 | stateStart = 0; 12 | stateEnd = 39; 13 | animSpeed = 7.0f; 14 | direction = 0.0f; 15 | entitySound = NULL; 16 | 17 | position = CVector(0,0,0); 18 | velocity = CVector(0,0,0); 19 | acceleration = CVector(0,0,0); 20 | size = 6.25f; 21 | } 22 | 23 | CEntity::~CEntity() 24 | { 25 | if (entitySound) 26 | { 27 | delete entitySound; 28 | entitySound = NULL; 29 | } 30 | } 31 | 32 | void CEntity::OnAnimate(float deltaTime) 33 | { 34 | float cosYaw = (float)cos(DEG2RAD(direction)); 35 | float sinYaw = (float)sin(DEG2RAD(direction)); 36 | 37 | float speed = velocity.z * deltaTime; 38 | 39 | if ((direction >= 360.0f) || (direction <= -360.0f)) 40 | direction = 0.0f; 41 | 42 | position.x += float(cosYaw)*speed; 43 | position.z += float(sinYaw)*speed; 44 | 45 | deltaT = deltaTime; // used for interpolation 46 | } 47 | 48 | void CEntity::OnCollision(CObject *collisionObject) 49 | { 50 | if (typeid(*collisionObject) == typeid(CEntity)) 51 | { 52 | modelState = MODEL_IDLE; 53 | velocity = CVector(0.0, 0.0, 0.0); 54 | } 55 | 56 | if (typeid(*collisionObject) == typeid(CTerrain)) 57 | { 58 | position.y = ((CTerrain*)collisionObject)->GetHeight(position.x, position.z) + size; 59 | } 60 | } 61 | 62 | void CEntity::OnDraw(CCamera *camera) 63 | { 64 | glTranslatef(position.x, position.y, position.z); 65 | glRotatef(-direction, 0.0, 1.0, 0.0); 66 | glRotatef(90.0f, -1.0f, 0.0f, 0.0f); 67 | glScalef(0.25, 0.25, 0.25); 68 | 69 | AnimateModel(stateStart, stateEnd, deltaT*animSpeed); 70 | } 71 | 72 | void CEntity::OnPrepare() 73 | { 74 | /* 75 | Frame# Action 76 | ---------------- 77 | 0-39 idle 78 | 40-46 running 79 | 47-60 getting shot but not falling (back bending) 80 | 61-66 getting shot in shoulder 81 | 67-73 jumping 82 | 74-95 idle 83 | 96-112 getting shot and falling down 84 | 113-122 idle 85 | 123-135 idle 86 | 136-154 crouch 87 | 155-161 crouch crawl 88 | 162-169 crouch adjust weapon (idle) 89 | 170-177 kneeling dying 90 | 178-185 falling back dying 91 | 186-190 falling forward dying 92 | 191-198 falling back slow dying 93 | */ 94 | srand((unsigned)time(NULL)); 95 | 96 | switch (modelState) 97 | { 98 | case MODEL_IDLE: 99 | stateStart = 0; 100 | stateEnd = 39; 101 | break; 102 | case MODEL_CROUCH: 103 | break; 104 | case MODEL_RUN: 105 | stateStart = 40; 106 | stateEnd = 46; 107 | velocity = CVector(0.0, 0.0, 15.0); 108 | break; 109 | case MODEL_JUMP: 110 | stateStart = 67; 111 | stateEnd = 73; 112 | break; 113 | case MODEL_DIE: 114 | stateStart = 178; 115 | stateEnd = 184; 116 | break; 117 | case MODEL_FIRE: 118 | stateStart = 0; 119 | stateEnd = 5; 120 | break; 121 | } 122 | 123 | // perform collision detection from this entity with all other objects in world 124 | ProcessCollisions(FindRoot()); 125 | } 126 | 127 | void CEntity::LoadAudio(CAudioSystem *audioSystem, char *filename, bool is3DSound) 128 | { 129 | if (entitySound != NULL) 130 | { 131 | delete entitySound; 132 | entitySound = new CAudio; 133 | } 134 | 135 | if (audioSystem != NULL) 136 | entitySound = audioSystem->Create(filename, is3DSound); 137 | else 138 | { 139 | delete entitySound; 140 | entitySound = NULL; 141 | } 142 | } 143 | 144 | -------------------------------------------------------------------------------- /src/entity.h: -------------------------------------------------------------------------------- 1 | /*******************************************************************************/ 2 | /** \file entity.h 3 | \brief Contains the CEntity class 4 | 5 | \author Kevin Hawkins 6 | \date 3/29/2001 7 | ********************************************************************************/ 8 | 9 | #ifndef __ENTITY_H 10 | #define __ENTITY_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "md2.h" 18 | #include "object.h" 19 | #include "camera.h" 20 | #include "audiosystem.h" 21 | #include "terrain.h" 22 | 23 | 24 | /*******************************************************************************/ 25 | /** \class CEntity 26 | \brief Provides the functionality of an entity in the game world 27 | 28 | The CEntity class is derived from CMD2Model and 29 | provides the functionality of an entity in the 30 | game world. It holds the current MD2 animation 31 | state, the entity angle heading, and the entity's 32 | primary sound. 33 | ********************************************************************************/ 34 | class CEntity : public CMD2Model 35 | { 36 | protected: 37 | void OnAnimate(float deltaTime); 38 | void OnDraw(CCamera *camera); 39 | void OnCollision(CObject *collisionObject); 40 | void OnPrepare(); 41 | 42 | void PlaySound() { audioSys->Play(entitySound, false); } 43 | public: 44 | /** angle the entity is facing (in radians) */ 45 | float direction; 46 | 47 | /** the sound the entity makes currently only supports 48 | one sound per entity */ 49 | CAudio *entitySound; 50 | 51 | /** a pointer to the audio system */ 52 | CAudioSystem *audioSys; 53 | 54 | CEntity(); 55 | ~CEntity(); 56 | 57 | int stateStart, stateEnd; // state keyframe start/end 58 | float deltaT; 59 | float animSpeed; 60 | 61 | void LoadAudio(CAudioSystem *audioSystem, char *filename, bool is3DSound); 62 | void SetAudioSystem(CAudioSystem *asys) { audioSys = asys; } 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/font.cpp: -------------------------------------------------------------------------------- 1 | #define WIN32_MEAN_AND_LEAN 2 | #define WIN32_EXTRA_LEAN 3 | 4 | /*********************************************************************/ 5 | /** \file font.cpp 6 | \brief The CFont class implementation */ 7 | 8 | #include "font.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | /*********************************************************************/ 16 | /** CFont class constructor 17 | **********************************************************************/ 18 | CFont::CFont() 19 | { 20 | screenX = 0; 21 | screenY = 0; 22 | xpos = 0.0; 23 | ypos = 0.0; 24 | zpos = 0.0; 25 | } 26 | 27 | 28 | /*********************************************************************/ 29 | /** CFont class constructor 30 | \param name Font name 31 | \param size Font size 32 | **********************************************************************/ 33 | CFont::CFont(char *name, int size) 34 | { 35 | screenX = 0; 36 | screenY = 0; 37 | xpos = 0.0; 38 | ypos = 0.0; 39 | zpos = 0.0; 40 | Build(name, size); 41 | } 42 | 43 | 44 | /*********************************************************************/ 45 | /** CFont class destructor 46 | **********************************************************************/ 47 | CFont::~CFont() 48 | { 49 | glDeleteLists(callList, 96); 50 | } 51 | 52 | 53 | /*********************************************************************/ 54 | /** Creates the font. 55 | Characters are stored in a display list 56 | **********************************************************************/ 57 | void CFont::Build(char *name, int size) 58 | { 59 | HFONT hFont; // font ID 60 | HDC hDC; // device context 61 | 62 | hDC = wglGetCurrentDC(); 63 | callList = glGenLists(96); 64 | 65 | if (stricmp(name, "symbol") == 0) 66 | { 67 | hFont = CreateFont(-size, 0,0,0,FW_BOLD, FALSE, FALSE, FALSE, SYMBOL_CHARSET, 68 | OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, 69 | FF_DONTCARE | DEFAULT_PITCH, (LPCTSTR)name); 70 | } 71 | else 72 | { 73 | hFont = CreateFont(-size, 0,0,0,FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, 74 | OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, 75 | FF_DONTCARE | DEFAULT_PITCH, (LPCTSTR)name); 76 | } 77 | 78 | SelectObject(hDC, hFont); 79 | wglUseFontBitmaps(hDC, 32, 96, callList); 80 | } 81 | 82 | 83 | /*********************************************************************/ 84 | /** Renders a string in the screen 85 | \param str Text to be displayed 86 | **********************************************************************/ 87 | void CFont::Print(const char *str, ...) 88 | { 89 | char text[256]; 90 | va_list args; 91 | 92 | if (str == NULL) 93 | return; 94 | 95 | va_start(args, str); 96 | vsprintf(text, str, args); 97 | va_end(args); 98 | 99 | glPushMatrix(); 100 | glColor4f(r, g, b, a); 101 | glLoadIdentity(); 102 | glTranslatef(0.0f, 0.0f, -1.0f); // translate one unit into the screen 103 | if (xpos == 0.0 && ypos == 0.0 && zpos == 0.0) 104 | glRasterPos2i(screenX, screenY); 105 | else 106 | glRasterPos3f(xpos, ypos, zpos); 107 | 108 | glPushAttrib(GL_LIST_BIT); 109 | glListBase(callList - 32); 110 | glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); 111 | glPopAttrib(); 112 | glPopMatrix(); 113 | } 114 | 115 | 116 | /*********************************************************************/ 117 | /** Free the display list 118 | **********************************************************************/ 119 | void CFont::ClearFont() 120 | { 121 | glDeleteLists(callList, 96); 122 | } 123 | -------------------------------------------------------------------------------- /src/font.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /** \file font.h 3 | 4 | \brief Contains the CFont class 5 | 6 | \author Kevin Hawkins 7 | \date 3/29/2001 8 | *******************************************************************************/ 9 | 10 | #ifndef __FONT_H 11 | #define __FONT_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | /******************************************************************************/ 18 | /** \class CFont 19 | \brief The CFont class. Currently only supports Bitmap fonts. 20 | *******************************************************************************/ 21 | class CFont 22 | { 23 | private: 24 | unsigned int texID; // font texture id 25 | unsigned int callList; // font display list 26 | float r, g, b, a; // RGBA 27 | int screenX, screenY; // screen coordinates 28 | float xpos, ypos, zpos; // 3d coordinates 29 | 30 | void LoadTexture(); // loads the TGA font texture 31 | void CreateCallLists(); // creates the font display list 32 | 33 | public: 34 | CFont(); 35 | CFont(char *name, int size); 36 | ~CFont(); 37 | 38 | void Build(char *name, int size); 39 | void ClearFont(); 40 | 41 | void Print(const char *str, ...); 42 | 43 | void SetPos2D(int x, int y) { screenX = x; screenY = y; } 44 | void SetPos3D(float x, float y, float z) { xpos = x; ypos = y; zpos = z; } 45 | 46 | void SetRGB(float red, float green, float blue) { r = red; g = green; b = blue; a = 1.0; } 47 | void SetRGBA(float red, float green, float blue, float alpha) { r = red; g = green; b = blue; a = alpha; } 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/nivel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/src/nivel.cpp -------------------------------------------------------------------------------- /src/nivel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/src/nivel.h -------------------------------------------------------------------------------- /src/object.cpp: -------------------------------------------------------------------------------- 1 | #include "object.h" 2 | 3 | /****************************************************************************/ 4 | /** \file object.cpp 5 | \brief The CObject class implementation */ 6 | 7 | 8 | /****************************************************************************/ 9 | /** draw object 10 | *****************************************************************************/ 11 | void CObject::Draw(CCamera *camera) 12 | { 13 | // push modelview matrix on stack 14 | glPushMatrix(); 15 | OnDraw(camera); // draw this object 16 | if (HasChild()) // draw children 17 | ((CObject*)childNode)->Draw(camera); 18 | glPopMatrix(); 19 | 20 | // draw siblings 21 | if (HasParent() && !IsLastChild()) 22 | ((CObject*)nextNode)->Draw(camera); 23 | } 24 | 25 | 26 | /****************************************************************************/ 27 | /** animate object 28 | *****************************************************************************/ 29 | void CObject::Animate(scalar_t deltaTime) 30 | { 31 | OnAnimate(deltaTime); // animate this object 32 | 33 | // animate children 34 | if (HasChild()) 35 | ((CObject*)childNode)->Animate(deltaTime); 36 | 37 | // animate siblings 38 | if (HasParent() && !IsLastChild()) 39 | ((CObject*)nextNode)->Animate(deltaTime); 40 | 41 | if (isDead) 42 | delete this; 43 | } 44 | 45 | 46 | /****************************************************************************/ 47 | /** perform collision detection 48 | *****************************************************************************/ 49 | void CObject::ProcessCollisions(CObject *obj) 50 | { 51 | // if this object's bounding sphere collides with obj's sphere 52 | // and obj is not this object 53 | if (((obj->position - position).Length() <= (obj->size + size)) && 54 | (obj != ((CObject*)this))) 55 | { 56 | OnCollision(obj); // perform this object's collision with obj 57 | 58 | // test child collisions with obj 59 | if (HasChild()) 60 | ((CObject*)childNode)->ProcessCollisions(obj); 61 | 62 | // test sibling collisions with obj 63 | if (HasParent() && !IsLastChild()) 64 | ((CObject*)nextNode)->ProcessCollisions(obj); 65 | } 66 | 67 | // if obj has children, check collisions with these children 68 | if (obj->HasChild()) 69 | ProcessCollisions((CObject*)(obj->childNode)); 70 | 71 | // if obj has siblings, check collisions with these siblings 72 | if (obj->HasParent() && !obj->IsLastChild()) 73 | ProcessCollisions((CObject*)(obj->nextNode)); 74 | } 75 | 76 | 77 | /****************************************************************************/ 78 | /** prepare object 79 | *****************************************************************************/ 80 | void CObject::Prepare() 81 | { 82 | OnPrepare(); // prepare this object 83 | 84 | if (HasChild()) // prepare children 85 | ((CObject*)childNode)->Prepare(); 86 | 87 | if (HasParent() && !IsLastChild()) // prepare siblings 88 | ((CObject*)nextNode)->Prepare(); 89 | } 90 | 91 | 92 | /****************************************************************************/ 93 | /** find root object of cyclic linked list tree 94 | *****************************************************************************/ 95 | CObject * CObject::FindRoot() 96 | { 97 | // if this object has a parent node, return the root of the parent node 98 | if (parentNode) 99 | return ((CObject*)parentNode)->FindRoot(); 100 | 101 | return this; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /src/object.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************/ 2 | /** \file object.h 3 | \brief Contains the CObject class 4 | 5 | \author Kevin Hawkins 6 | \date 3/29/2001 7 | *********************************************************************************/ 8 | 9 | #ifndef __OBJECT_H 10 | #define __OBJECT_H 11 | 12 | #include "tree.h" 13 | #include "vector.h" 14 | #include "camera.h" 15 | 16 | 17 | /********************************************************************************/ 18 | /** \class CObject 19 | \brief The CObject class is derived from CNode and 20 | represents an object in the game world. 21 | *********************************************************************************/ 22 | class CObject : public CNode 23 | { 24 | protected: 25 | /* bool bDelete; */ 26 | 27 | /** perform basic physics on the object */ 28 | virtual void OnAnimate(scalar_t deltaTime) 29 | { 30 | position += velocity * deltaTime; 31 | velocity += acceleration * deltaTime; 32 | } 33 | 34 | /** draw the object given the camera position */ 35 | virtual void OnDraw(CCamera *camera) {} 36 | 37 | /** collide with other objects */ 38 | virtual void OnCollision(CObject *collisionObject) {} 39 | 40 | /** perform collision and other preparations for this object */ 41 | virtual void OnPrepare() 42 | { 43 | ProcessCollisions(FindRoot()); // perform collisions starting with 44 | // root world object 45 | } 46 | 47 | public: 48 | CVector position; // object position 49 | CVector velocity; // velocity of object 50 | CVector acceleration; // acceleration 51 | scalar_t size; // size of bounding sphere (radius) 52 | 53 | bool isDead; 54 | 55 | CObject() { isDead = false; } 56 | ~CObject() {} 57 | 58 | virtual void Load() {} 59 | virtual void Unload() {} 60 | 61 | // draw object 62 | void Draw(CCamera *camera); 63 | 64 | // animate object 65 | void Animate(scalar_t deltaTime); 66 | 67 | // perform collision detection 68 | void ProcessCollisions(CObject *obj); 69 | 70 | // prepare object 71 | void Prepare(); 72 | 73 | // find root object of cyclic linked list tree 74 | CObject *FindRoot(); 75 | }; 76 | 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/oglwindow.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /** \file oglwindow.h 3 | \brief Contains the COGLWindow class 4 | 5 | \author José María Arnau 6 | \date 11/09/2006 7 | ****************************************************************************/ 8 | 9 | #ifndef __OGLWINDOW_H__ 10 | #define __OGLWINDOW_H__ 11 | 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "InputSystem.h" 19 | 20 | 21 | /***************************************************************************/ 22 | /** \class COGLWindow 23 | \brief The COGLWindow class handles system messages and 24 | distributes the messages among the engine. 25 | ****************************************************************************/ 26 | class COGLWindow 27 | { 28 | protected: 29 | SDL_Surface *screen; 30 | int flags; 31 | 32 | virtual bool OnCreate() { return true; } 33 | virtual bool OnClose() { return true; } 34 | virtual void OnSize() { } 35 | virtual void OnMouseDownL(float x, float y) { } 36 | virtual void OnMouseDownR(float x, float y) { } 37 | virtual void OnMouseUpL() { } 38 | virtual void OnMouseUpR() { } 39 | virtual void OnMouseMove(int x, int y, int centerX, int centerY) { } 40 | virtual void OnMouseMove(int deltaX, int deltaY) { } 41 | virtual void OnMouseDragL(int x, int y, int dx, int dy) { } 42 | virtual void OnMouseDragR(int x, int y, int dx, int dy) { } 43 | virtual void OnKeyUp(SDLKey nVirtKey) { } 44 | virtual void OnKeyDown(SDLKey nVirtKey) { } 45 | virtual void OnChar(char c) { } 46 | 47 | int WndProcOGL(SDL_Event event); 48 | 49 | private: 50 | // message handling functions 51 | void Destroy(); 52 | void Size(); 53 | void MouseMove(int x, int y); 54 | 55 | float GetNormalizedPosX(int x); // get normalized mouse coordinates 56 | float GetNormalizedPosY(int y); // between (-1.0 and 1.0) 57 | 58 | 59 | public: 60 | int width; 61 | int height; 62 | int centerX; 63 | int centerY; 64 | int bits; 65 | int aspect; 66 | int mouseX; 67 | int mouseY; 68 | bool fullscreen; 69 | 70 | float mouseSensitivity; 71 | 72 | bool useInput; 73 | CInputSystem *inputSystem; 74 | 75 | COGLWindow() {} 76 | COGLWindow(const char *szName, bool fscreen, int w, int h, int b); 77 | virtual ~COGLWindow(); 78 | 79 | void BeginFullScreen(int w, int h, int b); 80 | void EndFullScreen(); 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/simpengine.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************/ 2 | /** \file simpengine.h 3 | \brief Contains the SimpEngine class 4 | 5 | \author Kevin Hawkins 6 | \date 3/29/2001 7 | ***************************************************************************************/ 8 | 9 | #ifndef __SIMPENGINE 10 | #define __SIMPENGINE 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "engine.h" 18 | #include "object.h" 19 | #include "camera.h" 20 | #include "terrain.h" 21 | #include "world.h" 22 | #include "font.h" 23 | #include 24 | using namespace std; 25 | 26 | 27 | /**************************************************************************************/ 28 | /** \class CSimpEngine 29 | \brief The SimpEngine class is the main interface for SimpEngine. 30 | Derived from CEngine, tt provides the camera and world objects. 31 | ***************************************************************************************/ 32 | class CSimpEngine : public CEngine 33 | { 34 | private: 35 | CCamera *gameCamera; 36 | CWorld *gameWorld; 37 | 38 | protected: 39 | CCamera *OnGetCamera() { return gameCamera; } 40 | CWorld *OnGetWorld() { return gameWorld; } 41 | 42 | void OnPrepare(); 43 | void OnMouseDownL(float x, float y); 44 | void OnMouseMove(int deltaX, int deltaY); 45 | void OnMouseMove(int x, int y, int centerX, int centerY); 46 | void OnKeyDown(SDLKey nVirtKey); 47 | 48 | public: 49 | CSimpEngine() 50 | { 51 | gameCamera = new CCamera; 52 | gameWorld = new CWorld; 53 | } 54 | 55 | CSimpEngine(const char *szName, bool fscreen, int w, int h, int b); 56 | 57 | ~CSimpEngine() 58 | { 59 | delete gameWorld; 60 | delete gameCamera; 61 | gameWorld = NULL; 62 | gameCamera = NULL; 63 | } 64 | }; 65 | 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/terrain.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************/ 2 | /** \file terrain.h 3 | \brief The CTerrain class interface 4 | 5 | \author Kevin Hawkins 6 | \date 3/29/2001 7 | **********************************************************************************/ 8 | 9 | #ifndef __TERRAIN_H 10 | #define __TERRAIN_H 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "camera.h" 17 | #include "object.h" 18 | #include "texture.h" 19 | #include "vector.h" 20 | #include "font.h" 21 | 22 | /*********************************************************************************/ 23 | /** \class CTerrain 24 | \brief The CTerrain class is derived from CObject, and represents 25 | the main world. Randomly generated terrain and frustrum clipping 26 | are provided. 27 | 28 | The random terrain is created with the midpoint 29 | displacement algorithm. 30 | 31 | Random terrain generation Copyright (C) Jason Shankel, 2000 32 | **********************************************************************************/ 33 | class CTerrain : public CObject 34 | { 35 | private: 36 | int width; // terrain is of size width X width 37 | // preferrably with 2^n = width 38 | float widthScale; // scale of terrain width 39 | float terrainMul; 40 | float heightMul; 41 | float scanDepth; 42 | float textureMul; 43 | CFont *msg; 44 | float RangedRandom(float v1,float v2); 45 | void NormalizeTerrain(float field[],int size); 46 | void FilterHeightBand(float *band,int stride,int count,float filter); 47 | void FilterHeightField(float field[],int size,float filter); 48 | void MakeTerrainPlasma(float field[],int size,float rough); 49 | 50 | protected: 51 | // terrain doesn't move, so no physics animations 52 | void OnAnimate(scalar_t deltaTime) {} 53 | 54 | void OnDraw(CCamera *camera); 55 | void OnCollision(CObject *collisionObject); 56 | 57 | public: 58 | float *heightMap; // dynamic heightmap 59 | CTexture terrainTex[5]; // for multiple textures on the terrain 60 | float fogColor[4]; // color of the fog/sky 61 | 62 | CTerrain(); 63 | CTerrain(int width, float rFactor); 64 | ~CTerrain() { delete [] heightMap; } 65 | 66 | void Load() {} 67 | void Unload() {} 68 | 69 | void BuildTerrain(int width, float rFactor); 70 | 71 | int GetWidth() { return width; } 72 | float GetMul() { return terrainMul; } 73 | float GetScanDepth() { return scanDepth; } 74 | 75 | float GetHeight(float x, float z) 76 | { 77 | float projCameraX, projCameraZ; 78 | 79 | // divide by the grid-spacing if it is not 1 80 | projCameraX = x / terrainMul; 81 | projCameraZ = z / terrainMul; 82 | 83 | // compute the height field coordinates (Col0, Row0) 84 | // and (Col1, Row1) that identify the height field cell 85 | // directly below the camera. 86 | int col0 = int(projCameraX); 87 | int row0 = int(projCameraZ); 88 | int col1 = col0 + 1; 89 | int row1 = row0 + 1; 90 | 91 | // make sure that the cell coordinates don't fall 92 | // outside the height field. 93 | if (col1 > width) 94 | col1 = 0; 95 | if (row1 > width) 96 | row1 = 0; 97 | 98 | // get the four corner heights of the cell from the height field 99 | float h00 = heightMul * (float)heightMap[col0 + row0*width]; 100 | float h01 = heightMul * (float)heightMap[col1 + row0*width]; 101 | float h11 = heightMul * (float)heightMap[col1 + row1*width]; 102 | float h10 = heightMul * (float)heightMap[col0 + row1*width]; 103 | 104 | // calculate the position of the camera relative to the cell. 105 | // note, that 0 <= tx, ty <= 1. 106 | float tx = projCameraX - float(col0); 107 | float ty = projCameraZ - float(row0); 108 | 109 | // the next step is to perform a bilinear interpolation 110 | // to compute the height of the terrain directly below 111 | // the object. 112 | float txty = tx * ty; 113 | 114 | float final_height = h00 * (1.0f - ty - tx + txty) 115 | + h01 * (tx - txty) 116 | + h11 * txty 117 | + h10 * (ty - txty); 118 | 119 | return final_height; 120 | } 121 | }; 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /src/texture.cpp: -------------------------------------------------------------------------------- 1 | #include "texture.h" 2 | #include 3 | using namespace std; 4 | 5 | /****************************************************************************/ 6 | /** \file texture.cpp 7 | \brief The CTexture class implementation */ 8 | 9 | 10 | /****************************************************************************/ 11 | // LoadTexture() 12 | /** Loads a texture given the filename. 13 | The engine can load BMP, PNM (PPM/PGM/PBM), XPM, LBM, PCX, GIF, JPEG, 14 | PNG, TGA, and TIFF formats. 15 | *****************************************************************************/ 16 | void CTexture::LoadTexture(char *filename) 17 | { 18 | image = IMG_Load(filename); 19 | if (!image) { 20 | cerr << "Error al cargar la textura" << endl; 21 | } 22 | 23 | width = image->w; 24 | height = image->h; 25 | bitDepth = image->format->BitsPerPixel; 26 | 27 | data = new GLubyte[width * height * (bitDepth/8)]; 28 | 29 | int pos = 0; 30 | for (int y = 0; y < height; y++) { 31 | for (int x = 0; x < width; x++) { 32 | Uint8 r, g, b ,a; 33 | 34 | Uint32 color = getpixel(image, x, y); 35 | 36 | if (bitDepth == 24) { 37 | SDL_GetRGB(color, image->format, &r, &g, &b); 38 | } 39 | else { 40 | SDL_GetRGBA(color, image->format, &r, &g, &b, &a); 41 | } 42 | 43 | data[pos] = r; pos++; 44 | data[pos] = g; pos++; 45 | data[pos] = b; pos++; 46 | if (bitDepth == 32) { 47 | data[pos] = a; 48 | pos ++; 49 | } 50 | } 51 | } 52 | } 53 | 54 | 55 | /****************************************************************************/ 56 | /** \return the pixel value at (x, y) 57 | *****************************************************************************/ 58 | Uint32 CTexture::getpixel(SDL_Surface *surface, int x, int y) 59 | { 60 | int bpp = surface->format->BytesPerPixel; 61 | /* Here p is the address to the pixel we want to retrieve */ 62 | Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; 63 | 64 | switch(bpp) { 65 | case 1: 66 | return *p; 67 | 68 | case 2: 69 | return *(Uint16 *)p; 70 | 71 | case 3: 72 | if(SDL_BYTEORDER == SDL_BIG_ENDIAN) 73 | return p[0] << 16 | p[1] << 8 | p[2]; 74 | else 75 | return p[0] | p[1] << 8 | p[2] << 16; 76 | 77 | case 4: 78 | return *(Uint32 *)p; 79 | 80 | default: 81 | return 0; /* shouldn't happen, but avoids warnings */ 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/texture.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /** \file texture.h 3 | \brief Contains the CTexture class 4 | 5 | \author José María Arnau 6 | \date 11/09/2006 7 | *******************************************************************************/ 8 | 9 | #ifndef __TEXTURE_H 10 | #define __TEXTURE_H 11 | 12 | #define WIN32_MEAN_AND_LEAN 13 | #define WIN32_EXTRA_LEAN 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | /******************************************************************************/ 25 | /** \class CTexture 26 | \brief The CTexture class represents a single texture 27 | object in the engine. To load a texture, 28 | you only need to call the LoadTexture() function. 29 | *******************************************************************************/ 30 | class CTexture 31 | { 32 | public: 33 | int width; 34 | int height; 35 | int bitDepth; 36 | unsigned int texID; 37 | 38 | SDL_Surface *image; 39 | GLubyte *data; 40 | 41 | CTexture() { data = NULL; image = NULL; } 42 | ~CTexture() { Unload(); } 43 | 44 | Uint32 getpixel(SDL_Surface *surface, int x, int y); 45 | void LoadTexture(char *filename); 46 | 47 | void Unload() 48 | { 49 | glDeleteTextures(1, &texID); 50 | 51 | if (image) 52 | SDL_FreeSurface(image); 53 | 54 | if (data) 55 | delete data; 56 | 57 | image = NULL; 58 | data = NULL; 59 | } 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/tree.cpp: -------------------------------------------------------------------------------- 1 | #include "tree.h" 2 | 3 | /***************************************************************************/ 4 | /** \file tree.cpp 5 | \brief The CNode class implementation */ 6 | 7 | 8 | /***************************************************************************/ 9 | /** is this node the first child? 10 | ****************************************************************************/ 11 | bool CNode::IsFirstChild() 12 | { 13 | if (parentNode) 14 | return (parentNode->childNode == this); 15 | else 16 | return false; 17 | } 18 | 19 | 20 | /***************************************************************************/ 21 | /** is this node the last child? 22 | ****************************************************************************/ 23 | bool CNode::IsLastChild() 24 | { 25 | if (parentNode) 26 | return (parentNode->childNode->prevNode == this); 27 | else 28 | return false; 29 | } 30 | 31 | 32 | /***************************************************************************/ 33 | /** attach this node to a parent node 34 | ****************************************************************************/ 35 | void CNode::AttachTo(CNode *newParent) 36 | { 37 | // if this node is already attached to another node, then detach 38 | if (parentNode) 39 | Detach(); 40 | 41 | parentNode = newParent; 42 | 43 | if (parentNode->childNode) 44 | { 45 | prevNode = parentNode->childNode->prevNode; 46 | nextNode = parentNode->childNode; 47 | parentNode->childNode->prevNode->nextNode = this; 48 | parentNode->childNode->prevNode = this; 49 | } 50 | else 51 | { 52 | parentNode->childNode = this; // this is the first child 53 | } 54 | } 55 | 56 | 57 | /***************************************************************************/ 58 | /** attach a child to this node 59 | ****************************************************************************/ 60 | void CNode::Attach(CNode *newChild) 61 | { 62 | // if the child node is already attached, then detach it 63 | if (newChild->HasParent()) 64 | newChild->Detach(); 65 | 66 | newChild->parentNode = this; 67 | 68 | if (childNode) 69 | { 70 | newChild->prevNode = childNode->prevNode; 71 | newChild->nextNode = childNode; 72 | childNode->prevNode->nextNode = newChild; 73 | childNode->prevNode = newChild; 74 | } 75 | else 76 | childNode = newChild; 77 | } 78 | 79 | 80 | /***************************************************************************/ 81 | /** detach node from parent 82 | ****************************************************************************/ 83 | void CNode::Detach() 84 | { 85 | // if this node is the first child of the parent (first in list) 86 | // then the parent points to the next child in the list 87 | if (parentNode && parentNode->childNode == this) 88 | { 89 | if (nextNode != this) 90 | parentNode->childNode = nextNode; 91 | else 92 | parentNode->childNode = NULL; // no next child 93 | } 94 | 95 | // get rid of links 96 | prevNode->nextNode = nextNode; 97 | nextNode->prevNode = prevNode; 98 | 99 | // now this node is not in the list 100 | prevNode = this; 101 | nextNode = this; 102 | } 103 | 104 | 105 | /***************************************************************************/ 106 | /** count the number of nodes 107 | ****************************************************************************/ 108 | int CNode::CountNodes() 109 | { 110 | if (childNode) 111 | return childNode->CountNodes() + 1; 112 | else 113 | return 1; 114 | } 115 | 116 | 117 | /***************************************************************************/ 118 | /** constructor 119 | ****************************************************************************/ 120 | CNode::CNode() // setup node 121 | { 122 | parentNode = childNode = NULL; 123 | prevNode = nextNode = this; 124 | } 125 | 126 | 127 | /***************************************************************************/ 128 | /** constructor 129 | ****************************************************************************/ 130 | CNode::CNode(CNode *node) 131 | { 132 | parentNode = childNode = NULL; // setup and attach this node to node 133 | prevNode = nextNode = this; 134 | AttachTo(node); 135 | } 136 | 137 | 138 | /***************************************************************************/ 139 | /** destructor 140 | ****************************************************************************/ 141 | CNode::~CNode() 142 | { 143 | Detach(); // detach from hierarchy 144 | 145 | while (childNode) // delete all children 146 | { 147 | delete childNode; 148 | } 149 | } 150 | 151 | -------------------------------------------------------------------------------- /src/tree.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /** \file tree.h 3 | \brief The CNode class 4 | 5 | \author Kevin Hawkins 6 | \date 3/29/2001 7 | ***************************************************************************/ 8 | 9 | #ifndef __TREE_H 10 | #define __TREE_H 11 | 12 | #ifndef NULL 13 | #define NULL 0L 14 | #endif 15 | 16 | 17 | /**************************************************************************/ 18 | /** \class CNode 19 | \brief The CNode class represents a single node in the 20 | cyclic linked list tree that holds all objects 21 | in the game. 22 | ***************************************************************************/ 23 | class CNode 24 | { 25 | public: 26 | // data 27 | CNode *parentNode; // parent node 28 | CNode *childNode; // child node 29 | CNode *prevNode; // previous node 30 | CNode *nextNode; // next node 31 | 32 | 33 | bool HasParent() { return (parentNode != NULL); } // does node have a parent? 34 | bool HasChild() { return (childNode != NULL); } // does node have a child? 35 | 36 | // is this node the first child? 37 | bool IsFirstChild(); 38 | 39 | // is this node the last child? 40 | bool IsLastChild(); 41 | 42 | // attach this node to a parent node 43 | void AttachTo(CNode *newParent); 44 | 45 | // attach a child to this node 46 | void Attach(CNode *newChild); 47 | 48 | // detach node from parent 49 | void Detach(); 50 | 51 | // count the number of nodes 52 | int CountNodes(); 53 | 54 | // constructor 55 | CNode(); // setup node 56 | 57 | // constructor 58 | CNode(CNode *node); 59 | 60 | // destructor 61 | virtual ~CNode(); 62 | }; 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/vector.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /** \file vector.h 3 | \brief Contains the CVector class 4 | 5 | \author Kevin Hawkins 6 | *****************************************************************************/ 7 | 8 | #ifndef __VECTOR_H 9 | #define __VECTOR_H 10 | 11 | #include 12 | 13 | 14 | #define PI (3.14159265359f) 15 | #define DEG2RAD(a) (PI/180*(a)) 16 | #define RAD2DEG(a) (180/PI*(a)) 17 | 18 | typedef float scalar_t; 19 | 20 | /****************************************************************************/ 21 | /** \class CVector 22 | \brief This class represents a vector. 23 | 24 | Some operators of the CVector class based on 25 | operators of the CVector class by Bas Kuenen. 26 | Copyright (c) 2000 Bas Kuenen. All Rights Reserved. 27 | homepage: baskuenen.cfxweb.net 28 | *****************************************************************************/ 29 | class CVector 30 | { 31 | public: 32 | 33 | union 34 | { 35 | struct 36 | { 37 | scalar_t x; 38 | scalar_t y; 39 | scalar_t z; // x,y,z coordinates 40 | }; 41 | scalar_t v[3]; 42 | }; 43 | 44 | CVector(scalar_t a = 0, scalar_t b = 0, scalar_t c = 0) : x(a), y(b), z(c) {} 45 | CVector(const CVector &vec) : x(vec.x), y(vec.y), z(vec.z) {} 46 | 47 | // vector index 48 | scalar_t &operator[](const long idx); 49 | 50 | // vector assignment 51 | const CVector &operator=(const CVector &vec); 52 | 53 | // vecector equality 54 | const bool operator==(const CVector &vec) const; 55 | 56 | // vecector inequality 57 | const bool operator!=(const CVector &vec) const; 58 | 59 | // vector add 60 | const CVector operator+(const CVector &vec) const; 61 | 62 | // vector add (opposite of negation) 63 | const CVector operator+() const; 64 | 65 | // vector increment 66 | const CVector& operator+=(const CVector& vec); 67 | 68 | // vector subtraction 69 | const CVector operator-(const CVector& vec) const; 70 | 71 | // vector negation 72 | const CVector operator-() const; 73 | 74 | // vector decrement 75 | const CVector &operator-=(const CVector& vec); 76 | 77 | // scalar self-multiply 78 | const CVector &operator*=(const scalar_t &s); 79 | 80 | // scalar self-divecide 81 | const CVector &operator/=(const scalar_t &s); 82 | 83 | // post multiply by scalar 84 | const CVector operator*(const scalar_t &s) const; 85 | 86 | // pre multiply by scalar 87 | friend inline const CVector operator*(const scalar_t &s, const CVector &vec); 88 | 89 | const CVector operator*(const CVector& vec) const; 90 | 91 | // divide by scalar 92 | const CVector operator/(scalar_t s) const; 93 | 94 | // cross product 95 | const CVector CrossProduct(const CVector &vec) const; 96 | 97 | // cross product 98 | const CVector operator^(const CVector &vec) const; 99 | 100 | // dot product 101 | const scalar_t DotProduct(const CVector &vec) const; 102 | 103 | // dot product 104 | const scalar_t operator%(const CVector &vec) const; 105 | 106 | // length of vector 107 | const scalar_t Length() const; 108 | 109 | // return the unit vector 110 | const CVector UnitVector() const; 111 | 112 | // normalize this vector 113 | void Normalize(); 114 | 115 | const scalar_t operator!() const; 116 | 117 | // return vector with specified length 118 | const CVector operator | (const scalar_t length) const; 119 | 120 | // set length of vector equal to length 121 | const CVector& operator |= (const float length); 122 | 123 | /** \return angle between two vectors */ 124 | inline const float Angle(const CVector& normal) const 125 | { 126 | return acosf(*this % normal); 127 | } 128 | 129 | /** reflect this vector off surface with normal vector */ 130 | inline const CVector Reflection(const CVector& normal) const 131 | { 132 | const CVector vec(*this | 1); // normalize this vector 133 | return (vec - normal * 2.0 * (vec % normal)) * !*this; 134 | } 135 | 136 | /** rotate angle degrees about a normal */ 137 | inline const CVector Rotate(const float angle, const CVector& normal) const 138 | { 139 | const float cosine = cosf(angle); 140 | const float sine = sinf(angle); 141 | 142 | return CVector(*this * cosine + ((normal * *this) * (1.0f - cosine)) * normal + (*this ^ normal) * sine); 143 | } 144 | 145 | }; 146 | 147 | #endif 148 | -------------------------------------------------------------------------------- /src/winmain.cpp: -------------------------------------------------------------------------------- 1 | #define WIN32_MEAN_AND_LEAN 2 | #define WIN32_EXTRA_LEAN 3 | 4 | /* 5 | WINMAIN.CPP 6 | 7 | Contains WinMain, the main windows function 8 | 9 | Author: Kevin Hawkins 10 | Date: 3/19/2001 11 | Description: 12 | 13 | */ 14 | 15 | 16 | #include 17 | 18 | #include "oglwindow.h" // the OpenGL window class 19 | #include "vector.h" 20 | #include "engine.h" // the engine's main class 21 | #include "simpengine.h" 22 | 23 | 24 | int WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int nCmdShow) 25 | { 26 | int loopRet; 27 | bool fscreen; 28 | CSimpEngine *engine = NULL; 29 | 30 | try 31 | { 32 | fscreen = (MessageBox(NULL, "Deseas ejecutarlo en modo a pantalla completa?", "Fullscreen?", MB_YESNO) == IDYES); 33 | 34 | engine = new CSimpEngine("OpenGL Game", fscreen, 800, 600, 32); 35 | 36 | loopRet = engine->EnterMessageLoop(); 37 | 38 | delete engine; 39 | 40 | return loopRet; 41 | } 42 | catch(char *sz) 43 | { 44 | MessageBox(NULL, sz, 0, 0); 45 | delete engine; 46 | } 47 | 48 | return -1; 49 | } -------------------------------------------------------------------------------- /src/world.h: -------------------------------------------------------------------------------- 1 | /***********************************************************************/ 2 | /** \file world.h 3 | \brief The CWorld class 4 | 5 | \author Kevin Hawkins 6 | \date 3/29/2001 7 | Description: 8 | ************************************************************************/ 9 | 10 | #ifndef __WORLD_H 11 | #define __WORLD_H 12 | 13 | #include "entity.h" 14 | #include "md2.h" 15 | #include "object.h" 16 | #include "camera.h" 17 | #include "terrain.h" 18 | #include "audiosystem.h" 19 | #include "tree.h" 20 | #include "q3loader.h" 21 | #include "nivel.h" 22 | #include "HiResTimer.h" 23 | /***********************************************************************/ 24 | /** \class CWorld 25 | \brief The CWorld class represents the game world 26 | of the engine. All objects, the terrain, 27 | audio system, ambient world music and sound, 28 | and the camera are held here. 29 | ************************************************************************/ 30 | class CWorld 31 | { 32 | protected: 33 | void OnAnimate(float deltaTime); 34 | void OnDraw(CCamera *camera); 35 | void OnPrepare(); 36 | 37 | public: 38 | 39 | CTerrain *terrain; // the terrain 40 | CCamera *camera; // the camera 41 | CEntity *enemy; // enemy 1 42 | CEntity *enemy2; // enemy 2 43 | CEntity *enemy3; // enemy 2 44 | CAudioSystem *audioSystem; // the audio system 45 | CAudio *worldSound; // the world ambient sound 46 | CAudio *gameMusic; // the game's music 47 | 48 | CNivel *nivel; 49 | CFont *msg; 50 | CFont *frames_por_segundo; 51 | CHiResTimer * temporizador; 52 | CWorld(); 53 | CWorld(CCamera *c); 54 | ~CWorld(); 55 | 56 | // initialize terrain, load objects and put in container 57 | void LoadWorld(); 58 | void UnloadWorld(); 59 | 60 | // do physics calculations for all objects in the world 61 | // including collisions 62 | void Animate(float deltaTime); 63 | 64 | // render all objects in the world 65 | void Draw(CCamera *camera); 66 | 67 | void Prepare() { OnPrepare(); } 68 | }; 69 | 70 | 71 | #endif -------------------------------------------------------------------------------- /textures/Sky.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/Sky.tga -------------------------------------------------------------------------------- /textures/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/Thumbs.db -------------------------------------------------------------------------------- /textures/egyptians/ankhlite_wht.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/ankhlite_wht.jpg -------------------------------------------------------------------------------- /textures/egyptians/ankhlite_ylw.blend.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/ankhlite_ylw.blend.jpg -------------------------------------------------------------------------------- /textures/egyptians/ankhlite_ylw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/ankhlite_ylw.jpg -------------------------------------------------------------------------------- /textures/egyptians/bounce_effects.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/bounce_effects.jpg -------------------------------------------------------------------------------- /textures/egyptians/gold_groove.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/gold_groove.jpg -------------------------------------------------------------------------------- /textures/egyptians/gold_trim01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/gold_trim01.jpg -------------------------------------------------------------------------------- /textures/egyptians/gold_trim02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/gold_trim02.jpg -------------------------------------------------------------------------------- /textures/egyptians/gold_trim03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/gold_trim03.jpg -------------------------------------------------------------------------------- /textures/egyptians/heiro_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/heiro_01.jpg -------------------------------------------------------------------------------- /textures/egyptians/leaf.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/leaf.tga -------------------------------------------------------------------------------- /textures/egyptians/oldbrk_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldbrk_01.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldbrk_01broken13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldbrk_01broken13.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldbrk_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldbrk_03.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldbrk_03_bloody.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldbrk_03_bloody.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_bas01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_bas01.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_bas03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_bas03.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_bas04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_bas04.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_bas05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_bas05.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_bas06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_bas06.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_bas07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_bas07.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_step.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_step.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_trim01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_trim01.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2_trim02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2_trim02.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone2grooved.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone2grooved.jpg -------------------------------------------------------------------------------- /textures/egyptians/oldstone_ramses.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/oldstone_ramses.jpg -------------------------------------------------------------------------------- /textures/egyptians/plant_egy.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/plant_egy.tga -------------------------------------------------------------------------------- /textures/egyptians/sand_egy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/sand_egy.jpg -------------------------------------------------------------------------------- /textures/egyptians/stei_tele2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/egyptians/stei_tele2.jpg -------------------------------------------------------------------------------- /textures/ground.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexkid77/3dEngineOpenGL/d00283055a8762d6b04d81a0a9dafa584ad0ea90/textures/ground.tga --------------------------------------------------------------------------------