Skip to content

Commit

Permalink
less cpu usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorselli committed Aug 11, 2018
1 parent 1eb87e6 commit 99dac49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Joy2OpenVR/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace
CString uvctrlid;

bool windowontop = false;
int unresponsiveness;
HWND activewindow;


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

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

// Create the window of the application
sf::String appname="Joy2OpenVR ";
appname += "0.9b";
appname += "0.10b";
sf::RenderWindow window(sf::VideoMode(600, 780), appname, sf::Style::Close);
window.setVerticalSyncEnabled(true);

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

while (window.isOpen())
{
Sleep(unresponsiveness);
// Handle events
sf::Event event;
while (window.pollEvent(event))
Expand Down
5 changes: 4 additions & 1 deletion Joy2OpenVR/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ steamvr_controller1_id = 3
steamvr_controller2_id = 4
threshold = 1.0
deadzonerange = 0.20
WindowOnTop = true
; higher values = less cpu usage, but less responsiveness too
unresponsiveness = 10
;set to true if you plan to use a keyboard
WindowOnTop = true

[buttons]
; SteamVR button = DirectInput buttons ID
Expand Down

0 comments on commit 99dac49

Please sign in to comment.