├── resources ├── fonts │ └── dummy.txt ├── icons │ ├── atlas_stats.png │ ├── atlas_capture.png │ ├── atlas_keyboard.png │ ├── dashboard_icon.png │ └── LICENSES.md ├── settings.xml └── shaders │ └── frag_color_swap.glsl ├── .github └── FUNDING.yml ├── stdafx.cpp ├── icon.ico ├── resource.h ├── openvr_widgets.rc ├── vendor ├── sfml │ ├── lib │ │ ├── win32 │ │ │ ├── flac.lib │ │ │ ├── ogg.lib │ │ │ ├── vorbis.lib │ │ │ ├── freetype.lib │ │ │ ├── openal32.lib │ │ │ ├── sfml-audio.lib │ │ │ ├── sfml-main.lib │ │ │ ├── vorbisenc.lib │ │ │ ├── vorbisfile.lib │ │ │ ├── sfml-audio-d.lib │ │ │ ├── sfml-audio-d.pdb │ │ │ ├── sfml-audio-s.lib │ │ │ ├── sfml-main-d.lib │ │ │ ├── sfml-network.lib │ │ │ ├── sfml-system.lib │ │ │ ├── sfml-window.lib │ │ │ ├── sfml-audio-s-d.lib │ │ │ ├── sfml-audio-s-d.pdb │ │ │ ├── sfml-graphics-d.lib │ │ │ ├── sfml-graphics-d.pdb │ │ │ ├── sfml-graphics-s.lib │ │ │ ├── sfml-graphics.lib │ │ │ ├── sfml-main-s-d.pdb │ │ │ ├── sfml-network-d.lib │ │ │ ├── sfml-network-d.pdb │ │ │ ├── sfml-network-s.lib │ │ │ ├── sfml-system-d.lib │ │ │ ├── sfml-system-d.pdb │ │ │ ├── sfml-system-s-d.lib │ │ │ ├── sfml-system-s-d.pdb │ │ │ ├── sfml-system-s.lib │ │ │ ├── sfml-window-d.lib │ │ │ ├── sfml-window-d.pdb │ │ │ ├── sfml-window-s-d.lib │ │ │ ├── sfml-window-s-d.pdb │ │ │ ├── sfml-window-s.lib │ │ │ ├── sfml-graphics-s-d.lib │ │ │ ├── sfml-graphics-s-d.pdb │ │ │ ├── sfml-network-s-d.lib │ │ │ └── sfml-network-s-d.pdb │ │ ├── win64 │ │ │ ├── flac.lib │ │ │ ├── ogg.lib │ │ │ ├── vorbis.lib │ │ │ ├── freetype.lib │ │ │ ├── openal32.lib │ │ │ ├── sfml-audio.lib │ │ │ ├── sfml-main.lib │ │ │ ├── vorbisenc.lib │ │ │ ├── vorbisfile.lib │ │ │ ├── sfml-audio-d.lib │ │ │ ├── sfml-audio-d.pdb │ │ │ ├── sfml-audio-s.lib │ │ │ ├── sfml-main-d.lib │ │ │ ├── sfml-network.lib │ │ │ ├── sfml-system.lib │ │ │ ├── sfml-window.lib │ │ │ ├── sfml-audio-s-d.lib │ │ │ ├── sfml-audio-s-d.pdb │ │ │ ├── sfml-graphics-d.lib │ │ │ ├── sfml-graphics-d.pdb │ │ │ ├── sfml-graphics-s.lib │ │ │ ├── sfml-graphics.lib │ │ │ ├── sfml-main-s-d.pdb │ │ │ ├── sfml-network-d.lib │ │ │ ├── sfml-network-d.pdb │ │ │ ├── sfml-network-s.lib │ │ │ ├── sfml-system-d.lib │ │ │ ├── sfml-system-d.pdb │ │ │ ├── sfml-system-s-d.lib │ │ │ ├── sfml-system-s-d.pdb │ │ │ ├── sfml-system-s.lib │ │ │ ├── sfml-window-d.lib │ │ │ ├── sfml-window-d.pdb │ │ │ ├── sfml-window-s-d.lib │ │ │ ├── sfml-window-s-d.pdb │ │ │ ├── sfml-window-s.lib │ │ │ ├── sfml-graphics-s-d.lib │ │ │ ├── sfml-graphics-s-d.pdb │ │ │ ├── sfml-network-s-d.lib │ │ │ └── sfml-network-s-d.pdb │ │ └── linux64 │ │ │ ├── libsfml-system-s.a │ │ │ ├── libsfml-window-s.a │ │ │ └── libsfml-graphics-s.a │ ├── bin │ │ ├── win32 │ │ │ ├── openal32.dll │ │ │ ├── sfml-audio-2.dll │ │ │ ├── sfml-audio-d-2.dll │ │ │ ├── sfml-graphics-2.dll │ │ │ ├── sfml-network-2.dll │ │ │ ├── sfml-system-2.dll │ │ │ ├── sfml-system-d-2.dll │ │ │ ├── sfml-window-2.dll │ │ │ ├── sfml-window-d-2.dll │ │ │ ├── sfml-graphics-d-2.dll │ │ │ └── sfml-network-d-2.dll │ │ └── win64 │ │ │ ├── openal32.dll │ │ │ ├── sfml-audio-2.dll │ │ │ ├── sfml-audio-d-2.dll │ │ │ ├── sfml-graphics-2.dll │ │ │ ├── sfml-network-2.dll │ │ │ ├── sfml-system-2.dll │ │ │ ├── sfml-system-d-2.dll │ │ │ ├── sfml-window-2.dll │ │ │ ├── sfml-window-d-2.dll │ │ │ ├── sfml-graphics-d-2.dll │ │ │ └── sfml-network-d-2.dll │ ├── license.md │ ├── include │ │ └── SFML │ │ │ ├── Main.hpp │ │ │ ├── Audio │ │ │ ├── Export.hpp │ │ │ ├── AlResource.hpp │ │ │ ├── SoundFileFactory.inl │ │ │ ├── SoundFileWriter.hpp │ │ │ └── OutputSoundFile.hpp │ │ │ ├── System │ │ │ ├── Export.hpp │ │ │ ├── String.inl │ │ │ ├── Sleep.hpp │ │ │ ├── NativeActivity.hpp │ │ │ ├── ThreadLocalPtr.inl │ │ │ ├── Err.hpp │ │ │ ├── Thread.inl │ │ │ ├── ThreadLocal.hpp │ │ │ ├── Clock.hpp │ │ │ ├── Lock.hpp │ │ │ ├── Vector2.inl │ │ │ └── Vector3.inl │ │ │ ├── Window │ │ │ ├── Export.hpp │ │ │ ├── WindowStyle.hpp │ │ │ ├── WindowHandle.hpp │ │ │ ├── GlResource.hpp │ │ │ └── Clipboard.hpp │ │ │ ├── Network │ │ │ ├── Export.hpp │ │ │ └── SocketHandle.hpp │ │ │ ├── Graphics │ │ │ ├── Export.hpp │ │ │ ├── PrimitiveType.hpp │ │ │ ├── Glyph.hpp │ │ │ ├── Drawable.hpp │ │ │ └── RectangleShape.hpp │ │ │ ├── Network.hpp │ │ │ ├── Audio.hpp │ │ │ ├── Window.hpp │ │ │ ├── System.hpp │ │ │ ├── OpenGL.hpp │ │ │ ├── Graphics.hpp │ │ │ └── GpuPreference.hpp │ └── readme.md └── screen_capture_lite │ ├── bin │ ├── win32 │ │ ├── screen_capture_lite.dll │ │ └── screen_capture_lite_d.dll │ └── win64 │ │ ├── screen_capture_lite.dll │ │ └── screen_capture_lite_d.dll │ ├── lib │ ├── win32 │ │ ├── screen_capture_lite.lib │ │ └── screen_capture_lite_d.lib │ ├── win64 │ │ ├── screen_capture_lite.lib │ │ └── screen_capture_lite_d.lib │ └── linux64 │ │ └── libscreen_capture_lite.a │ └── LICENSE ├── Gui ├── GuiStructures.h ├── GuiImage.h ├── GuiText.h ├── GuiButton.h ├── GuiSystem.h ├── GuiImage.cpp ├── GuiText.cpp ├── GuiElement.h ├── GuiButton.cpp ├── GuiSystem.cpp └── GuiElement.cpp ├── .gitignore ├── .gitmodules ├── main.cpp ├── Utils ├── TexturePooler.h ├── Utils.h ├── GlobalConstants.cpp ├── Transformation.h ├── VRDashOverlay.h ├── TexturePooler.cpp ├── VROverlay.h ├── Transformation.cpp ├── WindowCapturer.h ├── Utils.cpp └── VRDashOverlay.cpp ├── Managers ├── ConfigManager.h ├── WidgetManager.h └── ConfigManager.cpp ├── Widgets ├── Widget.h ├── Widget.cpp ├── WidgetKeyboard.h ├── WidgetStats.h └── WidgetWindowCapture.h ├── stdafx.h ├── Core ├── VRDevicesStates.h ├── Core.h └── VRDevicesStates.cpp ├── LICENSE ├── openvr_widgets.vcxproj.user ├── openvr_widgets.sln └── README.md /resources/fonts/dummy.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: sdraw_ 2 | -------------------------------------------------------------------------------- /stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | -------------------------------------------------------------------------------- /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/icon.ico -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/resource.h -------------------------------------------------------------------------------- /openvr_widgets.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/openvr_widgets.rc -------------------------------------------------------------------------------- /resources/icons/atlas_stats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/resources/icons/atlas_stats.png -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/flac.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/flac.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/ogg.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/ogg.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/flac.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/flac.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/ogg.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/ogg.lib -------------------------------------------------------------------------------- /resources/icons/atlas_capture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/resources/icons/atlas_capture.png -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/vorbis.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/vorbis.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/vorbis.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/vorbis.lib -------------------------------------------------------------------------------- /resources/icons/atlas_keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/resources/icons/atlas_keyboard.png -------------------------------------------------------------------------------- /resources/icons/dashboard_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/resources/icons/dashboard_icon.png -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/openal32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/openal32.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/openal32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/openal32.dll -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/freetype.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/freetype.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/openal32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/openal32.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-audio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-audio.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-main.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/vorbisenc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/vorbisenc.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/vorbisfile.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/vorbisfile.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/freetype.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/freetype.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/openal32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/openal32.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-audio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-audio.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-main.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/vorbisenc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/vorbisenc.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/vorbisfile.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/vorbisfile.lib -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-audio-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-audio-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-audio-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-audio-2.dll -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-audio-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-audio-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-audio-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-audio-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-audio-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-audio-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-main-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-main-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-network.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-network.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-system.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-system.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-window.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-window.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-audio-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-audio-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-audio-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-audio-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-audio-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-audio-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-main-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-main-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-network.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-network.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-system.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-system.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-window.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-window.lib -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-audio-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-audio-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-graphics-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-graphics-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-network-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-network-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-system-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-system-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-system-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-system-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-window-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-window-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-window-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-window-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-audio-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-audio-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-graphics-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-graphics-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-network-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-network-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-system-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-system-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-system-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-system-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-window-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-window-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-window-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-window-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-audio-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-audio-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-audio-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-audio-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-graphics-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-graphics-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-graphics-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-graphics-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-graphics-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-graphics-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-graphics.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-graphics.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-main-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-main-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-network-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-network-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-network-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-network-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-network-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-network-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-system-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-system-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-system-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-system-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-system-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-system-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-system-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-system-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-system-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-system-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-window-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-window-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-window-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-window-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-window-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-window-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-window-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-window-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-window-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-window-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-audio-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-audio-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-audio-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-audio-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-graphics-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-graphics-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-graphics-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-graphics-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-graphics-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-graphics-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-graphics.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-graphics.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-main-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-main-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-network-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-network-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-network-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-network-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-network-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-network-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-system-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-system-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-system-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-system-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-system-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-system-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-system-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-system-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-system-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-system-s.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-window-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-window-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-window-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-window-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-window-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-window-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-window-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-window-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-window-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-window-s.lib -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-graphics-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-graphics-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win32/sfml-network-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win32/sfml-network-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-graphics-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-graphics-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/bin/win64/sfml-network-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/bin/win64/sfml-network-d-2.dll -------------------------------------------------------------------------------- /vendor/sfml/lib/linux64/libsfml-system-s.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/linux64/libsfml-system-s.a -------------------------------------------------------------------------------- /vendor/sfml/lib/linux64/libsfml-window-s.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/linux64/libsfml-window-s.a -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-graphics-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-graphics-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-graphics-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-graphics-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-network-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-network-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win32/sfml-network-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win32/sfml-network-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-graphics-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-graphics-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-graphics-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-graphics-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-network-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-network-s-d.lib -------------------------------------------------------------------------------- /vendor/sfml/lib/win64/sfml-network-s-d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/win64/sfml-network-s-d.pdb -------------------------------------------------------------------------------- /vendor/sfml/lib/linux64/libsfml-graphics-s.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/sfml/lib/linux64/libsfml-graphics-s.a -------------------------------------------------------------------------------- /resources/icons/LICENSES.md: -------------------------------------------------------------------------------- 1 | Material design icons by Google, licensed under Apache license version 2.0. 2 | RAM icon by smalllikeart, licensed under Flaticon Basic License. 3 | -------------------------------------------------------------------------------- /vendor/screen_capture_lite/bin/win32/screen_capture_lite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/bin/win32/screen_capture_lite.dll -------------------------------------------------------------------------------- /vendor/screen_capture_lite/bin/win64/screen_capture_lite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/bin/win64/screen_capture_lite.dll -------------------------------------------------------------------------------- /vendor/screen_capture_lite/lib/win32/screen_capture_lite.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/lib/win32/screen_capture_lite.lib -------------------------------------------------------------------------------- /vendor/screen_capture_lite/lib/win64/screen_capture_lite.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/lib/win64/screen_capture_lite.lib -------------------------------------------------------------------------------- /vendor/screen_capture_lite/bin/win32/screen_capture_lite_d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/bin/win32/screen_capture_lite_d.dll -------------------------------------------------------------------------------- /vendor/screen_capture_lite/bin/win64/screen_capture_lite_d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/bin/win64/screen_capture_lite_d.dll -------------------------------------------------------------------------------- /vendor/screen_capture_lite/lib/linux64/libscreen_capture_lite.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/lib/linux64/libscreen_capture_lite.a -------------------------------------------------------------------------------- /vendor/screen_capture_lite/lib/win32/screen_capture_lite_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/lib/win32/screen_capture_lite_d.lib -------------------------------------------------------------------------------- /vendor/screen_capture_lite/lib/win64/screen_capture_lite_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SDraw/openvr_widgets/HEAD/vendor/screen_capture_lite/lib/win64/screen_capture_lite_d.lib -------------------------------------------------------------------------------- /Gui/GuiStructures.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum GuiClick : unsigned char 4 | { 5 | GC_Left = 0U, 6 | GC_Right, 7 | GC_Middle 8 | }; 9 | enum GuiClickState : unsigned char 10 | { 11 | GCS_Press = 0U, 12 | GCS_Release 13 | }; 14 | -------------------------------------------------------------------------------- /resources/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/shaders/frag_color_swap.glsl: -------------------------------------------------------------------------------- 1 | uniform sampler2D gTexture0; 2 | 3 | void main() 4 | { 5 | vec4 l_color = texture2D(gTexture0,gl_TexCoord[0].xy); 6 | l_color.rb = l_color.br; 7 | l_color.a = 1.0; 8 | gl_FragColor = l_color; 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Fortran module files 15 | *.mod 16 | *.smod 17 | 18 | # Executables 19 | *.out 20 | *.app 21 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/glm"] 2 | path = vendor/glm 3 | url = https://github.com/g-truc/glm.git 4 | [submodule "vendor/pugixml"] 5 | path = vendor/pugixml 6 | url = https://github.com/zeux/pugixml.git 7 | [submodule "vendor/openvr"] 8 | path = vendor/openvr 9 | url = https://github.com/ValveSoftware/openvr.git 10 | -------------------------------------------------------------------------------- /Gui/GuiImage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Gui/GuiElement.h" 3 | 4 | class GuiImage : public GuiElement 5 | { 6 | sf::Sprite *m_sprite; 7 | 8 | // GuiElement 9 | void ProcessFocusInternal(unsigned int f_mouseX, unsigned int f_mouseY) override; 10 | void ProcessBlurInternal(unsigned int f_mouseX, unsigned int f_mouseY) override; 11 | void Update() override; 12 | public: 13 | explicit GuiImage(const sf::Texture *f_texture); 14 | ~GuiImage(); 15 | 16 | void SetUV(const sf::Vector2i &f_pos, const sf::Vector2i &f_size); 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Core/Core.h" 4 | 5 | #ifdef _WIN32 6 | #ifdef _DEBUG 7 | int main(void) 8 | { 9 | #else 10 | int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) 11 | { 12 | UNREFERENCED_PARAMETER(hPrevInstance); 13 | UNREFERENCED_PARAMETER(lpCmdLine); 14 | #endif 15 | #else 16 | int main(void) 17 | { 18 | #endif 19 | Core *l_core = new Core(); 20 | if(l_core->Initialize()) 21 | { 22 | while(l_core->DoPulse()); 23 | } 24 | l_core->Terminate(); 25 | delete l_core; 26 | 27 | return EXIT_SUCCESS; 28 | } 29 | -------------------------------------------------------------------------------- /Utils/TexturePooler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Specific class for working with textures that aren't static during application runtime 4 | // Refer to https://github.com/ValveSoftware/openvr/issues/1255 for more information 5 | class TexturePooler 6 | { 7 | static sf::Texture *ms_lastTexture; 8 | static sf::RenderTexture *ms_lastRenderTexture; 9 | public: 10 | static sf::Texture* CreateTexture(unsigned int f_width, unsigned int f_height); 11 | static void DeleteTexture(sf::Texture *f_texture); 12 | 13 | static sf::RenderTexture* CreateRenderTexture(unsigned int f_width, unsigned int f_height); 14 | static void DeleteRenderTexture(sf::RenderTexture *f_rt); 15 | }; 16 | -------------------------------------------------------------------------------- /Utils/Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void ConvertMatrix(const vr::HmdMatrix34_t &f_matVR, glm::mat4 &f_mat); 4 | void ConvertMatrix(const glm::mat4 &f_mat, vr::HmdMatrix34_t &f_matVR); 5 | void GetRotationToPoint(const glm::vec3 &f_pointA, const glm::vec3 &f_pointB, const glm::quat &f_rotationA, glm::quat &f_result); 6 | 7 | size_t ReadEnumVector(const std::string &f_val, const std::vector &f_vec); 8 | size_t ReadEnumVector(const char *f_val, const std::vector &f_vec); 9 | 10 | void ExtractScreenCaptureImage(const SL::Screen_Capture::Image &f_img, unsigned char *f_dst, size_t f_size); 11 | 12 | #ifdef __linux__ 13 | unsigned long long GetTickCount64(); 14 | #endif 15 | -------------------------------------------------------------------------------- /Gui/GuiText.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Gui/GuiElement.h" 3 | 4 | class GuiText : public GuiElement 5 | { 6 | sf::Text *m_text; 7 | unsigned char m_alignment; 8 | 9 | // GuiElement 10 | void Update() override; 11 | public: 12 | enum GuiTextAlignment : unsigned char 13 | { 14 | GTA_Left = 0U, 15 | GTA_Center 16 | }; 17 | 18 | void Set(const char *f_string); 19 | void Set(const wchar_t *f_string); 20 | void Set(const std::string &f_string); 21 | void Set(const std::wstring &f_string); 22 | void SetCharactersSize(unsigned int f_size); 23 | void SetAlignment(unsigned char f_align); 24 | public: 25 | explicit GuiText(const sf::Font *f_font); 26 | ~GuiText(); 27 | }; 28 | -------------------------------------------------------------------------------- /Utils/GlobalConstants.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | extern const float g_pi = glm::pi(); 4 | extern const float g_piHalf = g_pi*0.5f; 5 | extern const glm::mat4 g_identityMatrix(1.f); 6 | extern const glm::ivec2 g_emptyIVector2(0); 7 | extern const glm::vec3 g_emptyVector(0.f); 8 | extern const glm::quat g_emptyQuat(1.f, 0.f, 0.f, 0.f); 9 | extern const glm::vec4 g_zeroPoint(0.f, 0.f, 0.f, 1.f); 10 | extern const glm::vec3 g_axisX(1.f, 0.f, 0.f); 11 | extern const glm::vec3 g_axisY(0.f, 1.f, 0.f); 12 | extern const glm::vec3 g_axisZN(0.f, 0.f, -1.f); 13 | extern const sf::Color g_clearColor(0U, 0U, 0U, 127U); 14 | extern const unsigned char g_dummyTextureData[] 15 | { 16 | 0x7FU, 0x7FU, 0x7FU, 0xFF, 17 | 0xF7U, 0x94U, 0x1DU, 0xFF, 18 | 0xF7U, 0x94U, 0x1DU, 0xFF, 19 | 0x7FU, 0x7FU, 0x7FU, 0xFF 20 | }; 21 | -------------------------------------------------------------------------------- /Utils/Transformation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Transformation final 4 | { 5 | glm::vec3 m_position; 6 | glm::quat m_rotation; 7 | 8 | glm::mat4 m_matrix; 9 | vr::HmdMatrix34_t m_vrMatrix; 10 | 11 | bool m_update; 12 | bool m_updated; 13 | public: 14 | Transformation(); 15 | ~Transformation(); 16 | 17 | void SetPosition(const glm::vec3 &f_pos); 18 | inline const glm::vec3& GetPosition() const { return m_position; } 19 | void Move(const glm::vec3 &f_pos); 20 | 21 | void SetRotation(const glm::quat &f_rot); 22 | inline const glm::quat& GetRotation() const { return m_rotation; } 23 | 24 | inline const glm::mat4& GetMatrix() const { return m_matrix; } 25 | inline const vr::HmdMatrix34_t& GetMatrixVR() const { return m_vrMatrix; } 26 | 27 | void Update(const Transformation *f_parent = nullptr); 28 | }; 29 | -------------------------------------------------------------------------------- /Managers/ConfigManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ConfigManager final 4 | { 5 | static std::string ms_directory; 6 | static std::string ms_guiFont; 7 | static std::string ms_keyboardLayout; 8 | 9 | unsigned char m_targetRate; 10 | 11 | ConfigManager(const ConfigManager &that) = delete; 12 | ConfigManager& operator=(const ConfigManager &that) = delete; 13 | public: 14 | enum TargetFPS : unsigned char 15 | { 16 | TF_60 = 0U, 17 | TF_90, 18 | TF_120, 19 | TF_144, 20 | 21 | TF_Count 22 | }; 23 | 24 | ConfigManager(); 25 | ~ConfigManager(); 26 | 27 | void Load(); 28 | void Save(); 29 | 30 | unsigned char GetTargetRate(); 31 | void SetTargetRate(unsigned char f_target); 32 | 33 | static const std::string& GetDirectory(); 34 | static const std::string& GetGuiFont(); 35 | static const std::string& GetKeyboardLayout(); 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /Widgets/Widget.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VROverlay; 4 | 5 | class Widget 6 | { 7 | Widget(const Widget &that) = delete; 8 | Widget& operator=(const Widget &that) = delete; 9 | public: 10 | virtual ~Widget(); 11 | 12 | virtual bool Create() = 0; 13 | virtual void Destroy(); 14 | virtual void Update() = 0; 15 | 16 | bool IsClosed() const; 17 | 18 | virtual void OnHandActivated(size_t f_hand); 19 | virtual void OnHandDeactivated(size_t f_hand); 20 | virtual void OnButtonPress(size_t f_hand, uint32_t f_button); 21 | virtual void OnButtonRelease(size_t f_hand, uint32_t f_button); 22 | virtual void OnDashboardOpen(); 23 | virtual void OnDashboardClose(); 24 | protected: 25 | VROverlay *m_overlayMain; 26 | vr::VREvent_t m_event; 27 | glm::vec2 m_size; 28 | 29 | bool m_valid; 30 | bool m_visible; // Used for constant widgets in general 31 | bool m_closed; 32 | bool m_activeDashboard; 33 | 34 | Widget(); 35 | }; 36 | -------------------------------------------------------------------------------- /Gui/GuiButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Gui/GuiElement.h" 3 | 4 | class GuiButton final : public GuiElement 5 | { 6 | sf::Text *m_fontText; 7 | sf::RectangleShape *m_background; 8 | 9 | sf::Color m_backgroundColor; 10 | 11 | GuiButton(const GuiButton &that) = delete; 12 | GuiButton& operator=(const GuiButton &that) = delete; 13 | 14 | void ProcessFocusInternal(unsigned int f_mouseX, unsigned int f_mouseY) override; 15 | void ProcessBlurInternal(unsigned int f_mouseX, unsigned int f_mouseY) override; 16 | 17 | // GuiElement 18 | void Update() override; 19 | public: 20 | explicit GuiButton(const sf::Font *f_font); 21 | ~GuiButton(); 22 | 23 | void SetText(const char *f_string); 24 | void SetText(const wchar_t *f_string); 25 | void SetText(const std::string &f_string); 26 | void SetText(const std::wstring &f_string); 27 | void SetTextSize(unsigned int f_size); 28 | 29 | void SetBackgroundColor(const sf::Color &f_color); 30 | }; 31 | -------------------------------------------------------------------------------- /stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _WIN32 4 | #define _CRT_SECURE_NO_WARNINGS 5 | #define WIN32_LEAN_AND_MEAN 6 | #define NOMINMAX 7 | #include 8 | #include 9 | #include 10 | #ifdef _DEBUG 11 | #include 12 | #endif 13 | #endif 14 | 15 | #ifdef __linux__ 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #endif 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "openvr.h" 32 | 33 | #include "SFML/GpuPreference.hpp" 34 | #include "SFML/Graphics.hpp" 35 | 36 | #include "ScreenCapture.h" 37 | 38 | #include "glm/glm.hpp" 39 | #include "glm/gtc/matrix_transform.hpp" 40 | #include "glm/gtc/quaternion.hpp" 41 | #include "glm/gtx/intersect.hpp" 42 | 43 | #include "pugixml.hpp" 44 | 45 | #ifdef __linux__ 46 | #include 47 | #endif 48 | -------------------------------------------------------------------------------- /Utils/VRDashOverlay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VRDashOverlay final 4 | { 5 | vr::VROverlayHandle_t m_handle; 6 | vr::VROverlayHandle_t m_handleThumb; 7 | vr::Texture_t m_texture; 8 | vr::Texture_t m_textureThumb; 9 | public: 10 | VRDashOverlay(); 11 | ~VRDashOverlay(); 12 | 13 | bool Create(const std::string &f_key, const std::string &f_name); 14 | void Destroy(); 15 | bool IsValid() const; 16 | 17 | void SetTexture(unsigned int f_name); 18 | void SetTexture(const std::string &f_path); 19 | void SetThumbTexture(unsigned int f_name); 20 | void SetThumbTexture(const std::string &f_path); 21 | void SetInputMethod(vr::VROverlayInputMethod f_method); 22 | void SetFlag(vr::VROverlayFlags f_flag, bool f_state); 23 | void SetWidth(float f_width); 24 | void SetMouseScale(float f_width, float f_height); 25 | void SetAlpha(float f_alpha); 26 | bool IsVisible() const; 27 | 28 | bool Poll(vr::VREvent_t &f_event); 29 | void Update(); 30 | }; 31 | -------------------------------------------------------------------------------- /Core/VRDevicesStates.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum VRDeviceIndex : size_t 4 | { 5 | VDI_Hmd = 0U, 6 | VDI_LeftController, 7 | VDI_RightController, 8 | VDI_FirstTracker, 9 | VDI_SecondTracker, 10 | VDI_ThirdTracker, 11 | 12 | VDI_Max 13 | }; 14 | 15 | class VRDevicesStates final 16 | { 17 | static glm::vec3 ms_devicePos[VRDeviceIndex::VDI_Max]; 18 | static glm::quat ms_deviceRot[VRDeviceIndex::VDI_Max]; 19 | static glm::mat4 ms_deviceMat[VRDeviceIndex::VDI_Max]; 20 | static float ms_devicePower[VRDeviceIndex::VDI_Max]; 21 | public: 22 | static void SetDeviceTransformation(const size_t f_device, const vr::HmdMatrix34_t &f_mat); 23 | static void SetDevicePower(const size_t f_device, const float f_pow); 24 | 25 | static void GetDevicePosition(const size_t f_device, glm::vec3 &f_pos); 26 | static void GetDeviceRotation(const size_t f_device, glm::quat &f_rot); 27 | static void GetDeviceMatrix(const size_t f_device, glm::mat4 &f_mat); 28 | static const float GetDevicePower(const size_t f_device); 29 | }; 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 SDraw 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/screen_capture_lite/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Scott 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Core/Core.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ConfigManager; 4 | class WidgetManager; 5 | 6 | class Core final 7 | { 8 | vr::IVRSystem *m_vrSystem; 9 | vr::VREvent_t m_event; 10 | std::vector m_deviceIndex; 11 | 12 | bool m_active; 13 | sf::Context *m_context; 14 | std::chrono::milliseconds m_threadDelay; 15 | unsigned long long m_systemTick; 16 | unsigned long long m_powerTick; 17 | 18 | ConfigManager *m_configManager; 19 | WidgetManager *m_widgetManager; 20 | 21 | Core(const Core &that) = delete; 22 | Core& operator=(const Core &that) = delete; 23 | public: 24 | Core(); 25 | ~Core(); 26 | 27 | bool Initialize(); 28 | void Terminate(); 29 | bool DoPulse(); 30 | 31 | inline vr::IVRSystem* GetVRSystem() const { return m_vrSystem; } 32 | inline ConfigManager* GetConfigManager() const { return m_configManager; } 33 | inline WidgetManager* GetWidgetManager() const { return m_widgetManager; } 34 | 35 | void UpdateTargetRate(); 36 | void ForceHandSearch(); 37 | void SendMessageToDeviceWithProperty(uint64_t f_value, const char *f_message); 38 | void RequestExit(); 39 | }; 40 | -------------------------------------------------------------------------------- /openvr_widgets.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(ProjectDir)/bin/win32/ 5 | WindowsLocalDebugger 6 | 7 | 8 | $(ProjectDir)/bin/win32/ 9 | WindowsLocalDebugger 10 | 11 | 12 | $(ProjectDir)/bin/win64/ 13 | WindowsLocalDebugger 14 | 15 | 16 | $(ProjectDir)/bin/win64/ 17 | WindowsLocalDebugger 18 | 19 | -------------------------------------------------------------------------------- /Gui/GuiSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class GuiElement; 4 | class GuiButton; 5 | class GuiImage; 6 | class GuiText; 7 | /*class GuiCheckbox; 8 | class GuiRectangle;*/ 9 | 10 | class GuiSystem final 11 | { 12 | sf::RenderTexture *m_renderTexture; 13 | sf::Font *m_mainFont; 14 | 15 | std::vector m_guiElements; 16 | 17 | GuiSystem(const GuiSystem &that) = delete; 18 | GuiSystem& operator=(const GuiSystem &that) = delete; 19 | public: 20 | explicit GuiSystem(const sf::Vector2u &f_size); 21 | ~GuiSystem(); 22 | 23 | inline bool IsValid() const { return (m_renderTexture != nullptr); } 24 | 25 | void SetFont(const std::string &f_path); 26 | 27 | GuiButton* CreateButton(); 28 | GuiImage* CreateImage(const sf::Texture *f_texture); 29 | GuiText* CreateText(); 30 | /*GuiCheckbox* CreateCheckbox(); 31 | GuiRectangle* CreateRectangle();*/ 32 | void Remove(GuiElement *f_element); 33 | 34 | unsigned int GetRenderTextureHandle() const; 35 | 36 | void ProcessClick(unsigned char f_button, unsigned char f_state, unsigned int f_mouseX, unsigned int f_mouseY); 37 | void ProcessMove(unsigned int f_posX, unsigned int f_posY); 38 | 39 | void Update(); 40 | }; 41 | -------------------------------------------------------------------------------- /Widgets/Widget.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Widgets/Widget.h" 4 | #include "Utils/VROverlay.h" 5 | 6 | #include "Utils/Transformation.h" 7 | 8 | Widget::Widget() 9 | { 10 | m_overlayMain = new VROverlay(); 11 | m_event = { 0 }; 12 | m_size.x = 0.f; 13 | m_size.y = 0.f; 14 | 15 | m_valid = false; 16 | m_visible = false; 17 | m_closed = false; 18 | m_activeDashboard = false; 19 | } 20 | Widget::~Widget() 21 | { 22 | delete m_overlayMain; 23 | } 24 | 25 | void Widget::Destroy() 26 | { 27 | m_overlayMain->Destroy(); 28 | 29 | m_valid = false; 30 | m_visible = false; 31 | m_closed = false; 32 | m_activeDashboard = false; 33 | } 34 | 35 | bool Widget::IsClosed() const 36 | { 37 | return m_closed; 38 | } 39 | 40 | void Widget::OnHandActivated(size_t f_hand) 41 | { 42 | } 43 | void Widget::OnHandDeactivated(size_t f_hand) 44 | { 45 | } 46 | void Widget::OnButtonPress(size_t f_hand, uint32_t f_button) 47 | { 48 | } 49 | void Widget::OnButtonRelease(size_t f_hand, uint32_t f_button) 50 | { 51 | } 52 | 53 | void Widget::OnDashboardOpen() 54 | { 55 | if(m_valid) m_activeDashboard = true; 56 | } 57 | void Widget::OnDashboardClose() 58 | { 59 | if(m_valid) m_activeDashboard = false; 60 | } 61 | -------------------------------------------------------------------------------- /Gui/GuiImage.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Gui/GuiImage.h" 4 | 5 | GuiImage::GuiImage(const sf::Texture *f_texture) 6 | { 7 | m_sprite = new sf::Sprite(*f_texture); 8 | m_drawables.push_back(m_sprite); 9 | 10 | const sf::Vector2u l_textureSize = f_texture->getSize(); 11 | m_size.x = static_cast(l_textureSize.x); 12 | m_size.y = static_cast(l_textureSize.y); 13 | } 14 | 15 | GuiImage::~GuiImage() 16 | { 17 | delete m_sprite; 18 | } 19 | 20 | void GuiImage::SetUV(const sf::Vector2i &f_pos, const sf::Vector2i &f_size) 21 | { 22 | const sf::IntRect l_rectangle(f_pos,f_size); 23 | m_sprite->setTextureRect(l_rectangle); 24 | } 25 | 26 | void GuiImage::ProcessFocusInternal(unsigned int f_mouseX, unsigned int f_mouseY) 27 | { 28 | if(m_sprite) m_sprite->setColor(m_selectionColor); 29 | 30 | GuiElement::ProcessFocusInternal(f_mouseX, f_mouseY); 31 | } 32 | 33 | void GuiImage::ProcessBlurInternal(unsigned int f_mouseX, unsigned int f_mouseY) 34 | { 35 | if(m_sprite) m_sprite->setColor(m_color); 36 | 37 | GuiElement::ProcessBlurInternal(f_mouseX, f_mouseY); 38 | } 39 | 40 | void GuiImage::Update() 41 | { 42 | if(m_update) m_sprite->setPosition(m_position); 43 | 44 | GuiElement::Update(); 45 | } 46 | -------------------------------------------------------------------------------- /vendor/sfml/license.md: -------------------------------------------------------------------------------- 1 | # SFML 2 | 3 | SFML - Copyright (C) 2007-2018 Laurent Gomila - laurent@sfml-dev.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 10 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 11 | 3. This notice may not be removed or altered from any source distribution. 12 | 13 | ## External libraries used by SFML 14 | 15 | * _OpenAL-Soft_ is under the LGPL license 16 | * _stb_image_ and _stb_image_write_ are public domain 17 | * _freetype_ is under the FreeType license or the GPL license 18 | * _libogg_ is under the BSD license 19 | * _libvorbis_ is under the BSD license 20 | * _libflac_ is under the BSD license 21 | -------------------------------------------------------------------------------- /Utils/TexturePooler.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Utils/TexturePooler.h" 4 | 5 | sf::Texture *TexturePooler::ms_lastTexture = nullptr; 6 | sf::RenderTexture *TexturePooler::ms_lastRenderTexture = nullptr; 7 | 8 | sf::Texture* TexturePooler::CreateTexture(unsigned int f_width, unsigned int f_height) 9 | { 10 | sf::Texture *l_texture = new sf::Texture(); 11 | l_texture->create(f_width, f_height); 12 | if(ms_lastTexture) 13 | { 14 | delete ms_lastTexture; 15 | ms_lastTexture = nullptr; 16 | } 17 | return l_texture; 18 | } 19 | void TexturePooler::DeleteTexture(sf::Texture *f_texture) 20 | { 21 | if(ms_lastTexture) delete ms_lastTexture; 22 | ms_lastTexture = f_texture; 23 | } 24 | 25 | sf::RenderTexture* TexturePooler::CreateRenderTexture(unsigned int f_width, unsigned int f_height) 26 | { 27 | sf::RenderTexture *l_rt = new sf::RenderTexture(); 28 | l_rt->create(f_width, f_height); 29 | if(ms_lastRenderTexture) 30 | { 31 | delete ms_lastRenderTexture; 32 | ms_lastRenderTexture = nullptr; 33 | } 34 | return l_rt; 35 | } 36 | void TexturePooler::DeleteRenderTexture(sf::RenderTexture *f_rt) 37 | { 38 | if(ms_lastRenderTexture) delete ms_lastRenderTexture; 39 | ms_lastRenderTexture = f_rt; 40 | } 41 | -------------------------------------------------------------------------------- /Utils/VROverlay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Transformation; 4 | class VROverlay final 5 | { 6 | vr::VROverlayHandle_t m_handle; 7 | vr::Texture_t m_texture; 8 | 9 | Transformation *m_transform; 10 | public: 11 | VROverlay(); 12 | ~VROverlay(); 13 | 14 | bool Create(const std::string &f_key, const std::string &f_name); 15 | void Destroy(); 16 | bool IsValid() const; 17 | 18 | void SetTexture(unsigned int f_name); 19 | void SetTexture(const std::string &f_path); 20 | void SetTexture(unsigned int f_width, unsigned int f_height); 21 | void SetInputMethod(vr::VROverlayInputMethod f_method); 22 | void SetFlag(vr::VROverlayFlags f_flag, bool f_state); 23 | void SetWidth(float f_width); 24 | void SetMouseScale(float f_width, float f_height); 25 | void SetAlpha(float f_alpha); 26 | void SetColor(float f_red, float f_green, float f_blue); 27 | void SetOrder(unsigned int f_order); 28 | void SetIntersection(float l_width, float f_height); 29 | void Show(); 30 | void Hide(); 31 | bool IsVisible() const; 32 | 33 | Transformation* GetTransform() const; 34 | 35 | bool Intersect(const glm::vec3 &f_pos, const glm::vec3 &f_dir, glm::vec2 &f_uv); 36 | bool Poll(vr::VREvent_t &f_event); 37 | void Update(const VROverlay *f_parent = nullptr); 38 | }; 39 | -------------------------------------------------------------------------------- /openvr_widgets.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvr_widgets", "openvr_widgets.vcxproj", "{ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Debug|x64.ActiveCfg = Debug|x64 17 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Debug|x64.Build.0 = Debug|x64 18 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Debug|x86.ActiveCfg = Debug|Win32 19 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Debug|x86.Build.0 = Debug|Win32 20 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Release|x64.ActiveCfg = Release|x64 21 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Release|x64.Build.0 = Release|x64 22 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Release|x86.ActiveCfg = Release|Win32 23 | {ABE39968-9814-40D2-BA99-C6ECA4E3C8FA}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /Widgets/WidgetKeyboard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Widgets/Widget.h" 3 | 4 | class GuiSystem; 5 | class GuiElement; 6 | class GuiButton; 7 | class Transformation; 8 | 9 | class WidgetKeyboard : public Widget 10 | { 11 | enum LayoutState : unsigned char 12 | { 13 | LS_Main = 0U, 14 | LS_Alternative, 15 | 16 | LS_Count 17 | }; 18 | 19 | struct KeyboadKey 20 | { 21 | std::string m_text; 22 | std::string m_altText; 23 | unsigned int m_code; 24 | }; 25 | 26 | // ISO keyboard (105) QWERTY UK; https://commons.wikimedia.org/wiki/File:ISO_keyboard_(105)_QWERTY_UK.svg 27 | GuiSystem *m_guiSystem; 28 | std::vector m_guiButtons; 29 | 30 | static sf::Texture *ms_textureAtlas; 31 | 32 | unsigned char m_layoutState; 33 | #ifdef _WIN32 34 | std::vector m_systemLayouts; 35 | #endif 36 | 37 | bool m_activeMove; 38 | bool m_activePin; 39 | unsigned long long m_lastTriggerTick; 40 | 41 | void OnGuiElementClick_Keys(GuiElement *f_guiElement, unsigned char f_button, unsigned char f_state); 42 | 43 | // Widget 44 | bool Create(); 45 | void Destroy() override; 46 | void Update(); 47 | void OnHandDeactivated(size_t f_hand) override; 48 | void OnButtonPress(size_t f_hand, uint32_t f_button) override; 49 | void OnDashboardOpen() override; 50 | void OnDashboardClose() override; 51 | public: 52 | WidgetKeyboard(); 53 | ~WidgetKeyboard(); 54 | 55 | static void InitStaticResources(); 56 | static void RemoveStaticResources(); 57 | }; 58 | -------------------------------------------------------------------------------- /Gui/GuiText.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Gui/GuiText.h" 4 | 5 | GuiText::GuiText(const sf::Font *f_font) 6 | { 7 | m_text = new sf::Text("", *f_font, 14U); 8 | m_drawables.push_back(m_text); 9 | m_alignment = GTA_Left; 10 | } 11 | 12 | GuiText::~GuiText() 13 | { 14 | delete m_text; 15 | } 16 | 17 | void GuiText::Set(const char *f_string) 18 | { 19 | m_text->setString(f_string); 20 | m_update = true; 21 | } 22 | 23 | void GuiText::Set(const wchar_t *f_string) 24 | { 25 | m_text->setString(f_string); 26 | m_update = true; 27 | } 28 | 29 | void GuiText::Set(const std::string &f_string) 30 | { 31 | m_text->setString(f_string); 32 | m_update = true; 33 | } 34 | 35 | void GuiText::Set(const std::wstring &f_string) 36 | { 37 | m_text->setString(f_string); 38 | m_update = true; 39 | } 40 | 41 | void GuiText::SetCharactersSize(unsigned int f_size) 42 | { 43 | m_text->setCharacterSize(f_size); 44 | m_update = true; 45 | } 46 | 47 | void GuiText::SetAlignment(unsigned char f_align) 48 | { 49 | m_alignment = f_align; 50 | m_update = true; 51 | } 52 | 53 | void GuiText::Update() 54 | { 55 | if(m_update) 56 | { 57 | switch(m_alignment) 58 | { 59 | case GTA_Left: 60 | m_text->setPosition(m_position); 61 | break; 62 | case GTA_Center: 63 | { 64 | const sf::FloatRect l_bounds = m_text->getLocalBounds(); 65 | m_text->setPosition(m_position.x - l_bounds.width*0.5f, m_position.y - l_bounds.height*0.5f); 66 | } break; 67 | } 68 | m_text->setFillColor(m_color); 69 | } 70 | 71 | GuiElement::Update(); 72 | } 73 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Main.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_MAIN_HPP 26 | #define SFML_MAIN_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | #if defined(SFML_SYSTEM_IOS) 35 | 36 | // On iOS, we have no choice but to have our own main, 37 | // so we need to rename the user one and call it later 38 | #define main sfmlMain 39 | 40 | #endif 41 | 42 | 43 | #endif // SFML_MAIN_HPP 44 | -------------------------------------------------------------------------------- /Widgets/WidgetStats.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Widgets/Widget.h" 3 | 4 | class Transformation; 5 | 6 | class WidgetStats final : public Widget 7 | { 8 | enum StatsMode : size_t 9 | { 10 | SM_Watch = 0U, 11 | SM_Cpu, 12 | SM_Ram, 13 | SM_Frame, 14 | SM_ControllerPower, 15 | SM_TrackerPower, 16 | 17 | SM_Count 18 | }; 19 | enum StatsText : size_t 20 | { 21 | ST_Time = 0U, 22 | ST_Date, 23 | ST_Cpu, 24 | ST_Ram, 25 | ST_Frame, 26 | ST_ControllerPower, 27 | ST_TrackerPower, 28 | 29 | ST_Count 30 | }; 31 | 32 | sf::RenderTexture *m_renderTexture; 33 | sf::Font *m_font; 34 | sf::Text *m_fontText[ST_Count]; 35 | sf::Texture *m_textureAtlas; 36 | sf::Sprite *m_spriteIcon; 37 | 38 | #ifdef _WIN32 39 | struct WinHandles 40 | { 41 | PDH_HQUERY m_query; 42 | PDH_HCOUNTER m_counter; 43 | MEMORYSTATUSEX m_memoryStatus; 44 | } m_winHandles; 45 | #elif __linux__ 46 | int m_memoryTotal; 47 | size_t m_cpuTickIdle; 48 | size_t m_cpuTickTotal; 49 | #endif 50 | 51 | unsigned long long m_lastPressTick; 52 | std::time_t m_time; 53 | int m_lastSecond; 54 | int m_lastDay; 55 | 56 | size_t m_statsMode; 57 | bool m_forceUpdate; 58 | 59 | WidgetStats(const WidgetStats &that) = delete; 60 | WidgetStats& operator=(const WidgetStats &that) = delete; 61 | 62 | // Widget 63 | bool Create(); 64 | void Destroy() override; 65 | void Update(); 66 | void OnHandDeactivated(size_t f_hand) override; 67 | void OnButtonPress(size_t f_hand, uint32_t f_button) override; 68 | void OnButtonRelease(size_t f_hand, uint32_t f_button) override; 69 | public: 70 | WidgetStats(); 71 | ~WidgetStats(); 72 | }; 73 | -------------------------------------------------------------------------------- /Managers/WidgetManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Core; 4 | class GuiSystem; 5 | class GuiElement; 6 | class GuiButton; 7 | class Widget; 8 | class VRDashOverlay; 9 | 10 | class WidgetManager final 11 | { 12 | enum GuiElementIndex : size_t 13 | { 14 | GEI_Widgets, 15 | GEI_Widgets_WindowCapture, 16 | GEI_Widgets_Keyboard, 17 | GEI_Widgets_Remove, 18 | GEI_Widgets_Back, 19 | 20 | GEI_Devices, 21 | GEI_Devices_KinectV1, 22 | GEI_Devices_KinectV2, 23 | GEI_Devices_LMotionLeft, 24 | GEI_Devices_LMotionRight, 25 | GEI_Devices_Back, 26 | 27 | GEI_Settings, 28 | GEI_Settings_FPS, 29 | GEI_Settings_ReassignHands, 30 | GEI_Settings_Back, 31 | 32 | GEI_Close, 33 | 34 | GEI_Count 35 | }; 36 | 37 | Core *m_core; 38 | 39 | VRDashOverlay *m_dashOverlay; 40 | vr::VREvent_t m_event; 41 | 42 | std::map m_constantWidgets; 43 | std::vector m_widgets; 44 | 45 | GuiSystem *m_guiSystem; 46 | GuiButton *m_guiButtons[GEI_Count]; 47 | bool m_activeDashboard; 48 | 49 | WidgetManager(const WidgetManager &that) = delete; 50 | WidgetManager& operator=(const WidgetManager &that) = delete; 51 | 52 | void OnGuiElementMouseClick(GuiElement *f_guiElement, unsigned char f_button, unsigned char f_state); 53 | public: 54 | explicit WidgetManager(Core *f_core); 55 | ~WidgetManager(); 56 | 57 | void DoPulse(); 58 | 59 | // Events for widgets 60 | void OnHandActivated(size_t f_hand); 61 | void OnHandDeactivated(size_t f_hand); 62 | void OnButtonPress(size_t f_hand, uint32_t f_button); 63 | void OnButtonRelease(size_t f_hand, uint32_t f_button); 64 | void OnDashboardOpen(); 65 | void OnDashboardClose(); 66 | }; 67 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Audio/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_AUDIO_EXPORT_HPP 26 | #define SFML_AUDIO_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_AUDIO_EXPORTS) 38 | 39 | #define SFML_AUDIO_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_AUDIO_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_AUDIO_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SYSTEM_EXPORT_HPP 26 | #define SFML_SYSTEM_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_SYSTEM_EXPORTS) 38 | 39 | #define SFML_SYSTEM_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_SYSTEM_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_SYSTEM_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Window/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_WINDOW_EXPORT_HPP 26 | #define SFML_WINDOW_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_WINDOW_EXPORTS) 38 | 39 | #define SFML_WINDOW_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_WINDOW_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_WINDOW_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Network/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NETWORK_EXPORT_HPP 26 | #define SFML_NETWORK_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_NETWORK_EXPORTS) 38 | 39 | #define SFML_NETWORK_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_NETWORK_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_NETWORK_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Graphics/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GRAPHICS_EXPORT_HPP 26 | #define SFML_GRAPHICS_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_GRAPHICS_EXPORTS) 38 | 39 | #define SFML_GRAPHICS_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_GRAPHICS_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_GRAPHICS_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /Utils/Transformation.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Utils/Transformation.h" 4 | #include "Utils/Utils.h" 5 | 6 | extern const glm::mat4 g_identityMatrix; 7 | extern const glm::vec3 g_emptyVector; 8 | extern const glm::quat g_emptyQuat; 9 | 10 | Transformation::Transformation() 11 | { 12 | m_position = g_emptyVector; 13 | m_rotation = g_emptyQuat; 14 | 15 | m_matrix = g_identityMatrix; 16 | m_vrMatrix = { { { 0.f } } }; 17 | 18 | m_update = false; 19 | m_updated = false; 20 | } 21 | Transformation::~Transformation() 22 | { 23 | } 24 | 25 | void Transformation::SetPosition(const glm::vec3 &f_pos) 26 | { 27 | if(m_position != f_pos) 28 | { 29 | std::memcpy(&m_position, &f_pos, sizeof(glm::vec3)); 30 | m_update = true; 31 | } 32 | } 33 | void Transformation::Move(const glm::vec3 &f_pos) 34 | { 35 | m_position += f_pos; 36 | m_update = true; 37 | } 38 | 39 | void Transformation::SetRotation(const glm::quat &f_rot) 40 | { 41 | if(m_rotation != f_rot) 42 | { 43 | std::memcpy(&m_rotation, &f_rot, sizeof(glm::quat)); 44 | m_update = true; 45 | } 46 | } 47 | 48 | void Transformation::Update(const Transformation *f_parent) 49 | { 50 | m_updated = false; 51 | if(f_parent) 52 | { 53 | if(m_update || f_parent->m_updated) 54 | { 55 | m_matrix = glm::translate(g_identityMatrix, m_position)*glm::mat4_cast(m_rotation); 56 | m_matrix = f_parent->m_matrix*m_matrix; 57 | 58 | m_update = false; 59 | m_updated = true; 60 | } 61 | } 62 | else 63 | { 64 | if(m_update) 65 | { 66 | m_matrix = glm::translate(g_identityMatrix, m_position)*glm::mat4_cast(m_rotation); 67 | m_update = false; 68 | m_updated = true; 69 | } 70 | } 71 | if(m_updated) ConvertMatrix(m_matrix, m_vrMatrix); 72 | } 73 | -------------------------------------------------------------------------------- /Utils/WindowCapturer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class WindowCapturer final 4 | { 5 | struct CaptureInterfaces 6 | { 7 | std::shared_ptr> m_captureConfiguration; 8 | std::shared_ptr m_captureInterface; 9 | }; 10 | CaptureInterfaces *m_interfaces; 11 | 12 | std::vector m_windows; 13 | size_t m_windowsCount; 14 | size_t m_activeWindow; 15 | 16 | sf::Texture *m_texture; 17 | sf::Sprite *m_sprite; 18 | sf::RenderTexture *m_renderTexture; 19 | static sf::Shader *ms_shader; 20 | static sf::RenderStates ms_renderState; 21 | std::vector m_buffer; 22 | std::mutex m_bufferLock; 23 | bool m_bufferUpdated; 24 | 25 | std::atomic m_active; 26 | bool m_stale; 27 | 28 | std::chrono::milliseconds m_captureDelay; 29 | unsigned long long m_lastTick; 30 | 31 | WindowCapturer(const WindowCapturer &that) = delete; 32 | WindowCapturer& operator=(const WindowCapturer &that) = delete; 33 | 34 | std::vector GetCapturedWindow(); 35 | void ProcessCapture(const SL::Screen_Capture::Image &f_img, const SL::Screen_Capture::Window &f_window); 36 | public: 37 | WindowCapturer(); 38 | ~WindowCapturer(); 39 | 40 | bool StartCapture(size_t f_window); 41 | void StopCapture(); 42 | void Update(); 43 | 44 | inline bool IsActive() const { return m_active; } 45 | inline bool IsStale() const { return m_stale; } 46 | 47 | void SetDelay(size_t f_delay); 48 | 49 | size_t GetWindowsCount() const; 50 | const SL::Screen_Capture::Window* GetWindowInfo(size_t f_window) const; 51 | void UpdateWindows(); 52 | 53 | unsigned int GetTextureHandle() const; 54 | 55 | static void InitStaticResources(); 56 | static void RemoveStaticResources(); 57 | 58 | }; 59 | -------------------------------------------------------------------------------- /Core/VRDevicesStates.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Core/VRDevicesStates.h" 4 | #include "Utils/Utils.h" 5 | 6 | extern const glm::mat4 g_identityMatrix; 7 | extern const glm::vec3 g_emptyVector; 8 | extern const glm::quat g_emptyQuat; 9 | extern const glm::vec4 g_zeroPoint; 10 | 11 | glm::vec3 VRDevicesStates::ms_devicePos[] = { g_emptyVector }; 12 | glm::quat VRDevicesStates::ms_deviceRot[] = { g_emptyQuat }; 13 | glm::mat4 VRDevicesStates::ms_deviceMat[] = { g_identityMatrix }; 14 | float VRDevicesStates::ms_devicePower[] = { 0.f }; 15 | 16 | void VRDevicesStates::SetDeviceTransformation(const size_t f_device, const vr::HmdMatrix34_t &f_mat) 17 | { 18 | if(f_device < VRDeviceIndex::VDI_Max) 19 | { 20 | ConvertMatrix(f_mat, ms_deviceMat[f_device]); 21 | ms_devicePos[f_device] = ms_deviceMat[f_device] * g_zeroPoint; 22 | ms_deviceRot[f_device] = glm::quat_cast(ms_deviceMat[f_device]); 23 | } 24 | } 25 | 26 | void VRDevicesStates::GetDevicePosition(const size_t f_device, glm::vec3 &f_pos) 27 | { 28 | if(f_device < VRDeviceIndex::VDI_Max) std::memcpy(&f_pos, &ms_devicePos[f_device], sizeof(glm::vec3)); 29 | } 30 | 31 | void VRDevicesStates::GetDeviceRotation(const size_t f_device, glm::quat &f_rot) 32 | { 33 | if(f_device < VRDeviceIndex::VDI_Max) std::memcpy(&f_rot, &ms_deviceRot[f_device], sizeof(glm::quat)); 34 | } 35 | 36 | void VRDevicesStates::GetDeviceMatrix(const size_t f_device, glm::mat4 &f_mat) 37 | { 38 | if(f_device < VRDeviceIndex::VDI_Max) std::memcpy(&f_mat, &ms_deviceMat[f_device], sizeof(glm::mat4)); 39 | } 40 | 41 | void VRDevicesStates::SetDevicePower(const size_t f_device, const float f_pow) 42 | { 43 | if(f_device < VRDeviceIndex::VDI_Max) ms_devicePower[f_device] = f_pow; 44 | } 45 | 46 | const float VRDevicesStates::GetDevicePower(const size_t f_device) 47 | { 48 | float l_result = 0.f; 49 | if(f_device < VRDeviceIndex::VDI_Max) l_result = ms_devicePower[f_device]; 50 | return l_result; 51 | } 52 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/String.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | 26 | //////////////////////////////////////////////////////////// 27 | template 28 | String String::fromUtf8(T begin, T end) 29 | { 30 | String string; 31 | Utf8::toUtf32(begin, end, std::back_inserter(string.m_string)); 32 | return string; 33 | } 34 | 35 | 36 | //////////////////////////////////////////////////////////// 37 | template 38 | String String::fromUtf16(T begin, T end) 39 | { 40 | String string; 41 | Utf16::toUtf32(begin, end, std::back_inserter(string.m_string)); 42 | return string; 43 | } 44 | 45 | 46 | //////////////////////////////////////////////////////////// 47 | template 48 | String String::fromUtf32(T begin, T end) 49 | { 50 | String string; 51 | string.m_string.assign(begin, end); 52 | return string; 53 | } 54 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Network/SocketHandle.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SOCKETHANDLE_HPP 26 | #define SFML_SOCKETHANDLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | #if defined(SFML_SYSTEM_WINDOWS) 34 | #include 35 | #endif 36 | 37 | 38 | namespace sf 39 | { 40 | //////////////////////////////////////////////////////////// 41 | // Define the low-level socket handle type, specific to 42 | // each platform 43 | //////////////////////////////////////////////////////////// 44 | #if defined(SFML_SYSTEM_WINDOWS) 45 | 46 | typedef UINT_PTR SocketHandle; 47 | 48 | #else 49 | 50 | typedef int SocketHandle; 51 | 52 | #endif 53 | 54 | } // namespace sf 55 | 56 | 57 | #endif // SFML_SOCKETHANDLE_HPP 58 | -------------------------------------------------------------------------------- /vendor/sfml/readme.md: -------------------------------------------------------------------------------- 1 | [![SFML logo](https://www.sfml-dev.org/images/logo.png)](https://www.sfml-dev.org) 2 | 3 | # SFML — Simple and Fast Multimedia Library 4 | 5 | SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python. 6 | 7 | ## Authors 8 | 9 | - Laurent Gomila — main developer (laurent@sfml-dev.org) 10 | - Marco Antognini — OS X developer (hiura@sfml-dev.org) 11 | - Jonathan De Wachter — Android developer (dewachter.jonathan@gmail.com) 12 | - Jan Haller (bromeon@sfml-dev.org) 13 | - Stefan Schindler (tank@sfml-dev.org) 14 | - Lukas Dürrenberger (eXpl0it3r@sfml-dev.org) 15 | - binary1248 (binary1248@hotmail.com) 16 | - Artur Moreira (artturmoreira@gmail.com) 17 | - Mario Liebisch (mario@sfml-dev.org) 18 | - And many other members of the SFML community 19 | 20 | ## Download 21 | 22 | You can get the latest official release on [SFML's website](https://www.sfml-dev.org/download.php). You can also get the current development version from the [Git repository](https://github.com/SFML/SFML). 23 | 24 | ## Install 25 | 26 | Follow the instructions of the [tutorials](https://www.sfml-dev.org/tutorials/), there is one for each platform/compiler that SFML supports. 27 | 28 | ## Learn 29 | 30 | There are several places to learn SFML: 31 | 32 | * The [official tutorials](https://www.sfml-dev.org/tutorials/) 33 | * The [online API documentation](https://www.sfml-dev.org/documentation/) 34 | * The [community wiki](https://github.com/SFML/SFML/wiki/) 35 | * The [community forum](https://en.sfml-dev.org/forums/) ([French](https://fr.sfml-dev.org/forums/)) 36 | 37 | ## Contribute 38 | 39 | SFML is an open-source project, and it needs your help to go on growing and improving. If you want to get involved and suggest some additional features, file a bug report or submit a patch, please have a look at the [contribution guidelines](https://www.sfml-dev.org/contribute.php). 40 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Sleep.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SLEEP_HPP 26 | #define SFML_SLEEP_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \ingroup system 39 | /// \brief Make the current thread sleep for a given duration 40 | /// 41 | /// sf::sleep is the best way to block a program or one of its 42 | /// threads, as it doesn't consume any CPU power. 43 | /// 44 | /// \param duration Time to sleep 45 | /// 46 | //////////////////////////////////////////////////////////// 47 | void SFML_SYSTEM_API sleep(Time duration); 48 | 49 | } // namespace sf 50 | 51 | 52 | #endif // SFML_SLEEP_HPP 53 | -------------------------------------------------------------------------------- /Widgets/WidgetWindowCapture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Widgets/Widget.h" 3 | 4 | class GuiSystem; 5 | class GuiElement; 6 | class GuiImage; 7 | class GuiText; 8 | class WindowCapturer; 9 | 10 | class WidgetWindowCapture final : public Widget 11 | { 12 | enum GuiElementIndex : size_t 13 | { 14 | CEI_Pin = 0U, 15 | CEI_Close, 16 | CEI_Previous, 17 | CEI_Next, 18 | CEI_Update, 19 | CEI_FPS, 20 | 21 | CEI_Count 22 | }; 23 | enum FpsMode : size_t 24 | { 25 | FM_15 = 0U, 26 | FM_30, 27 | FM_60, 28 | 29 | FM_Count 30 | }; 31 | 32 | VROverlay *m_overlayBackground; 33 | VROverlay *m_overlayControls; 34 | 35 | GuiSystem *m_guiSystem; 36 | GuiImage *m_guiImages[CEI_Count]; 37 | GuiText *m_guiTextWindow; 38 | 39 | static sf::Texture *ms_textureAtlas; 40 | 41 | WindowCapturer *m_windowCapturer; 42 | size_t m_windowIndex; 43 | #ifdef __linux__ 44 | static Display *ms_display; 45 | #endif 46 | 47 | unsigned long long m_lastLeftTriggerTick; 48 | unsigned long long m_lastRightTriggerTick; 49 | 50 | bool m_activeMove; 51 | bool m_activeResize; 52 | bool m_activePin; 53 | 54 | float m_windowRatio; 55 | glm::ivec2 m_mousePosition; 56 | 57 | size_t m_fpsMode; 58 | 59 | WidgetWindowCapture(const WidgetWindowCapture &that) = delete; 60 | WidgetWindowCapture& operator=(const WidgetWindowCapture &that) = delete; 61 | 62 | void StartCapture(); 63 | 64 | void OnGuiElementMouseClick(GuiElement *f_guiElement, unsigned char f_button, unsigned char f_state); 65 | 66 | // Widget 67 | bool Create(); 68 | void Destroy() override; 69 | void Update(); 70 | void OnButtonPress(size_t f_hand, uint32_t f_button) override; 71 | void OnButtonRelease(size_t f_hand, uint32_t f_button) override; 72 | void OnDashboardOpen() override; 73 | void OnDashboardClose() override; 74 | public: 75 | WidgetWindowCapture(); 76 | ~WidgetWindowCapture(); 77 | 78 | static void InitStaticResources(); 79 | static void RemoveStaticResources(); 80 | }; 81 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Window/WindowStyle.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_WINDOWSTYLE_HPP 26 | #define SFML_WINDOWSTYLE_HPP 27 | 28 | 29 | namespace sf 30 | { 31 | namespace Style 32 | { 33 | //////////////////////////////////////////////////////////// 34 | /// \ingroup window 35 | /// \brief Enumeration of the window styles 36 | /// 37 | //////////////////////////////////////////////////////////// 38 | enum 39 | { 40 | None = 0, ///< No border / title bar (this flag and all others are mutually exclusive) 41 | Titlebar = 1 << 0, ///< Title bar + fixed border 42 | Resize = 1 << 1, ///< Title bar + resizable border + maximize button 43 | Close = 1 << 2, ///< Title bar + close button 44 | Fullscreen = 1 << 3, ///< Fullscreen mode (this flag and all others are mutually exclusive) 45 | 46 | Default = Titlebar | Resize | Close ///< Default window style 47 | }; 48 | } 49 | 50 | } // namespace sf 51 | 52 | 53 | #endif // SFML_WINDOWSTYLE_HPP 54 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Network.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NETWORK_HPP 26 | #define SFML_NETWORK_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | 45 | #endif // SFML_NETWORK_HPP 46 | 47 | //////////////////////////////////////////////////////////// 48 | /// \defgroup network Network module 49 | /// 50 | /// Socket-based communication, utilities and higher-level 51 | /// network protocols (HTTP, FTP). 52 | /// 53 | //////////////////////////////////////////////////////////// 54 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Audio.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_AUDIO_HPP 26 | #define SFML_AUDIO_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | 48 | #endif // SFML_AUDIO_HPP 49 | 50 | //////////////////////////////////////////////////////////// 51 | /// \defgroup audio Audio module 52 | /// 53 | /// Sounds, streaming (musics or custom sources), recording, 54 | /// spatialization. 55 | /// 56 | //////////////////////////////////////////////////////////// 57 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Window.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SFML_WINDOW_HPP 26 | #define SFML_SFML_WINDOW_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | 49 | 50 | #endif // SFML_SFML_WINDOW_HPP 51 | 52 | //////////////////////////////////////////////////////////// 53 | /// \defgroup window Window module 54 | /// 55 | /// Provides OpenGL-based windows, and abstractions for 56 | /// events and input handling. 57 | /// 58 | //////////////////////////////////////////////////////////// 59 | -------------------------------------------------------------------------------- /Gui/GuiElement.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class GuiElement 4 | { 5 | bool m_visible; 6 | bool m_interactable; 7 | 8 | void *m_userPointer; 9 | 10 | std::function m_mouseClickCallback; 11 | std::function m_mouseMoveCallback; 12 | 13 | GuiElement(const GuiElement &that) = delete; 14 | GuiElement& operator=(const GuiElement &that) = delete; 15 | public: 16 | virtual ~GuiElement(); 17 | 18 | void SetPosition(const sf::Vector2f &f_pos); 19 | const sf::Vector2f& GetPosition() const; 20 | 21 | void SetSize(const sf::Vector2f &f_size); 22 | const sf::Vector2f& GetSize() const; 23 | 24 | void SetVisibility(bool f_state); 25 | bool GetVisibility() const; 26 | 27 | void SetColor(const sf::Color &f_color); 28 | void SetSelectionColor(const sf::Color &f_color); 29 | 30 | void SetUserPointer(void *f_pointer); 31 | void* GetUserPointer() const; 32 | 33 | const std::vector& GetDrawables() const; 34 | 35 | void SetClickCallback(const std::function &f_callback); 36 | void RemoveClickCallback(); 37 | void ProcessClick(unsigned char f_button, unsigned char f_state, unsigned int f_mouseX, unsigned f_mouseY); 38 | 39 | void SetMoveCallback(const std::function &f_callback); 40 | void RemoveMoveCallback(); 41 | void ProcessMove(unsigned int f_mouseX, unsigned f_mouseY); 42 | 43 | virtual void Update(); 44 | protected: 45 | std::vector m_drawables; 46 | 47 | sf::Vector2f m_position; 48 | sf::Vector2f m_size; 49 | sf::Color m_selectionColor; 50 | sf::Color m_color; 51 | bool m_activeHover; 52 | bool m_update; 53 | 54 | GuiElement(); 55 | 56 | // Internal methods for subclasses 57 | virtual void ProcessFocusInternal(unsigned int f_mouseX, unsigned int f_mouseY); 58 | virtual void ProcessBlurInternal(unsigned int f_mouseX, unsigned int f_mouseY); 59 | virtual void ProcessClickInternal(unsigned char f_button, unsigned char f_state, unsigned int f_mouseX, unsigned int f_mouseY); 60 | virtual void ProcessMoveInternal(unsigned int f_mouseX, unsigned int f_mouseY); 61 | }; 62 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/NativeActivity.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NATIVEACTIVITY_HPP 26 | #define SFML_NATIVEACTIVITY_HPP 27 | 28 | 29 | //////////////////////////////////////////////////////////// 30 | // Headers 31 | //////////////////////////////////////////////////////////// 32 | #include 33 | 34 | 35 | #if !defined(SFML_SYSTEM_ANDROID) 36 | #error NativeActivity.hpp: This header is Android only. 37 | #endif 38 | 39 | 40 | struct ANativeActivity; 41 | 42 | namespace sf 43 | { 44 | //////////////////////////////////////////////////////////// 45 | /// \ingroup system 46 | /// \brief Return a pointer to the Android native activity 47 | /// 48 | /// You shouldn't have to use this function, unless you want 49 | /// to implement very specific details, that SFML doesn't 50 | /// support, or to use a workaround for a known issue. 51 | /// 52 | /// \return Pointer to Android native activity structure 53 | /// 54 | /// \sfplatform{Android,SFML/System/NativeActivity.hpp} 55 | /// 56 | //////////////////////////////////////////////////////////// 57 | SFML_SYSTEM_API ANativeActivity* getNativeActivity(); 58 | 59 | } // namespace sf 60 | 61 | 62 | #endif // SFML_NATIVEACTIVITY_HPP 63 | -------------------------------------------------------------------------------- /Gui/GuiButton.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Gui/GuiButton.h" 4 | 5 | GuiButton::GuiButton(const sf::Font *f_font) 6 | { 7 | m_fontText = new sf::Text("", *f_font, 14U); 8 | m_background = new sf::RectangleShape(); 9 | m_size = { 64.f, 64.f }; 10 | m_backgroundColor = { 127U, 127U, 127U, 255U }; 11 | 12 | m_drawables.push_back(m_background); 13 | m_drawables.push_back(m_fontText); 14 | } 15 | GuiButton::~GuiButton() 16 | { 17 | delete m_fontText; 18 | delete m_background; 19 | } 20 | 21 | void GuiButton::SetText(const char *f_string) 22 | { 23 | m_fontText->setString(f_string); 24 | m_update = true; 25 | } 26 | void GuiButton::SetText(const wchar_t *f_string) 27 | { 28 | m_fontText->setString(f_string); 29 | m_update = true; 30 | } 31 | void GuiButton::SetText(const std::string &f_string) 32 | { 33 | m_fontText->setString(f_string); 34 | m_update = true; 35 | } 36 | void GuiButton::SetText(const std::wstring &f_string) 37 | { 38 | m_fontText->setString(f_string); 39 | m_update = true; 40 | } 41 | 42 | void GuiButton::SetTextSize(unsigned int f_size) 43 | { 44 | m_fontText->setCharacterSize(f_size); 45 | m_update = true; 46 | } 47 | 48 | void GuiButton::SetBackgroundColor(const sf::Color &f_color) 49 | { 50 | if(m_backgroundColor != f_color) 51 | { 52 | m_backgroundColor = f_color; 53 | m_update = true; 54 | } 55 | } 56 | 57 | void GuiButton::ProcessFocusInternal(unsigned int f_mouseX, unsigned int f_mouseY) 58 | { 59 | m_background->setFillColor(m_selectionColor); 60 | 61 | GuiElement::ProcessFocusInternal(f_mouseX, f_mouseY); 62 | } 63 | void GuiButton::ProcessBlurInternal(unsigned int f_mouseX, unsigned int f_mouseY) 64 | { 65 | m_background->setFillColor(m_backgroundColor); 66 | 67 | GuiElement::ProcessBlurInternal(f_mouseX, f_mouseY); 68 | } 69 | 70 | void GuiButton::Update() 71 | { 72 | if(m_update) 73 | { 74 | m_background->setPosition(m_position); 75 | m_background->setSize(m_size); 76 | m_background->setFillColor(m_activeHover ? m_selectionColor : m_backgroundColor); 77 | 78 | const sf::FloatRect l_bounds = m_fontText->getLocalBounds(); 79 | m_fontText->setPosition(m_position.x + (m_size.x - l_bounds.width)*0.5f, m_position.y + (m_size.y - l_bounds.height)*0.5f); 80 | m_fontText->setFillColor(m_color); 81 | } 82 | 83 | GuiElement::Update(); 84 | } 85 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SYSTEM_HPP 26 | #define SFML_SYSTEM_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #endif // SFML_SYSTEM_HPP 52 | 53 | //////////////////////////////////////////////////////////// 54 | /// \defgroup system System module 55 | /// 56 | /// Base module of SFML, defining various utilities. It provides 57 | /// vector classes, Unicode strings and conversion functions, 58 | /// threads and mutexes, timing classes. 59 | /// 60 | //////////////////////////////////////////////////////////// 61 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/ThreadLocalPtr.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | 26 | namespace sf 27 | { 28 | //////////////////////////////////////////////////////////// 29 | template 30 | ThreadLocalPtr::ThreadLocalPtr(T* value) : 31 | ThreadLocal(value) 32 | { 33 | } 34 | 35 | 36 | //////////////////////////////////////////////////////////// 37 | template 38 | T& ThreadLocalPtr::operator *() const 39 | { 40 | return *static_cast(getValue()); 41 | } 42 | 43 | 44 | //////////////////////////////////////////////////////////// 45 | template 46 | T* ThreadLocalPtr::operator ->() const 47 | { 48 | return static_cast(getValue()); 49 | } 50 | 51 | 52 | //////////////////////////////////////////////////////////// 53 | template 54 | ThreadLocalPtr::operator T*() const 55 | { 56 | return static_cast(getValue()); 57 | } 58 | 59 | 60 | //////////////////////////////////////////////////////////// 61 | template 62 | ThreadLocalPtr& ThreadLocalPtr::operator =(T* value) 63 | { 64 | setValue(value); 65 | return *this; 66 | } 67 | 68 | 69 | //////////////////////////////////////////////////////////// 70 | template 71 | ThreadLocalPtr& ThreadLocalPtr::operator =(const ThreadLocalPtr& right) 72 | { 73 | setValue(right.getValue()); 74 | return *this; 75 | } 76 | 77 | } // namespace sf 78 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Audio/AlResource.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_ALRESOURCE_HPP 26 | #define SFML_ALRESOURCE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | namespace sf 35 | { 36 | //////////////////////////////////////////////////////////// 37 | /// \brief Base class for classes that require an OpenAL context 38 | /// 39 | //////////////////////////////////////////////////////////// 40 | class SFML_AUDIO_API AlResource 41 | { 42 | protected: 43 | 44 | //////////////////////////////////////////////////////////// 45 | /// \brief Default constructor 46 | /// 47 | //////////////////////////////////////////////////////////// 48 | AlResource(); 49 | 50 | //////////////////////////////////////////////////////////// 51 | /// \brief Destructor 52 | /// 53 | //////////////////////////////////////////////////////////// 54 | ~AlResource(); 55 | }; 56 | 57 | } // namespace sf 58 | 59 | 60 | #endif // SFML_ALRESOURCE_HPP 61 | 62 | //////////////////////////////////////////////////////////// 63 | /// \class sf::AlResource 64 | /// \ingroup audio 65 | /// 66 | /// This class is for internal use only, it must be the base 67 | /// of every class that requires a valid OpenAL context in 68 | /// order to work. 69 | /// 70 | //////////////////////////////////////////////////////////// 71 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Graphics/PrimitiveType.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_PRIMITIVETYPE_HPP 26 | #define SFML_PRIMITIVETYPE_HPP 27 | 28 | namespace sf 29 | { 30 | //////////////////////////////////////////////////////////// 31 | /// \ingroup graphics 32 | /// \brief Types of primitives that a sf::VertexArray can render 33 | /// 34 | /// Points and lines have no area, therefore their thickness 35 | /// will always be 1 pixel, regardless the current transform 36 | /// and view. 37 | /// 38 | //////////////////////////////////////////////////////////// 39 | enum PrimitiveType 40 | { 41 | Points, ///< List of individual points 42 | Lines, ///< List of individual lines 43 | LineStrip, ///< List of connected lines, a point uses the previous point to form a line 44 | Triangles, ///< List of individual triangles 45 | TriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle 46 | TriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle 47 | Quads, ///< List of individual quads (deprecated, don't work with OpenGL ES) 48 | 49 | // Deprecated names 50 | LinesStrip = LineStrip, ///< \deprecated Use LineStrip instead 51 | TrianglesStrip = TriangleStrip, ///< \deprecated Use TriangleStrip instead 52 | TrianglesFan = TriangleFan ///< \deprecated Use TriangleFan instead 53 | }; 54 | 55 | } // namespace sf 56 | 57 | 58 | #endif // SFML_PRIMITIVETYPE_HPP 59 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/OpenGL.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_OPENGL_HPP 26 | #define SFML_OPENGL_HPP 27 | 28 | 29 | //////////////////////////////////////////////////////////// 30 | /// Headers 31 | //////////////////////////////////////////////////////////// 32 | #include 33 | 34 | 35 | //////////////////////////////////////////////////////////// 36 | /// This file just includes the OpenGL headers, 37 | /// which have actually different paths on each system 38 | //////////////////////////////////////////////////////////// 39 | #if defined(SFML_SYSTEM_WINDOWS) 40 | 41 | // The Visual C++ version of gl.h uses WINGDIAPI and APIENTRY but doesn't define them 42 | #ifdef _MSC_VER 43 | #include 44 | #endif 45 | 46 | #include 47 | 48 | #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) 49 | 50 | #if defined(SFML_OPENGL_ES) 51 | #include 52 | #include 53 | #else 54 | #include 55 | #endif 56 | 57 | #elif defined(SFML_SYSTEM_MACOS) 58 | 59 | #include 60 | 61 | #elif defined (SFML_SYSTEM_IOS) 62 | 63 | #include 64 | #include 65 | 66 | #elif defined (SFML_SYSTEM_ANDROID) 67 | 68 | #include 69 | #include 70 | 71 | // We're not using OpenGL ES 2+ yet, but we can use the sRGB extension 72 | #include 73 | #include 74 | 75 | #endif 76 | 77 | 78 | #endif // SFML_OPENGL_HPP 79 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Graphics.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GRAPHICS_HPP 26 | #define SFML_GRAPHICS_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | 60 | 61 | #endif // SFML_GRAPHICS_HPP 62 | 63 | //////////////////////////////////////////////////////////// 64 | /// \defgroup graphics Graphics module 65 | /// 66 | /// 2D graphics module: sprites, text, shapes, ... 67 | /// 68 | //////////////////////////////////////////////////////////// 69 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/GpuPreference.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GPUPREFERENCE_HPP 26 | #define SFML_GPUPREFERENCE_HPP 27 | 28 | 29 | //////////////////////////////////////////////////////////// 30 | /// Headers 31 | //////////////////////////////////////////////////////////// 32 | #include 33 | 34 | 35 | //////////////////////////////////////////////////////////// 36 | /// \file 37 | /// 38 | /// \brief File containing SFML_DEFINE_DISCRETE_GPU_PREFERENCE 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | 42 | 43 | //////////////////////////////////////////////////////////// 44 | /// \def SFML_DEFINE_DISCRETE_GPU_PREFERENCE 45 | /// 46 | /// \brief A macro to encourage usage of the discrete GPU 47 | /// 48 | /// In order to inform the Nvidia/AMD driver that an SFML 49 | /// application could benefit from using the more powerful 50 | /// discrete GPU, special symbols have to be publicly 51 | /// exported from the final executable. 52 | /// 53 | /// SFML defines a helper macro to easily do this. 54 | /// 55 | /// Place SFML_DEFINE_DISCRETE_GPU_PREFERENCE in the 56 | /// global scope of a source file that will be linked into 57 | /// the final executable. Typically it is best to place it 58 | /// where the main function is also defined. 59 | /// 60 | //////////////////////////////////////////////////////////// 61 | #if defined(SFML_SYSTEM_WINDOWS) 62 | 63 | #define SFML_DEFINE_DISCRETE_GPU_PREFERENCE \ 64 | extern "C" __declspec(dllexport) unsigned long NvOptimusEnablement = 1; \ 65 | extern "C" __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 1; 66 | 67 | #else 68 | 69 | #define SFML_DEFINE_DISCRETE_GPU_PREFERENCE 70 | 71 | #endif 72 | 73 | 74 | #endif // SFML_GPUPREFERENCE_HPP 75 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Err.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_ERR_HPP 26 | #define SFML_ERR_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Standard stream used by SFML to output warnings and errors 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | SFML_SYSTEM_API std::ostream& err(); 42 | 43 | } // namespace sf 44 | 45 | 46 | #endif // SFML_ERR_HPP 47 | 48 | 49 | //////////////////////////////////////////////////////////// 50 | /// \fn sf::err 51 | /// \ingroup system 52 | /// 53 | /// By default, sf::err() outputs to the same location as std::cerr, 54 | /// (-> the stderr descriptor) which is the console if there's 55 | /// one available. 56 | /// 57 | /// It is a standard std::ostream instance, so it supports all the 58 | /// insertion operations defined by the STL 59 | /// (operator <<, manipulators, etc.). 60 | /// 61 | /// sf::err() can be redirected to write to another output, independently 62 | /// of std::cerr, by using the rdbuf() function provided by the 63 | /// std::ostream class. 64 | /// 65 | /// Example: 66 | /// \code 67 | /// // Redirect to a file 68 | /// std::ofstream file("sfml-log.txt"); 69 | /// std::streambuf* previous = sf::err().rdbuf(file.rdbuf()); 70 | /// 71 | /// // Redirect to nothing 72 | /// sf::err().rdbuf(NULL); 73 | /// 74 | /// // Restore the original output 75 | /// sf::err().rdbuf(previous); 76 | /// \endcode 77 | /// 78 | /// \return Reference to std::ostream representing the SFML error stream 79 | /// 80 | //////////////////////////////////////////////////////////// 81 | -------------------------------------------------------------------------------- /Gui/GuiSystem.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Gui/GuiSystem.h" 4 | #include "Gui/GuiButton.h" 5 | #include "Gui/GuiImage.h" 6 | #include "Gui/GuiText.h" 7 | #include "Utils/TexturePooler.h" 8 | 9 | extern const sf::Color g_clearColor; 10 | extern const unsigned char g_dummyTextureData[]; 11 | 12 | GuiSystem::GuiSystem(const sf::Vector2u &f_size) 13 | { 14 | m_renderTexture = TexturePooler::CreateRenderTexture(f_size.x, f_size.y); 15 | m_mainFont = new sf::Font(); 16 | } 17 | GuiSystem::~GuiSystem() 18 | { 19 | for(auto l_element : m_guiElements) delete l_element; 20 | m_guiElements.clear(); 21 | 22 | if(m_renderTexture) TexturePooler::DeleteRenderTexture(m_renderTexture); 23 | } 24 | 25 | void GuiSystem::SetFont(const std::string &f_path) 26 | { 27 | m_mainFont->loadFromFile(f_path); 28 | } 29 | 30 | GuiButton* GuiSystem::CreateButton() 31 | { 32 | GuiButton *l_button = new GuiButton(m_mainFont); 33 | m_guiElements.push_back(l_button); 34 | return l_button; 35 | } 36 | 37 | GuiImage* GuiSystem::CreateImage(const sf::Texture *f_texture) 38 | { 39 | GuiImage *l_image = new GuiImage(f_texture); 40 | m_guiElements.push_back(l_image); 41 | return l_image; 42 | } 43 | 44 | GuiText* GuiSystem::CreateText() 45 | { 46 | GuiText *l_text = new GuiText(m_mainFont); 47 | m_guiElements.push_back(l_text); 48 | return l_text; 49 | } 50 | 51 | void GuiSystem::Remove(GuiElement *f_element) 52 | { 53 | auto l_searchIter = std::find(m_guiElements.begin(), m_guiElements.end(), f_element); 54 | if(l_searchIter != m_guiElements.end()) 55 | { 56 | delete (*l_searchIter); 57 | m_guiElements.erase(l_searchIter); 58 | } 59 | } 60 | 61 | unsigned int GuiSystem::GetRenderTextureHandle() const 62 | { 63 | unsigned int l_result = 0U; 64 | if(m_renderTexture) l_result = m_renderTexture->getTexture().getNativeHandle(); 65 | return l_result; 66 | } 67 | 68 | void GuiSystem::Update() 69 | { 70 | for(auto l_element : m_guiElements) l_element->Update(); 71 | if(m_renderTexture) 72 | { 73 | if(m_renderTexture->setActive(true)) 74 | { 75 | m_renderTexture->clear(g_clearColor); 76 | 77 | for(auto l_element : m_guiElements) 78 | { 79 | if(l_element->GetVisibility()) 80 | { 81 | for(auto l_drawable : l_element->GetDrawables()) m_renderTexture->draw(*l_drawable); 82 | } 83 | } 84 | 85 | m_renderTexture->display(); 86 | m_renderTexture->setActive(false); 87 | } 88 | } 89 | } 90 | 91 | void GuiSystem::ProcessClick(unsigned char f_button, unsigned char f_state, unsigned int f_mouseX, unsigned f_mouseY) 92 | { 93 | for(auto l_element : m_guiElements) l_element->ProcessClick(f_button, f_state, f_mouseX, f_mouseY); 94 | } 95 | void GuiSystem::ProcessMove(unsigned int f_posX, unsigned int f_posY) 96 | { 97 | for(auto l_element : m_guiElements) l_element->ProcessMove(f_posX, f_posY); 98 | } 99 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Graphics/Glyph.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GLYPH_HPP 26 | #define SFML_GLYPH_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Structure describing a glyph 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_GRAPHICS_API Glyph 42 | { 43 | public: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Default constructor 47 | /// 48 | //////////////////////////////////////////////////////////// 49 | Glyph() : advance(0) {} 50 | 51 | //////////////////////////////////////////////////////////// 52 | // Member data 53 | //////////////////////////////////////////////////////////// 54 | float advance; ///< Offset to move horizontally to the next character 55 | FloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline 56 | IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture 57 | }; 58 | 59 | } // namespace sf 60 | 61 | 62 | #endif // SFML_GLYPH_HPP 63 | 64 | 65 | //////////////////////////////////////////////////////////// 66 | /// \class sf::Glyph 67 | /// \ingroup graphics 68 | /// 69 | /// A glyph is the visual representation of a character. 70 | /// 71 | /// The sf::Glyph structure provides the information needed 72 | /// to handle the glyph: 73 | /// \li its coordinates in the font's texture 74 | /// \li its bounding rectangle 75 | /// \li the offset to apply to get the starting position of the next glyph 76 | /// 77 | /// \see sf::Font 78 | /// 79 | //////////////////////////////////////////////////////////// 80 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Thread.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | namespace priv 26 | { 27 | // Base class for abstract thread functions 28 | struct ThreadFunc 29 | { 30 | virtual ~ThreadFunc() {} 31 | virtual void run() = 0; 32 | }; 33 | 34 | // Specialization using a functor (including free functions) with no argument 35 | template 36 | struct ThreadFunctor : ThreadFunc 37 | { 38 | ThreadFunctor(T functor) : m_functor(functor) {} 39 | virtual void run() {m_functor();} 40 | T m_functor; 41 | }; 42 | 43 | // Specialization using a functor (including free functions) with one argument 44 | template 45 | struct ThreadFunctorWithArg : ThreadFunc 46 | { 47 | ThreadFunctorWithArg(F function, A arg) : m_function(function), m_arg(arg) {} 48 | virtual void run() {m_function(m_arg);} 49 | F m_function; 50 | A m_arg; 51 | }; 52 | 53 | // Specialization using a member function 54 | template 55 | struct ThreadMemberFunc : ThreadFunc 56 | { 57 | ThreadMemberFunc(void(C::*function)(), C* object) : m_function(function), m_object(object) {} 58 | virtual void run() {(m_object->*m_function)();} 59 | void(C::*m_function)(); 60 | C* m_object; 61 | }; 62 | 63 | } // namespace priv 64 | 65 | 66 | //////////////////////////////////////////////////////////// 67 | template 68 | Thread::Thread(F functor) : 69 | m_impl (NULL), 70 | m_entryPoint(new priv::ThreadFunctor(functor)) 71 | { 72 | } 73 | 74 | 75 | //////////////////////////////////////////////////////////// 76 | template 77 | Thread::Thread(F function, A argument) : 78 | m_impl (NULL), 79 | m_entryPoint(new priv::ThreadFunctorWithArg(function, argument)) 80 | { 81 | } 82 | 83 | 84 | //////////////////////////////////////////////////////////// 85 | template 86 | Thread::Thread(void(C::*function)(), C* object) : 87 | m_impl (NULL), 88 | m_entryPoint(new priv::ThreadMemberFunc(function, object)) 89 | { 90 | } 91 | -------------------------------------------------------------------------------- /Utils/Utils.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Utils/Utils.h" 4 | 5 | extern const glm::vec3 g_axisY; 6 | 7 | void ConvertMatrix(const vr::HmdMatrix34_t &f_matVR, glm::mat4 &f_mat) 8 | { 9 | for(int i = 0; i < 4; i++) 10 | { 11 | for(int j = 0; j < 3; j++) f_mat[i][j] = f_matVR.m[j][i]; 12 | } 13 | for(int i = 0; i < 3; i++) f_mat[i][3] = 0.f; 14 | f_mat[3][3] = 1.f; 15 | } 16 | void ConvertMatrix(const glm::mat4 &f_mat, vr::HmdMatrix34_t &f_matVR) 17 | { 18 | for(int i = 0; i < 3; i++) 19 | { 20 | for(int j = 0; j < 4; j++) f_matVR.m[i][j] = f_mat[j][i]; 21 | } 22 | } 23 | 24 | void GetRotationToPoint(const glm::vec3 &f_pointA, const glm::vec3 &f_pointB, const glm::quat &f_rotationA, glm::quat &f_result) 25 | { 26 | glm::vec3 l_dir = (f_pointA - f_pointB); 27 | l_dir = glm::normalize(l_dir); 28 | 29 | const glm::vec3 l_up = f_rotationA*g_axisY; 30 | glm::vec3 l_crossA = glm::cross(l_up, l_dir); 31 | l_crossA = glm::normalize(l_crossA); 32 | 33 | glm::vec3 l_crossB = glm::cross(l_dir, l_crossA); 34 | l_crossB = glm::normalize(l_crossB); 35 | 36 | const glm::mat3 l_rotMat(l_crossA, l_crossB, l_dir); 37 | f_result = l_rotMat; 38 | } 39 | 40 | size_t ReadEnumVector(const std::string &f_val, const std::vector &f_vec) 41 | { 42 | size_t l_result = std::numeric_limits::max(); 43 | for(auto iter = f_vec.begin(), iterEnd = f_vec.end(); iter != iterEnd; ++iter) 44 | { 45 | if(!iter->compare(f_val)) 46 | { 47 | l_result = std::distance(f_vec.begin(), iter); 48 | break; 49 | } 50 | } 51 | return l_result; 52 | } 53 | size_t ReadEnumVector(const char *f_val, const std::vector &f_vec) 54 | { 55 | size_t l_result = std::numeric_limits::max(); 56 | for(auto iter = f_vec.begin(), iterEnd = f_vec.end(); iter != iterEnd; ++iter) 57 | { 58 | if(!iter->compare(f_val)) 59 | { 60 | l_result = std::distance(f_vec.begin(), iter); 61 | break; 62 | } 63 | } 64 | return l_result; 65 | } 66 | 67 | void ExtractScreenCaptureImage(const SL::Screen_Capture::Image &f_img, unsigned char *f_dst, size_t f_size) 68 | { 69 | #ifdef _DEBUG 70 | assert(f_size >= static_cast(SL::Screen_Capture::Width(f_img) * SL::Screen_Capture::Height(f_img) * sizeof(SL::Screen_Capture::ImageBGRA))); 71 | #endif 72 | unsigned char *l_startDst = f_dst; 73 | const SL::Screen_Capture::ImageBGRA *l_startSrc = SL::Screen_Capture::StartSrc(f_img); 74 | if(SL::Screen_Capture::isDataContiguous(f_img)) std::memcpy(l_startDst, l_startSrc, f_size); 75 | else 76 | { 77 | const size_t l_lineSize = sizeof(SL::Screen_Capture::ImageBGRA) * SL::Screen_Capture::Width(f_img); 78 | for(int i = 0, j = SL::Screen_Capture::Height(f_img); i < j; i++) 79 | { 80 | std::memcpy(l_startDst, l_startSrc, l_lineSize); 81 | l_startDst += l_lineSize; 82 | l_startSrc = SL::Screen_Capture::GotoNextRow(f_img, l_startSrc); 83 | } 84 | } 85 | } 86 | 87 | #ifdef __linux__ 88 | unsigned long long GetTickCount64() 89 | { 90 | struct timespec l_ts; 91 | clock_gettime(CLOCK_MONOTONIC, &l_ts); 92 | return (uint64_t)(l_ts.tv_nsec / 1000000) + ((uint64_t)l_ts.tv_sec * 1000ull); 93 | } 94 | #endif 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenVR Widgets [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 2 | Set of simple overlay widgets for usage in SteamVR environment. 3 | Application supports Windows 7, 8, 8.1, 10 and Linux (in experimental stage). 4 | 5 | # Installation 6 | * Grab latest [release](../../releases/latest) for your platform. 7 | * Extract archive to your preferable folder. 8 | * Launch `openvr_widgets` binary. 9 | 10 | # Settings 11 | Editing `settings.xml` allows to make few own changes to widgets. 12 | * **target_rate** - application FPS update rate. Available values: 60, 90, 120, 144. Default value is 60. Adviced to use corresponding menu item in `Settings` of dashboard overlay. 13 | * **gui_font** - font that will be used for text. Default value is `fonts/Hack-Regular.ttf`. Refer to [Hack font repository](../../../../source-foundry/Hack). 14 | * **keyboard_layout** - path to keyboard layout file for keyboard widgets. 15 | 16 | # Stats overlay widget 17 | * **Activation:** Double press on grip button of right hand controller. 18 | * **Behaviour:** Follows right hand controller, transparency changes according to view angle on controller. 19 | * **Features:** Shows current system time, CPU load, RAM usage, current FPS in game and VR compositor, controllers charge, trackers charge. Cycle through stats with trigger button while overlay is visible. 20 | * **Deactivation:** Release grip button of right hand controller. 21 | * **Notes:** 22 | * CPU load isn't always accurate. 23 | * FPS info is calcuated based on latest VR frame info that isn't always accurate. 24 | 25 | # Windows capture overlay widget 26 | * **Activation:** Press `OpenVR Widgets - Widgets - Window capture widget` menu item in dashboard. 27 | * **Behaviour:** Captures selected visible system window. 28 | * **Features:** 29 | * **Movement:** Double press on trigger button of left hand at the center of overlay to attach it to your hand. Double press again to detach. 30 | * **Resize:** While overlay is attached to hand, bring right hand controller closely to overlay and double press trigger button. Move your right hand controller to adjust preferable size. Let go trigger button on your right hand controller to stop resizing. 31 | * **Controls:** Bring SteamVR dashboard to make control buttons appear. 32 | * **Pin/unpin:** Pin/unpin widget to prevent interactions outside of SteamVR dashboard. 33 | * **Close:** Close current capture widget. 34 | * **Left:** Cycle window to left. 35 | * **Right:** Cycle window to right. 36 | * **Update:** Update list of windows. Helpful when new window has appeared or old has been destroyed. 37 | * **FPS:** Changes captured FPS rate. 38 | * **Interaction:** You can interact with captured window using trigger as click and touchpad as scroll. 39 | * **Notes:** 40 | * Not all active and non-active windows accept click and scroll messages sent via Windows API. 41 | * Latest version of capture library has degraded performance, only single existing capture widget can provide 60 FPS update rate. 42 | * Input interaction on Linux isn't implemented yet 43 | 44 | # Keyboard overlay widget 45 | * **Activation:** Press `Add keyboard widget` in dashboard menu `OpenVR Widgets - Settings`. 46 | * **Behaviour:** Emulates global keyboard input. 47 | * **Interaction:** Point to desired key and press trigger button. 48 | * **Notes:** Widget is in experimental state and can be changed in future. Input on Linux isn't implemented yet. 49 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Audio/SoundFileFactory.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | //////////////////////////////////////////////////////////// 26 | // Headers 27 | //////////////////////////////////////////////////////////// 28 | 29 | 30 | namespace sf 31 | { 32 | namespace priv 33 | { 34 | template SoundFileReader* createReader() {return new T;} 35 | template SoundFileWriter* createWriter() {return new T;} 36 | } 37 | 38 | //////////////////////////////////////////////////////////// 39 | template 40 | void SoundFileFactory::registerReader() 41 | { 42 | // Make sure the same class won't be registered twice 43 | unregisterReader(); 44 | 45 | // Create a new factory with the functions provided by the class 46 | ReaderFactory factory; 47 | factory.check = &T::check; 48 | factory.create = &priv::createReader; 49 | 50 | // Add it 51 | s_readers.push_back(factory); 52 | } 53 | 54 | 55 | //////////////////////////////////////////////////////////// 56 | template 57 | void SoundFileFactory::unregisterReader() 58 | { 59 | // Remove the instance(s) of the reader from the array of factories 60 | for (ReaderFactoryArray::iterator it = s_readers.begin(); it != s_readers.end(); ) 61 | { 62 | if (it->create == &priv::createReader) 63 | it = s_readers.erase(it); 64 | else 65 | ++it; 66 | } 67 | } 68 | 69 | //////////////////////////////////////////////////////////// 70 | template 71 | void SoundFileFactory::registerWriter() 72 | { 73 | // Make sure the same class won't be registered twice 74 | unregisterWriter(); 75 | 76 | // Create a new factory with the functions provided by the class 77 | WriterFactory factory; 78 | factory.check = &T::check; 79 | factory.create = &priv::createWriter; 80 | 81 | // Add it 82 | s_writers.push_back(factory); 83 | } 84 | 85 | 86 | //////////////////////////////////////////////////////////// 87 | template 88 | void SoundFileFactory::unregisterWriter() 89 | { 90 | // Remove the instance(s) of the writer from the array of factories 91 | for (WriterFactoryArray::iterator it = s_writers.begin(); it != s_writers.end(); ) 92 | { 93 | if (it->create == &priv::createWriter) 94 | it = s_writers.erase(it); 95 | else 96 | ++it; 97 | } 98 | } 99 | 100 | } // namespace sf 101 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Window/WindowHandle.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_WINDOWHANDLE_HPP 26 | #define SFML_WINDOWHANDLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | // Windows' HWND is a typedef on struct HWND__* 34 | #if defined(SFML_SYSTEM_WINDOWS) 35 | struct HWND__; 36 | #endif 37 | 38 | namespace sf 39 | { 40 | #if defined(SFML_SYSTEM_WINDOWS) 41 | 42 | // Window handle is HWND (HWND__*) on Windows 43 | typedef HWND__* WindowHandle; 44 | 45 | #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) 46 | 47 | // Window handle is Window (unsigned long) on Unix - X11 48 | typedef unsigned long WindowHandle; 49 | 50 | #elif defined(SFML_SYSTEM_MACOS) 51 | 52 | // Window handle is NSWindow or NSView (void*) on Mac OS X - Cocoa 53 | typedef void* WindowHandle; 54 | 55 | #elif defined(SFML_SYSTEM_IOS) 56 | 57 | // Window handle is UIWindow (void*) on iOS - UIKit 58 | typedef void* WindowHandle; 59 | 60 | #elif defined(SFML_SYSTEM_ANDROID) 61 | 62 | // Window handle is ANativeWindow* (void*) on Android 63 | typedef void* WindowHandle; 64 | 65 | #elif defined(SFML_DOXYGEN) 66 | 67 | // Define typedef symbol so that Doxygen can attach some documentation to it 68 | typedef "platform-specific" WindowHandle; 69 | 70 | #endif 71 | 72 | } // namespace sf 73 | 74 | 75 | #endif // SFML_WINDOWHANDLE_HPP 76 | 77 | //////////////////////////////////////////////////////////// 78 | /// \typedef sf::WindowHandle 79 | /// \ingroup window 80 | /// 81 | /// Define a low-level window handle type, specific to 82 | /// each platform. 83 | /// 84 | /// Platform | Type 85 | /// ----------------|------------------------------------------------------------ 86 | /// Windows | \p HWND 87 | /// Linux/FreeBSD | \p %Window 88 | /// Mac OS X | either \p NSWindow* or \p NSView*, disguised as \p void* 89 | /// iOS | \p UIWindow* 90 | /// Android | \p ANativeWindow* 91 | /// 92 | /// \par Mac OS X Specification 93 | /// 94 | /// On Mac OS X, a sf::Window can be created either from an 95 | /// existing \p NSWindow* or an \p NSView*. When the window 96 | /// is created from a window, SFML will use its content view 97 | /// as the OpenGL area. sf::Window::getSystemHandle() will 98 | /// return the handle that was used to create the window, 99 | /// which is a \p NSWindow* by default. 100 | /// 101 | //////////////////////////////////////////////////////////// 102 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/ThreadLocal.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_THREADLOCAL_HPP 26 | #define SFML_THREADLOCAL_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | namespace sf 37 | { 38 | namespace priv 39 | { 40 | class ThreadLocalImpl; 41 | } 42 | 43 | //////////////////////////////////////////////////////////// 44 | /// \brief Defines variables with thread-local storage 45 | /// 46 | //////////////////////////////////////////////////////////// 47 | class SFML_SYSTEM_API ThreadLocal : NonCopyable 48 | { 49 | public: 50 | 51 | //////////////////////////////////////////////////////////// 52 | /// \brief Default constructor 53 | /// 54 | /// \param value Optional value to initialize the variable 55 | /// 56 | //////////////////////////////////////////////////////////// 57 | ThreadLocal(void* value = NULL); 58 | 59 | //////////////////////////////////////////////////////////// 60 | /// \brief Destructor 61 | /// 62 | //////////////////////////////////////////////////////////// 63 | ~ThreadLocal(); 64 | 65 | //////////////////////////////////////////////////////////// 66 | /// \brief Set the thread-specific value of the variable 67 | /// 68 | /// \param value Value of the variable for the current thread 69 | /// 70 | //////////////////////////////////////////////////////////// 71 | void setValue(void* value); 72 | 73 | //////////////////////////////////////////////////////////// 74 | /// \brief Retrieve the thread-specific value of the variable 75 | /// 76 | /// \return Value of the variable for the current thread 77 | /// 78 | //////////////////////////////////////////////////////////// 79 | void* getValue() const; 80 | 81 | private: 82 | 83 | //////////////////////////////////////////////////////////// 84 | // Member data 85 | //////////////////////////////////////////////////////////// 86 | priv::ThreadLocalImpl* m_impl; ///< Pointer to the OS specific implementation 87 | }; 88 | 89 | } // namespace sf 90 | 91 | 92 | #endif // SFML_THREADLOCAL_HPP 93 | 94 | 95 | //////////////////////////////////////////////////////////// 96 | /// \class sf::ThreadLocal 97 | /// \ingroup system 98 | /// 99 | /// This class manipulates void* parameters and thus is not 100 | /// appropriate for strongly-typed variables. You should rather 101 | /// use the sf::ThreadLocalPtr template class. 102 | /// 103 | //////////////////////////////////////////////////////////// 104 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Clock.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_CLOCK_HPP 26 | #define SFML_CLOCK_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Utility class that measures the elapsed time 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_SYSTEM_API Clock 42 | { 43 | public: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Default constructor 47 | /// 48 | /// The clock starts automatically after being constructed. 49 | /// 50 | //////////////////////////////////////////////////////////// 51 | Clock(); 52 | 53 | //////////////////////////////////////////////////////////// 54 | /// \brief Get the elapsed time 55 | /// 56 | /// This function returns the time elapsed since the last call 57 | /// to restart() (or the construction of the instance if restart() 58 | /// has not been called). 59 | /// 60 | /// \return Time elapsed 61 | /// 62 | //////////////////////////////////////////////////////////// 63 | Time getElapsedTime() const; 64 | 65 | //////////////////////////////////////////////////////////// 66 | /// \brief Restart the clock 67 | /// 68 | /// This function puts the time counter back to zero. 69 | /// It also returns the time elapsed since the clock was started. 70 | /// 71 | /// \return Time elapsed 72 | /// 73 | //////////////////////////////////////////////////////////// 74 | Time restart(); 75 | 76 | private: 77 | 78 | //////////////////////////////////////////////////////////// 79 | // Member data 80 | //////////////////////////////////////////////////////////// 81 | Time m_startTime; ///< Time of last reset, in microseconds 82 | }; 83 | 84 | } // namespace sf 85 | 86 | 87 | #endif // SFML_CLOCK_HPP 88 | 89 | 90 | //////////////////////////////////////////////////////////// 91 | /// \class sf::Clock 92 | /// \ingroup system 93 | /// 94 | /// sf::Clock is a lightweight class for measuring time. 95 | /// 96 | /// Its provides the most precise time that the underlying 97 | /// OS can achieve (generally microseconds or nanoseconds). 98 | /// It also ensures monotonicity, which means that the returned 99 | /// time can never go backward, even if the system time is 100 | /// changed. 101 | /// 102 | /// Usage example: 103 | /// \code 104 | /// sf::Clock clock; 105 | /// ... 106 | /// Time time1 = clock.getElapsedTime(); 107 | /// ... 108 | /// Time time2 = clock.restart(); 109 | /// \endcode 110 | /// 111 | /// The sf::Time value returned by the clock can then be 112 | /// converted to a number of seconds, milliseconds or even 113 | /// microseconds. 114 | /// 115 | /// \see sf::Time 116 | /// 117 | //////////////////////////////////////////////////////////// 118 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Window/GlResource.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GLRESOURCE_HPP 26 | #define SFML_GLRESOURCE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | 38 | class Context; 39 | 40 | typedef void(*ContextDestroyCallback)(void*); 41 | 42 | //////////////////////////////////////////////////////////// 43 | /// \brief Base class for classes that require an OpenGL context 44 | /// 45 | //////////////////////////////////////////////////////////// 46 | class SFML_WINDOW_API GlResource 47 | { 48 | protected: 49 | 50 | //////////////////////////////////////////////////////////// 51 | /// \brief Default constructor 52 | /// 53 | //////////////////////////////////////////////////////////// 54 | GlResource(); 55 | 56 | //////////////////////////////////////////////////////////// 57 | /// \brief Destructor 58 | /// 59 | //////////////////////////////////////////////////////////// 60 | ~GlResource(); 61 | 62 | //////////////////////////////////////////////////////////// 63 | /// \brief Register a function to be called when a context is destroyed 64 | /// 65 | /// This is used for internal purposes in order to properly 66 | /// clean up OpenGL resources that cannot be shared between 67 | /// contexts. 68 | /// 69 | /// \param callback Function to be called when a context is destroyed 70 | /// \param arg Argument to pass when calling the function 71 | /// 72 | //////////////////////////////////////////////////////////// 73 | static void registerContextDestroyCallback(ContextDestroyCallback callback, void* arg); 74 | 75 | //////////////////////////////////////////////////////////// 76 | /// \brief RAII helper class to temporarily lock an available context for use 77 | /// 78 | //////////////////////////////////////////////////////////// 79 | class SFML_WINDOW_API TransientContextLock : NonCopyable 80 | { 81 | public: 82 | //////////////////////////////////////////////////////////// 83 | /// \brief Default constructor 84 | /// 85 | //////////////////////////////////////////////////////////// 86 | TransientContextLock(); 87 | 88 | //////////////////////////////////////////////////////////// 89 | /// \brief Destructor 90 | /// 91 | //////////////////////////////////////////////////////////// 92 | ~TransientContextLock(); 93 | }; 94 | }; 95 | 96 | } // namespace sf 97 | 98 | 99 | #endif // SFML_GLRESOURCE_HPP 100 | 101 | //////////////////////////////////////////////////////////// 102 | /// \class sf::GlResource 103 | /// \ingroup window 104 | /// 105 | /// This class is for internal use only, it must be the base 106 | /// of every class that requires a valid OpenGL context in 107 | /// order to work. 108 | /// 109 | //////////////////////////////////////////////////////////// 110 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Graphics/Drawable.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_DRAWABLE_HPP 26 | #define SFML_DRAWABLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | class RenderTarget; 38 | 39 | //////////////////////////////////////////////////////////// 40 | /// \brief Abstract base class for objects that can be drawn 41 | /// to a render target 42 | /// 43 | //////////////////////////////////////////////////////////// 44 | class SFML_GRAPHICS_API Drawable 45 | { 46 | public: 47 | 48 | //////////////////////////////////////////////////////////// 49 | /// \brief Virtual destructor 50 | /// 51 | //////////////////////////////////////////////////////////// 52 | virtual ~Drawable() {} 53 | 54 | protected: 55 | 56 | friend class RenderTarget; 57 | 58 | //////////////////////////////////////////////////////////// 59 | /// \brief Draw the object to a render target 60 | /// 61 | /// This is a pure virtual function that has to be implemented 62 | /// by the derived class to define how the drawable should be 63 | /// drawn. 64 | /// 65 | /// \param target Render target to draw to 66 | /// \param states Current render states 67 | /// 68 | //////////////////////////////////////////////////////////// 69 | virtual void draw(RenderTarget& target, RenderStates states) const = 0; 70 | }; 71 | 72 | } // namespace sf 73 | 74 | 75 | #endif // SFML_DRAWABLE_HPP 76 | 77 | 78 | //////////////////////////////////////////////////////////// 79 | /// \class sf::Drawable 80 | /// \ingroup graphics 81 | /// 82 | /// sf::Drawable is a very simple base class that allows objects 83 | /// of derived classes to be drawn to a sf::RenderTarget. 84 | /// 85 | /// All you have to do in your derived class is to override the 86 | /// draw virtual function. 87 | /// 88 | /// Note that inheriting from sf::Drawable is not mandatory, 89 | /// but it allows this nice syntax "window.draw(object)" rather 90 | /// than "object.draw(window)", which is more consistent with other 91 | /// SFML classes. 92 | /// 93 | /// Example: 94 | /// \code 95 | /// class MyDrawable : public sf::Drawable 96 | /// { 97 | /// public: 98 | /// 99 | /// ... 100 | /// 101 | /// private: 102 | /// 103 | /// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const 104 | /// { 105 | /// // You can draw other high-level objects 106 | /// target.draw(m_sprite, states); 107 | /// 108 | /// // ... or use the low-level API 109 | /// states.texture = &m_texture; 110 | /// target.draw(m_vertices, states); 111 | /// 112 | /// // ... or draw with OpenGL directly 113 | /// glBegin(GL_QUADS); 114 | /// ... 115 | /// glEnd(); 116 | /// } 117 | /// 118 | /// sf::Sprite m_sprite; 119 | /// sf::Texture m_texture; 120 | /// sf::VertexArray m_vertices; 121 | /// }; 122 | /// \endcode 123 | /// 124 | /// \see sf::RenderTarget 125 | /// 126 | //////////////////////////////////////////////////////////// 127 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Window/Clipboard.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_CLIPBOARD_HPP 26 | #define SFML_CLIPBOARD_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Give access to the system clipboard 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_WINDOW_API Clipboard 42 | { 43 | public: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Get the content of the clipboard as string data 47 | /// 48 | /// This function returns the content of the clipboard 49 | /// as a string. If the clipboard does not contain string 50 | /// it returns an empty sf::String object. 51 | /// 52 | /// \return Clipboard contents as sf::String object 53 | /// 54 | //////////////////////////////////////////////////////////// 55 | static String getString(); 56 | 57 | //////////////////////////////////////////////////////////// 58 | /// \brief Set the content of the clipboard as string data 59 | /// 60 | /// This function sets the content of the clipboard as a 61 | /// string. 62 | /// 63 | /// \warning Due to limitations on some operating systems, 64 | /// setting the clipboard contents is only 65 | /// guaranteed to work if there is currently an 66 | /// open window for which events are being handled. 67 | /// 68 | /// \param text sf::String containing the data to be sent 69 | /// to the clipboard 70 | /// 71 | //////////////////////////////////////////////////////////// 72 | static void setString(const String& text); 73 | }; 74 | 75 | } // namespace sf 76 | 77 | 78 | #endif // SFML_CLIPBOARD_HPP 79 | 80 | 81 | //////////////////////////////////////////////////////////// 82 | /// \class sf::Clipboard 83 | /// \ingroup window 84 | /// 85 | /// sf::Clipboard provides an interface for getting and 86 | /// setting the contents of the system clipboard. 87 | /// 88 | /// It is important to note that due to limitations on some 89 | /// operating systems, setting the clipboard contents is 90 | /// only guaranteed to work if there is currently an open 91 | /// window for which events are being handled. 92 | /// 93 | /// Usage example: 94 | /// \code 95 | /// // get the clipboard content as a string 96 | /// sf::String string = sf::Clipboard::getString(); 97 | /// 98 | /// // or use it in the event loop 99 | /// sf::Event event; 100 | /// while(window.pollEvent(event)) 101 | /// { 102 | /// if(event.type == sf::Event::Closed) 103 | /// window.close(); 104 | /// if(event.type == sf::Event::KeyPressed) 105 | /// { 106 | /// // Using Ctrl + V to paste a string into SFML 107 | /// if(event.key.control && event.key.code == sf::Keyboard::V) 108 | /// string = sf::Clipboard::getString(); 109 | /// 110 | /// // Using Ctrl + C to copy a string out of SFML 111 | /// if(event.key.control && event.key.code == sf::Keyboard::C) 112 | /// sf::Clipboard::setString("Hello World!"); 113 | /// } 114 | /// } 115 | /// \endcode 116 | /// 117 | /// \see sf::String, sf::Event 118 | /// 119 | //////////////////////////////////////////////////////////// 120 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Lock.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_LOCK_HPP 26 | #define SFML_LOCK_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | class Mutex; 38 | 39 | //////////////////////////////////////////////////////////// 40 | /// \brief Automatic wrapper for locking and unlocking mutexes 41 | /// 42 | //////////////////////////////////////////////////////////// 43 | class SFML_SYSTEM_API Lock : NonCopyable 44 | { 45 | public: 46 | 47 | //////////////////////////////////////////////////////////// 48 | /// \brief Construct the lock with a target mutex 49 | /// 50 | /// The mutex passed to sf::Lock is automatically locked. 51 | /// 52 | /// \param mutex Mutex to lock 53 | /// 54 | //////////////////////////////////////////////////////////// 55 | explicit Lock(Mutex& mutex); 56 | 57 | //////////////////////////////////////////////////////////// 58 | /// \brief Destructor 59 | /// 60 | /// The destructor of sf::Lock automatically unlocks its mutex. 61 | /// 62 | //////////////////////////////////////////////////////////// 63 | ~Lock(); 64 | 65 | private: 66 | 67 | //////////////////////////////////////////////////////////// 68 | // Member data 69 | //////////////////////////////////////////////////////////// 70 | Mutex& m_mutex; ///< Mutex to lock / unlock 71 | }; 72 | 73 | } // namespace sf 74 | 75 | 76 | #endif // SFML_LOCK_HPP 77 | 78 | 79 | //////////////////////////////////////////////////////////// 80 | /// \class sf::Lock 81 | /// \ingroup system 82 | /// 83 | /// sf::Lock is a RAII wrapper for sf::Mutex. By unlocking 84 | /// it in its destructor, it ensures that the mutex will 85 | /// always be released when the current scope (most likely 86 | /// a function) ends. 87 | /// This is even more important when an exception or an early 88 | /// return statement can interrupt the execution flow of the 89 | /// function. 90 | /// 91 | /// For maximum robustness, sf::Lock should always be used 92 | /// to lock/unlock a mutex. 93 | /// 94 | /// Usage example: 95 | /// \code 96 | /// sf::Mutex mutex; 97 | /// 98 | /// void function() 99 | /// { 100 | /// sf::Lock lock(mutex); // mutex is now locked 101 | /// 102 | /// functionThatMayThrowAnException(); // mutex is unlocked if this function throws 103 | /// 104 | /// if (someCondition) 105 | /// return; // mutex is unlocked 106 | /// 107 | /// } // mutex is unlocked 108 | /// \endcode 109 | /// 110 | /// Because the mutex is not explicitly unlocked in the code, 111 | /// it may remain locked longer than needed. If the region 112 | /// of the code that needs to be protected by the mutex is 113 | /// not the entire function, a good practice is to create a 114 | /// smaller, inner scope so that the lock is limited to this 115 | /// part of the code. 116 | /// 117 | /// \code 118 | /// sf::Mutex mutex; 119 | /// 120 | /// void function() 121 | /// { 122 | /// { 123 | /// sf::Lock lock(mutex); 124 | /// codeThatRequiresProtection(); 125 | /// 126 | /// } // mutex is unlocked here 127 | /// 128 | /// codeThatDoesntCareAboutTheMutex(); 129 | /// } 130 | /// \endcode 131 | /// 132 | /// Having a mutex locked longer than required is a bad practice 133 | /// which can lead to bad performances. Don't forget that when 134 | /// a mutex is locked, other threads may be waiting doing nothing 135 | /// until it is released. 136 | /// 137 | /// \see sf::Mutex 138 | /// 139 | //////////////////////////////////////////////////////////// 140 | -------------------------------------------------------------------------------- /Utils/VRDashOverlay.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Utils/VRDashOverlay.h" 4 | 5 | VRDashOverlay::VRDashOverlay() 6 | { 7 | m_handle = vr::k_ulOverlayHandleInvalid; 8 | m_handleThumb = vr::k_ulOverlayHandleInvalid; 9 | m_texture.eType = vr::TextureType_OpenGL; 10 | m_textureThumb.eType = vr::TextureType_OpenGL; 11 | m_texture.eColorSpace = vr::ColorSpace_Gamma; 12 | m_textureThumb.eColorSpace = vr::ColorSpace_Gamma; 13 | m_texture.handle = nullptr; 14 | m_textureThumb.handle = nullptr; 15 | } 16 | 17 | VRDashOverlay::~VRDashOverlay() 18 | { 19 | } 20 | 21 | bool VRDashOverlay::Create(const std::string &f_key, const std::string &f_name) 22 | { 23 | if(m_handle == vr::k_ulOverlayHandleInvalid) 24 | { 25 | vr::VROverlay()->CreateDashboardOverlay(f_key.c_str(), f_name.c_str(), &m_handle, &m_handleThumb); 26 | } 27 | return (m_handle != vr::k_ulOverlayHandleInvalid); 28 | } 29 | 30 | void VRDashOverlay::Destroy() 31 | { 32 | if(m_handle != vr::k_ulOverlayHandleInvalid) 33 | { 34 | vr::VROverlay()->ClearOverlayTexture(m_handle); 35 | vr::VROverlay()->DestroyOverlay(m_handle); 36 | m_handle = vr::k_ulOverlayHandleInvalid; 37 | m_texture.handle = nullptr; 38 | } 39 | if(m_handleThumb != vr::k_ulOverlayHandleInvalid) 40 | { 41 | vr::VROverlay()->ClearOverlayTexture(m_handleThumb); 42 | vr::VROverlay()->DestroyOverlay(m_handleThumb); 43 | m_handleThumb = vr::k_ulOverlayHandleInvalid; 44 | m_textureThumb.handle = nullptr; 45 | } 46 | } 47 | 48 | bool VRDashOverlay::IsValid() const 49 | { 50 | return ((m_handle != vr::k_ulOverlayHandleInvalid) && (m_handleThumb != vr::k_ulOverlayHandleInvalid)); 51 | } 52 | 53 | void VRDashOverlay::SetTexture(unsigned int f_name) 54 | { 55 | if(m_handle != vr::k_ulOverlayHandleInvalid) 56 | { 57 | m_texture.handle = reinterpret_cast(static_cast(f_name)); 58 | } 59 | } 60 | 61 | void VRDashOverlay::SetTexture(const std::string &f_path) 62 | { 63 | if(m_handle != vr::k_ulOverlayHandleInvalid) 64 | { 65 | vr::VROverlay()->SetOverlayFromFile(m_handle, f_path.c_str()); 66 | } 67 | } 68 | 69 | void VRDashOverlay::SetThumbTexture(unsigned int f_name) 70 | { 71 | if(m_handleThumb != vr::k_ulOverlayHandleInvalid) 72 | { 73 | m_textureThumb.handle = reinterpret_cast(static_cast(f_name)); 74 | } 75 | } 76 | 77 | void VRDashOverlay::SetThumbTexture(const std::string &f_path) 78 | { 79 | if(m_handleThumb != vr::k_ulOverlayHandleInvalid) 80 | { 81 | vr::VROverlay()->SetOverlayFromFile(m_handleThumb, f_path.c_str()); 82 | } 83 | } 84 | 85 | void VRDashOverlay::SetInputMethod(vr::VROverlayInputMethod f_method) 86 | { 87 | if(m_handle != vr::k_ulOverlayHandleInvalid) 88 | { 89 | vr::VROverlay()->SetOverlayInputMethod(m_handle, f_method); 90 | } 91 | } 92 | 93 | void VRDashOverlay::SetFlag(vr::VROverlayFlags f_flag, bool f_state) 94 | { 95 | if(m_handle != vr::k_ulOverlayHandleInvalid) 96 | { 97 | vr::VROverlay()->SetOverlayFlag(m_handle, f_flag, f_state); 98 | } 99 | } 100 | 101 | void VRDashOverlay::SetWidth(float f_width) 102 | { 103 | if(m_handle != vr::k_ulOverlayHandleInvalid) 104 | { 105 | vr::VROverlay()->SetOverlayWidthInMeters(m_handle, f_width); 106 | } 107 | } 108 | 109 | void VRDashOverlay::SetMouseScale(float f_width, float f_height) 110 | { 111 | if(m_handle != vr::k_ulOverlayHandleInvalid) 112 | { 113 | const vr::HmdVector2_t l_scale = { f_width, f_height }; 114 | vr::VROverlay()->SetOverlayMouseScale(m_handle, &l_scale); 115 | } 116 | } 117 | 118 | void VRDashOverlay::SetAlpha(float f_alpha) 119 | { 120 | if(m_handle != vr::k_ulOverlayHandleInvalid) 121 | { 122 | vr::VROverlay()->SetOverlayAlpha(m_handle, f_alpha); 123 | } 124 | } 125 | 126 | bool VRDashOverlay::IsVisible() const 127 | { 128 | bool l_result = false; 129 | if(m_handle != vr::k_ulOverlayHandleInvalid) 130 | { 131 | l_result = vr::VROverlay()->IsOverlayVisible(m_handle); 132 | } 133 | return l_result; 134 | } 135 | 136 | bool VRDashOverlay::Poll(vr::VREvent_t &f_event) 137 | { 138 | bool l_result = false; 139 | if(m_handle != vr::k_ulOverlayHandleInvalid) 140 | { 141 | l_result = vr::VROverlay()->PollNextOverlayEvent(m_handle, &f_event, sizeof(vr::VREvent_t)); 142 | } 143 | return l_result; 144 | } 145 | 146 | void VRDashOverlay::Update() 147 | { 148 | if(m_handle != vr::k_ulOverlayHandleInvalid) 149 | { 150 | if(m_texture.handle != nullptr) vr::VROverlay()->SetOverlayTexture(m_handle, &m_texture); 151 | } 152 | if(m_handleThumb != vr::k_ulOverlayHandleInvalid) 153 | { 154 | if(m_textureThumb.handle != nullptr) vr::VROverlay()->SetOverlayTexture(m_handleThumb, &m_textureThumb); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Vector2.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | 26 | //////////////////////////////////////////////////////////// 27 | template 28 | inline Vector2::Vector2() : 29 | x(0), 30 | y(0) 31 | { 32 | 33 | } 34 | 35 | 36 | //////////////////////////////////////////////////////////// 37 | template 38 | inline Vector2::Vector2(T X, T Y) : 39 | x(X), 40 | y(Y) 41 | { 42 | 43 | } 44 | 45 | 46 | //////////////////////////////////////////////////////////// 47 | template 48 | template 49 | inline Vector2::Vector2(const Vector2& vector) : 50 | x(static_cast(vector.x)), 51 | y(static_cast(vector.y)) 52 | { 53 | } 54 | 55 | 56 | //////////////////////////////////////////////////////////// 57 | template 58 | inline Vector2 operator -(const Vector2& right) 59 | { 60 | return Vector2(-right.x, -right.y); 61 | } 62 | 63 | 64 | //////////////////////////////////////////////////////////// 65 | template 66 | inline Vector2& operator +=(Vector2& left, const Vector2& right) 67 | { 68 | left.x += right.x; 69 | left.y += right.y; 70 | 71 | return left; 72 | } 73 | 74 | 75 | //////////////////////////////////////////////////////////// 76 | template 77 | inline Vector2& operator -=(Vector2& left, const Vector2& right) 78 | { 79 | left.x -= right.x; 80 | left.y -= right.y; 81 | 82 | return left; 83 | } 84 | 85 | 86 | //////////////////////////////////////////////////////////// 87 | template 88 | inline Vector2 operator +(const Vector2& left, const Vector2& right) 89 | { 90 | return Vector2(left.x + right.x, left.y + right.y); 91 | } 92 | 93 | 94 | //////////////////////////////////////////////////////////// 95 | template 96 | inline Vector2 operator -(const Vector2& left, const Vector2& right) 97 | { 98 | return Vector2(left.x - right.x, left.y - right.y); 99 | } 100 | 101 | 102 | //////////////////////////////////////////////////////////// 103 | template 104 | inline Vector2 operator *(const Vector2& left, T right) 105 | { 106 | return Vector2(left.x * right, left.y * right); 107 | } 108 | 109 | 110 | //////////////////////////////////////////////////////////// 111 | template 112 | inline Vector2 operator *(T left, const Vector2& right) 113 | { 114 | return Vector2(right.x * left, right.y * left); 115 | } 116 | 117 | 118 | //////////////////////////////////////////////////////////// 119 | template 120 | inline Vector2& operator *=(Vector2& left, T right) 121 | { 122 | left.x *= right; 123 | left.y *= right; 124 | 125 | return left; 126 | } 127 | 128 | 129 | //////////////////////////////////////////////////////////// 130 | template 131 | inline Vector2 operator /(const Vector2& left, T right) 132 | { 133 | return Vector2(left.x / right, left.y / right); 134 | } 135 | 136 | 137 | //////////////////////////////////////////////////////////// 138 | template 139 | inline Vector2& operator /=(Vector2& left, T right) 140 | { 141 | left.x /= right; 142 | left.y /= right; 143 | 144 | return left; 145 | } 146 | 147 | 148 | //////////////////////////////////////////////////////////// 149 | template 150 | inline bool operator ==(const Vector2& left, const Vector2& right) 151 | { 152 | return (left.x == right.x) && (left.y == right.y); 153 | } 154 | 155 | 156 | //////////////////////////////////////////////////////////// 157 | template 158 | inline bool operator !=(const Vector2& left, const Vector2& right) 159 | { 160 | return (left.x != right.x) || (left.y != right.y); 161 | } 162 | -------------------------------------------------------------------------------- /Managers/ConfigManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Managers/ConfigManager.h" 4 | #include "Core/Core.h" 5 | #include "Utils/Utils.h" 6 | 7 | const std::vector g_configSettings 8 | { 9 | "target_rate", "gui_font", "keyboard_layout" 10 | }; 11 | enum ConfigSettingIndex : size_t 12 | { 13 | CSI_TargetRate = 0U, 14 | CSI_GuiFont, 15 | CSI_KeyboardLayout, 16 | 17 | CSI_Count 18 | }; 19 | 20 | const std::vector g_targetRates 21 | { 22 | "60", "90", "120", "144" 23 | }; 24 | 25 | std::string ConfigManager::ms_directory; 26 | std::string ConfigManager::ms_guiFont("fonts/Hack-Regular.ttf"); 27 | std::string ConfigManager::ms_keyboardLayout("keyboard_en-ru.xml"); 28 | 29 | ConfigManager::ConfigManager() 30 | { 31 | m_targetRate = TF_60; 32 | } 33 | 34 | ConfigManager::~ConfigManager() 35 | { 36 | } 37 | 38 | void ConfigManager::Load() 39 | { 40 | #ifdef _WIN32 41 | char l_path[MAX_PATH]; 42 | GetCurrentDirectoryA(MAX_PATH, l_path); 43 | ms_directory.assign(l_path); 44 | #elif __linux__ 45 | char l_result[PATH_MAX]; 46 | size_t l_count = readlink( "/proc/self/exe", l_result, PATH_MAX ); 47 | ms_directory.assign(l_result,(l_count > 0) ? l_count : 0 ); 48 | ms_directory.assign(ms_directory.substr(0,ms_directory.find_last_of("/\\"))); 49 | #endif 50 | 51 | pugi::xml_document *l_document = new pugi::xml_document(); 52 | if(l_document->load_file("settings.xml")) 53 | { 54 | const pugi::xml_node l_root = l_document->child("settings"); 55 | for(pugi::xml_node l_node = l_root.child("setting"); l_node; l_node = l_node.next_sibling("setting")) 56 | { 57 | const pugi::xml_attribute l_attribName = l_node.attribute("name"); 58 | const pugi::xml_attribute l_attribValue = l_node.attribute("value"); 59 | if(l_attribName && l_attribValue) 60 | { 61 | switch(ReadEnumVector(l_attribName.as_string(), g_configSettings)) 62 | { 63 | case ConfigSettingIndex::CSI_TargetRate: 64 | { 65 | size_t l_target = ReadEnumVector(l_attribValue.as_string("60"), g_targetRates); 66 | if(l_target != std::numeric_limits::max()) m_targetRate = static_cast(l_target); 67 | } break; 68 | case ConfigSettingIndex::CSI_GuiFont: 69 | ms_guiFont.assign(l_attribValue.as_string("fonts/Hack-Regular.ttf")); 70 | break; 71 | case ConfigSettingIndex::CSI_KeyboardLayout: 72 | ms_keyboardLayout.assign(l_attribValue.as_string("keyboard_en-ru.xml")); 73 | break; 74 | } 75 | } 76 | } 77 | } 78 | delete l_document; 79 | } 80 | 81 | void ConfigManager::Save() 82 | { 83 | pugi::xml_document *l_document = new pugi::xml_document(); 84 | pugi::xml_node l_root = l_document->append_child("settings"); 85 | if(l_root) 86 | { 87 | for(size_t i = 0U; i < CSI_Count; i++) 88 | { 89 | pugi::xml_node l_setting = l_root.append_child("setting"); 90 | if(l_setting) 91 | { 92 | pugi::xml_attribute l_attribName = l_setting.append_attribute("name"); 93 | pugi::xml_attribute l_attribValue = l_setting.append_attribute("value"); 94 | if(l_attribName && l_attribValue) 95 | { 96 | l_attribName.set_value(g_configSettings[i].c_str()); 97 | 98 | switch(i) 99 | { 100 | case CSI_TargetRate: 101 | l_attribValue.set_value(g_targetRates[m_targetRate].c_str()); 102 | break; 103 | case CSI_GuiFont: 104 | l_attribValue.set_value(ms_guiFont.c_str()); 105 | break; 106 | case CSI_KeyboardLayout: 107 | l_attribValue.set_value(ms_keyboardLayout.c_str()); 108 | break; 109 | } 110 | } 111 | } 112 | } 113 | 114 | l_document->save_file("settings.xml"); 115 | } 116 | delete l_document; 117 | } 118 | 119 | unsigned char ConfigManager::GetTargetRate() 120 | { 121 | return m_targetRate; 122 | } 123 | 124 | void ConfigManager::SetTargetRate(unsigned char f_target) 125 | { 126 | m_targetRate = f_target%TF_Count; 127 | } 128 | 129 | 130 | // Static 131 | const std::string& ConfigManager::GetDirectory() 132 | { 133 | return ms_directory; 134 | } 135 | 136 | const std::string& ConfigManager::GetGuiFont() 137 | { 138 | return ms_guiFont; 139 | } 140 | 141 | const std::string& ConfigManager::GetKeyboardLayout() 142 | { 143 | return ms_keyboardLayout; 144 | } 145 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Audio/SoundFileWriter.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SOUNDFILEWRITER_HPP 26 | #define SFML_SOUNDFILEWRITER_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Abstract base class for sound file encoding 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_AUDIO_API SoundFileWriter 42 | { 43 | public: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Virtual destructor 47 | /// 48 | //////////////////////////////////////////////////////////// 49 | virtual ~SoundFileWriter() {} 50 | 51 | //////////////////////////////////////////////////////////// 52 | /// \brief Open a sound file for writing 53 | /// 54 | /// \param filename Path of the file to open 55 | /// \param sampleRate Sample rate of the sound 56 | /// \param channelCount Number of channels of the sound 57 | /// 58 | /// \return True if the file was successfully opened 59 | /// 60 | //////////////////////////////////////////////////////////// 61 | virtual bool open(const std::string& filename, unsigned int sampleRate, unsigned int channelCount) = 0; 62 | 63 | //////////////////////////////////////////////////////////// 64 | /// \brief Write audio samples to the open file 65 | /// 66 | /// \param samples Pointer to the sample array to write 67 | /// \param count Number of samples to write 68 | /// 69 | //////////////////////////////////////////////////////////// 70 | virtual void write(const Int16* samples, Uint64 count) = 0; 71 | }; 72 | 73 | } // namespace sf 74 | 75 | 76 | #endif // SFML_SOUNDFILEWRITER_HPP 77 | 78 | 79 | //////////////////////////////////////////////////////////// 80 | /// \class sf::SoundFileWriter 81 | /// \ingroup audio 82 | /// 83 | /// This class allows users to write audio file formats not natively 84 | /// supported by SFML, and thus extend the set of supported writable 85 | /// audio formats. 86 | /// 87 | /// A valid sound file writer must override the open and write functions, 88 | /// as well as providing a static check function; the latter is used by 89 | /// SFML to find a suitable writer for a given filename. 90 | /// 91 | /// To register a new writer, use the sf::SoundFileFactory::registerWriter 92 | /// template function. 93 | /// 94 | /// Usage example: 95 | /// \code 96 | /// class MySoundFileWriter : public sf::SoundFileWriter 97 | /// { 98 | /// public: 99 | /// 100 | /// static bool check(const std::string& filename) 101 | /// { 102 | /// // typically, check the extension 103 | /// // return true if the writer can handle the format 104 | /// } 105 | /// 106 | /// virtual bool open(const std::string& filename, unsigned int sampleRate, unsigned int channelCount) 107 | /// { 108 | /// // open the file 'filename' for writing, 109 | /// // write the given sample rate and channel count to the file header 110 | /// // return true on success 111 | /// } 112 | /// 113 | /// virtual void write(const sf::Int16* samples, sf::Uint64 count) 114 | /// { 115 | /// // write 'count' samples stored at address 'samples', 116 | /// // convert them (for example to normalized float) if the format requires it 117 | /// } 118 | /// }; 119 | /// 120 | /// sf::SoundFileFactory::registerWriter(); 121 | /// \endcode 122 | /// 123 | /// \see sf::OutputSoundFile, sf::SoundFileFactory, sf::SoundFileReader 124 | /// 125 | //////////////////////////////////////////////////////////// 126 | -------------------------------------------------------------------------------- /Gui/GuiElement.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "Gui/GuiElement.h" 4 | #include "Gui/GuiStructures.h" 5 | 6 | GuiElement::GuiElement() 7 | { 8 | m_userPointer = nullptr; 9 | 10 | m_position = sf::Vector2f(0.f, 0.f); 11 | m_size = sf::Vector2f(0.f, 0.f); 12 | m_color = { 255U, 255U, 255U }; 13 | m_selectionColor = { 142U, 205U, 246U }; 14 | m_activeHover = false; 15 | m_visible = true; 16 | m_interactable = false; 17 | m_update = false; 18 | 19 | m_mouseClickCallback = nullptr; 20 | m_mouseMoveCallback = nullptr; 21 | } 22 | GuiElement::~GuiElement() 23 | { 24 | m_drawables.clear(); 25 | } 26 | 27 | void GuiElement::SetPosition(const sf::Vector2f &f_pos) 28 | { 29 | if(m_position != f_pos) 30 | { 31 | m_position = f_pos; 32 | m_update = true; 33 | } 34 | } 35 | 36 | const sf::Vector2f& GuiElement::GetPosition() const 37 | { 38 | return m_position; 39 | } 40 | 41 | void GuiElement::SetSize(const sf::Vector2f &f_size) 42 | { 43 | if(m_size != f_size) 44 | { 45 | m_size = f_size; 46 | m_update = true; 47 | } 48 | } 49 | 50 | const sf::Vector2f& GuiElement::GetSize() const 51 | { 52 | return m_size; 53 | } 54 | 55 | void GuiElement::SetVisibility(bool f_state) 56 | { 57 | if(m_visible != f_state) 58 | { 59 | m_visible = f_state; 60 | m_interactable = false; 61 | m_update = true; 62 | } 63 | } 64 | 65 | bool GuiElement::GetVisibility() const 66 | { 67 | return m_visible; 68 | } 69 | 70 | void GuiElement::SetColor(const sf::Color &f_color) 71 | { 72 | if(m_color != f_color) 73 | { 74 | m_color = f_color; 75 | m_update = true; 76 | } 77 | } 78 | void GuiElement::SetSelectionColor(const sf::Color &f_color) 79 | { 80 | if(m_selectionColor != f_color) 81 | { 82 | m_selectionColor = f_color; 83 | m_update = true; 84 | } 85 | } 86 | 87 | void GuiElement::SetUserPointer(void *f_pointer) 88 | { 89 | m_userPointer = f_pointer; 90 | } 91 | 92 | void* GuiElement::GetUserPointer() const 93 | { 94 | return m_userPointer; 95 | } 96 | 97 | const std::vector& GuiElement::GetDrawables() const 98 | { 99 | return m_drawables; 100 | } 101 | 102 | void GuiElement::SetClickCallback(const std::function &f_callback) 103 | { 104 | m_mouseClickCallback = f_callback; 105 | } 106 | void GuiElement::RemoveClickCallback() 107 | { 108 | m_mouseClickCallback = nullptr; 109 | } 110 | 111 | void GuiElement::SetMoveCallback(const std::function &f_callback) 112 | { 113 | m_mouseMoveCallback = f_callback; 114 | } 115 | void GuiElement::RemoveMoveCallback() 116 | { 117 | m_mouseMoveCallback = nullptr; 118 | } 119 | 120 | void GuiElement::ProcessClick(unsigned char f_button, unsigned char f_state, unsigned int f_mouseX, unsigned f_mouseY) 121 | { 122 | if(m_visible && m_interactable) 123 | { 124 | const sf::FloatRect l_rectangle(m_position.x, m_position.y, m_size.x, m_size.y); 125 | if(l_rectangle.contains(static_cast(f_mouseX), static_cast(f_mouseY))) 126 | { 127 | ProcessClickInternal(f_button, f_state, f_mouseX, f_mouseY); 128 | if(m_mouseClickCallback) m_mouseClickCallback(this, f_button, f_state, f_mouseX, f_mouseY); 129 | } 130 | } 131 | } 132 | void GuiElement::ProcessClickInternal(unsigned char f_button, unsigned char f_state, unsigned int f_mouseX, unsigned f_mouseY) 133 | { 134 | } 135 | 136 | void GuiElement::ProcessMove(unsigned int f_mouseX, unsigned f_mouseY) 137 | { 138 | if(m_visible && m_interactable) 139 | { 140 | const sf::FloatRect l_rectangle(m_position.x, m_position.y, m_size.x, m_size.y); 141 | if(l_rectangle.contains(static_cast(f_mouseX), static_cast(f_mouseY))) 142 | { 143 | if(!m_activeHover) 144 | { 145 | m_activeHover = true; 146 | ProcessFocusInternal(f_mouseX, f_mouseY); 147 | } 148 | ProcessMoveInternal(f_mouseX, f_mouseY); 149 | if(m_mouseMoveCallback) m_mouseMoveCallback(this, f_mouseX, f_mouseY); 150 | } 151 | else 152 | { 153 | if(m_activeHover) 154 | { 155 | m_activeHover = false; 156 | ProcessBlurInternal(f_mouseX, f_mouseY); 157 | } 158 | } 159 | } 160 | } 161 | void GuiElement::ProcessMoveInternal(unsigned int f_mouseX, unsigned int f_mouseY) 162 | { 163 | } 164 | 165 | void GuiElement::ProcessFocusInternal(unsigned int f_mouseX, unsigned int f_mouseY) 166 | { 167 | } 168 | void GuiElement::ProcessBlurInternal(unsigned int f_mouseX, unsigned int f_mouseY) 169 | { 170 | } 171 | 172 | void GuiElement::Update() 173 | { 174 | if(m_visible && !m_interactable) m_interactable = true; 175 | m_update = false; 176 | } 177 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Graphics/RectangleShape.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_RECTANGLESHAPE_HPP 26 | #define SFML_RECTANGLESHAPE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Specialized shape representing a rectangle 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_GRAPHICS_API RectangleShape : public Shape 42 | { 43 | public: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Default constructor 47 | /// 48 | /// \param size Size of the rectangle 49 | /// 50 | //////////////////////////////////////////////////////////// 51 | explicit RectangleShape(const Vector2f& size = Vector2f(0, 0)); 52 | 53 | //////////////////////////////////////////////////////////// 54 | /// \brief Set the size of the rectangle 55 | /// 56 | /// \param size New size of the rectangle 57 | /// 58 | /// \see getSize 59 | /// 60 | //////////////////////////////////////////////////////////// 61 | void setSize(const Vector2f& size); 62 | 63 | //////////////////////////////////////////////////////////// 64 | /// \brief Get the size of the rectangle 65 | /// 66 | /// \return Size of the rectangle 67 | /// 68 | /// \see setSize 69 | /// 70 | //////////////////////////////////////////////////////////// 71 | const Vector2f& getSize() const; 72 | 73 | //////////////////////////////////////////////////////////// 74 | /// \brief Get the number of points defining the shape 75 | /// 76 | /// \return Number of points of the shape. For rectangle 77 | /// shapes, this number is always 4. 78 | /// 79 | //////////////////////////////////////////////////////////// 80 | virtual std::size_t getPointCount() const; 81 | 82 | //////////////////////////////////////////////////////////// 83 | /// \brief Get a point of the rectangle 84 | /// 85 | /// The returned point is in local coordinates, that is, 86 | /// the shape's transforms (position, rotation, scale) are 87 | /// not taken into account. 88 | /// The result is undefined if \a index is out of the valid range. 89 | /// 90 | /// \param index Index of the point to get, in range [0 .. 3] 91 | /// 92 | /// \return index-th point of the shape 93 | /// 94 | //////////////////////////////////////////////////////////// 95 | virtual Vector2f getPoint(std::size_t index) const; 96 | 97 | private: 98 | 99 | //////////////////////////////////////////////////////////// 100 | // Member data 101 | //////////////////////////////////////////////////////////// 102 | Vector2f m_size; ///< Size of the rectangle 103 | }; 104 | 105 | } // namespace sf 106 | 107 | 108 | #endif // SFML_RECTANGLESHAPE_HPP 109 | 110 | 111 | //////////////////////////////////////////////////////////// 112 | /// \class sf::RectangleShape 113 | /// \ingroup graphics 114 | /// 115 | /// This class inherits all the functions of sf::Transformable 116 | /// (position, rotation, scale, bounds, ...) as well as the 117 | /// functions of sf::Shape (outline, color, texture, ...). 118 | /// 119 | /// Usage example: 120 | /// \code 121 | /// sf::RectangleShape rectangle; 122 | /// rectangle.setSize(sf::Vector2f(100, 50)); 123 | /// rectangle.setOutlineColor(sf::Color::Red); 124 | /// rectangle.setOutlineThickness(5); 125 | /// rectangle.setPosition(10, 20); 126 | /// ... 127 | /// window.draw(rectangle); 128 | /// \endcode 129 | /// 130 | /// \see sf::Shape, sf::CircleShape, sf::ConvexShape 131 | /// 132 | //////////////////////////////////////////////////////////// 133 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/Audio/OutputSoundFile.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_OUTPUTSOUNDFILE_HPP 26 | #define SFML_OUTPUTSOUNDFILE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | namespace sf 37 | { 38 | class SoundFileWriter; 39 | 40 | //////////////////////////////////////////////////////////// 41 | /// \brief Provide write access to sound files 42 | /// 43 | //////////////////////////////////////////////////////////// 44 | class SFML_AUDIO_API OutputSoundFile : NonCopyable 45 | { 46 | public: 47 | 48 | //////////////////////////////////////////////////////////// 49 | /// \brief Default constructor 50 | /// 51 | //////////////////////////////////////////////////////////// 52 | OutputSoundFile(); 53 | 54 | //////////////////////////////////////////////////////////// 55 | /// \brief Destructor 56 | /// 57 | /// Closes the file if it was still open. 58 | /// 59 | //////////////////////////////////////////////////////////// 60 | ~OutputSoundFile(); 61 | 62 | //////////////////////////////////////////////////////////// 63 | /// \brief Open the sound file from the disk for writing 64 | /// 65 | /// The supported audio formats are: WAV, OGG/Vorbis, FLAC. 66 | /// 67 | /// \param filename Path of the sound file to write 68 | /// \param sampleRate Sample rate of the sound 69 | /// \param channelCount Number of channels in the sound 70 | /// 71 | /// \return True if the file was successfully opened 72 | /// 73 | //////////////////////////////////////////////////////////// 74 | bool openFromFile(const std::string& filename, unsigned int sampleRate, unsigned int channelCount); 75 | 76 | //////////////////////////////////////////////////////////// 77 | /// \brief Write audio samples to the file 78 | /// 79 | /// \param samples Pointer to the sample array to write 80 | /// \param count Number of samples to write 81 | /// 82 | //////////////////////////////////////////////////////////// 83 | void write(const Int16* samples, Uint64 count); 84 | 85 | private: 86 | 87 | //////////////////////////////////////////////////////////// 88 | /// \brief Close the current file 89 | /// 90 | //////////////////////////////////////////////////////////// 91 | void close(); 92 | 93 | //////////////////////////////////////////////////////////// 94 | // Member data 95 | //////////////////////////////////////////////////////////// 96 | SoundFileWriter* m_writer; ///< Writer that handles I/O on the file's format 97 | }; 98 | 99 | } // namespace sf 100 | 101 | 102 | #endif // SFML_OUTPUTSOUNDFILE_HPP 103 | 104 | 105 | //////////////////////////////////////////////////////////// 106 | /// \class sf::OutputSoundFile 107 | /// \ingroup audio 108 | /// 109 | /// This class encodes audio samples to a sound file. It is 110 | /// used internally by higher-level classes such as sf::SoundBuffer, 111 | /// but can also be useful if you want to create audio files from 112 | /// custom data sources, like generated audio samples. 113 | /// 114 | /// Usage example: 115 | /// \code 116 | /// // Create a sound file, ogg/vorbis format, 44100 Hz, stereo 117 | /// sf::OutputSoundFile file; 118 | /// if (!file.openFromFile("music.ogg", 44100, 2)) 119 | /// /* error */; 120 | /// 121 | /// while (...) 122 | /// { 123 | /// // Read or generate audio samples from your custom source 124 | /// std::vector samples = ...; 125 | /// 126 | /// // Write them to the file 127 | /// file.write(samples.data(), samples.size()); 128 | /// } 129 | /// \endcode 130 | /// 131 | /// \see sf::SoundFileWriter, sf::InputSoundFile 132 | /// 133 | //////////////////////////////////////////////////////////// 134 | -------------------------------------------------------------------------------- /vendor/sfml/include/SFML/System/Vector3.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | 26 | //////////////////////////////////////////////////////////// 27 | template 28 | inline Vector3::Vector3() : 29 | x(0), 30 | y(0), 31 | z(0) 32 | { 33 | 34 | } 35 | 36 | 37 | //////////////////////////////////////////////////////////// 38 | template 39 | inline Vector3::Vector3(T X, T Y, T Z) : 40 | x(X), 41 | y(Y), 42 | z(Z) 43 | { 44 | 45 | } 46 | 47 | 48 | //////////////////////////////////////////////////////////// 49 | template 50 | template 51 | inline Vector3::Vector3(const Vector3& vector) : 52 | x(static_cast(vector.x)), 53 | y(static_cast(vector.y)), 54 | z(static_cast(vector.z)) 55 | { 56 | } 57 | 58 | 59 | //////////////////////////////////////////////////////////// 60 | template 61 | inline Vector3 operator -(const Vector3& left) 62 | { 63 | return Vector3(-left.x, -left.y, -left.z); 64 | } 65 | 66 | 67 | //////////////////////////////////////////////////////////// 68 | template 69 | inline Vector3& operator +=(Vector3& left, const Vector3& right) 70 | { 71 | left.x += right.x; 72 | left.y += right.y; 73 | left.z += right.z; 74 | 75 | return left; 76 | } 77 | 78 | 79 | //////////////////////////////////////////////////////////// 80 | template 81 | inline Vector3& operator -=(Vector3& left, const Vector3& right) 82 | { 83 | left.x -= right.x; 84 | left.y -= right.y; 85 | left.z -= right.z; 86 | 87 | return left; 88 | } 89 | 90 | 91 | //////////////////////////////////////////////////////////// 92 | template 93 | inline Vector3 operator +(const Vector3& left, const Vector3& right) 94 | { 95 | return Vector3(left.x + right.x, left.y + right.y, left.z + right.z); 96 | } 97 | 98 | 99 | //////////////////////////////////////////////////////////// 100 | template 101 | inline Vector3 operator -(const Vector3& left, const Vector3& right) 102 | { 103 | return Vector3(left.x - right.x, left.y - right.y, left.z - right.z); 104 | } 105 | 106 | 107 | //////////////////////////////////////////////////////////// 108 | template 109 | inline Vector3 operator *(const Vector3& left, T right) 110 | { 111 | return Vector3(left.x * right, left.y * right, left.z * right); 112 | } 113 | 114 | 115 | //////////////////////////////////////////////////////////// 116 | template 117 | inline Vector3 operator *(T left, const Vector3& right) 118 | { 119 | return Vector3(right.x * left, right.y * left, right.z * left); 120 | } 121 | 122 | 123 | //////////////////////////////////////////////////////////// 124 | template 125 | inline Vector3& operator *=(Vector3& left, T right) 126 | { 127 | left.x *= right; 128 | left.y *= right; 129 | left.z *= right; 130 | 131 | return left; 132 | } 133 | 134 | 135 | //////////////////////////////////////////////////////////// 136 | template 137 | inline Vector3 operator /(const Vector3& left, T right) 138 | { 139 | return Vector3(left.x / right, left.y / right, left.z / right); 140 | } 141 | 142 | 143 | //////////////////////////////////////////////////////////// 144 | template 145 | inline Vector3& operator /=(Vector3& left, T right) 146 | { 147 | left.x /= right; 148 | left.y /= right; 149 | left.z /= right; 150 | 151 | return left; 152 | } 153 | 154 | 155 | //////////////////////////////////////////////////////////// 156 | template 157 | inline bool operator ==(const Vector3& left, const Vector3& right) 158 | { 159 | return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); 160 | } 161 | 162 | 163 | //////////////////////////////////////////////////////////// 164 | template 165 | inline bool operator !=(const Vector3& left, const Vector3& right) 166 | { 167 | return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); 168 | } 169 | --------------------------------------------------------------------------------