Skip to content

Commit 99dac49

Browse files
committed
less cpu usage
1 parent 1eb87e6 commit 99dac49

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Joy2OpenVR/Main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ namespace
8787
CString uvctrlid;
8888

8989
bool windowontop = false;
90+
int unresponsiveness;
9091
HWND activewindow;
9192

9293

@@ -813,6 +814,7 @@ int main(int argc,char *argv[])
813814
threshold = atof(ini.GetValue("main", "threshold", "1.0"));
814815
deadzonerange = atof(ini.GetValue("main", "deadzonerange", "0.2"));
815816
windowontop = ToBool(ini.GetValue("main", "WindowOnTop", "false"));
817+
unresponsiveness = std::stoi(ini.GetValue("main", "unresponsiveness", "10"));
816818

817819
// xinput prefs
818820
trigger1 = std::stoi(ini.GetValue("buttons", "trigger1", "999"));
@@ -857,7 +859,7 @@ int main(int argc,char *argv[])
857859

858860
// Create the window of the application
859861
sf::String appname="Joy2OpenVR ";
860-
appname += "0.9b";
862+
appname += "0.10b";
861863
sf::RenderWindow window(sf::VideoMode(600, 780), appname, sf::Style::Close);
862864
window.setVerticalSyncEnabled(true);
863865

@@ -993,6 +995,7 @@ int main(int argc,char *argv[])
993995

994996
while (window.isOpen())
995997
{
998+
Sleep(unresponsiveness);
996999
// Handle events
9971000
sf::Event event;
9981001
while (window.pollEvent(event))

Joy2OpenVR/config.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ steamvr_controller1_id = 3
44
steamvr_controller2_id = 4
55
threshold = 1.0
66
deadzonerange = 0.20
7-
WindowOnTop = true
7+
; higher values = less cpu usage, but less responsiveness too
8+
unresponsiveness = 10
9+
;set to true if you plan to use a keyboard
10+
WindowOnTop = true
811

912
[buttons]
1013
; SteamVR button = DirectInput buttons ID

0 commit comments

Comments
 (0)