mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
Merge branch 'master' of https://github.com/Almamu/linux-wallpaperengine into data-separation
# Conflicts: # main.cpp Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
commit
a40a83006e
@ -78,6 +78,12 @@ Only screens configured with the XRandr extension are supported. To specify the
|
|||||||
|
|
||||||
**IMPORTANT: Right now this doesn't work if there is anything drawing to the background (like a compositor, nautilus, etc)**
|
**IMPORTANT: Right now this doesn't work if there is anything drawing to the background (like a compositor, nautilus, etc)**
|
||||||
|
|
||||||
|
#### 5.4.4. Limiting FPS
|
||||||
|
To reduce the performance hit to your system you can reduce (or increase) the FPS limit with the switch ```--fps```, specially useful for laptops:
|
||||||
|
```
|
||||||
|
./wallengine --fps 30
|
||||||
|
```
|
||||||
|
|
||||||
###### Example background
|
###### Example background
|
||||||
This was the first background to even be compatible with the software. And It's not 100% compatible yet. Both textures and shaders are properly loaded, but there are still particles missing.
|
This was the first background to even be compatible with the software. And It's not 100% compatible yet. Both textures and shaders are properly loaded, but there are still particles missing.
|
||||||
|
|
||||||
|
38
main.cpp
38
main.cpp
@ -159,7 +159,8 @@ void print_help (const char* route)
|
|||||||
<< " --silent\t\tMutes all the sound the wallpaper might produce" << std::endl
|
<< " --silent\t\tMutes all the sound the wallpaper might produce" << std::endl
|
||||||
<< " --dir <folder>\tLoads an uncompressed background from the given <folder>" << std::endl
|
<< " --dir <folder>\tLoads an uncompressed background from the given <folder>" << std::endl
|
||||||
<< " --pkg <folder>\tLoads a scene.pkg file from the given <folder>" << std::endl
|
<< " --pkg <folder>\tLoads a scene.pkg file from the given <folder>" << std::endl
|
||||||
<< " --screen-root <screen name>\tDisplay as screen's background" << std::endl;
|
<< " --screen-root <screen name>\tDisplay as screen's background" << std::endl
|
||||||
|
<< " --fps <maximum-fps>\tLimits the FPS to the given number, useful to keep battery consumption low" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string stringPathFixes(const std::string& s){
|
std::string stringPathFixes(const std::string& s){
|
||||||
@ -178,6 +179,7 @@ std::string stringPathFixes(const std::string& s){
|
|||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
|
int max_fps = 30;
|
||||||
bool audio_support = true;
|
bool audio_support = true;
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
@ -187,14 +189,15 @@ int main (int argc, char* argv[])
|
|||||||
{"screen-root", required_argument, 0, 'r'},
|
{"screen-root", required_argument, 0, 'r'},
|
||||||
{"pkg", required_argument, 0, 'p'},
|
{"pkg", required_argument, 0, 'p'},
|
||||||
{"dir", required_argument, 0, 'd'},
|
{"dir", required_argument, 0, 'd'},
|
||||||
{"silent", optional_argument, 0, 's'},
|
{"silent", no_argument, 0, 's'},
|
||||||
{"help", optional_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
{nullptr, 0, 0, 0}
|
{"fps", required_argument, 0, 'f'},
|
||||||
|
{nullptr, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int c = getopt_long (argc, argv, "r:p:d:sh", long_options, &option_index);
|
int c = getopt_long (argc, argv, "r:p:d:shf:", long_options, &option_index);
|
||||||
|
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
@ -224,6 +227,10 @@ int main (int argc, char* argv[])
|
|||||||
print_help (argv [0]);
|
print_help (argv [0]);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
max_fps = atoi (optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -302,18 +309,21 @@ int main (int argc, char* argv[])
|
|||||||
// register nodes
|
// register nodes
|
||||||
WallpaperEngine::video::renderer::queueNode (wp_project->getScene ());
|
WallpaperEngine::video::renderer::queueNode (wp_project->getScene ());
|
||||||
|
|
||||||
int32_t lastTime = 0;
|
irr::u32 lastTime = 0;
|
||||||
int32_t minimumTime = 1000 / 90;
|
irr::u32 minimumTime = 1000 / max_fps;
|
||||||
int32_t currentTime = 0;
|
irr::u32 currentTime = 0;
|
||||||
|
|
||||||
|
irr::u32 startTime = 0;
|
||||||
|
irr::u32 endTime = 0;
|
||||||
|
|
||||||
while (IrrlichtContext->getDevice ()->run () && IrrlichtContext && IrrlichtContext->getDevice ())
|
while (IrrlichtContext->getDevice ()->run () && IrrlichtContext && IrrlichtContext->getDevice ())
|
||||||
{
|
{
|
||||||
// if (device->isWindowActive ())
|
// if (device->isWindowActive ())
|
||||||
{
|
{
|
||||||
currentTime = IrrlichtContext->getDevice ()->getTimer ()->getTime ();
|
currentTime = startTime = IrrlichtContext->getDevice ()->getTimer ()->getTime ();
|
||||||
g_Time = currentTime / 1000.0f;
|
g_Time = currentTime / 1000.0f;
|
||||||
|
|
||||||
if (currentTime - lastTime > minimumTime)
|
if (Viewports.size () > 0)
|
||||||
{
|
{
|
||||||
std::vector<irr::core::rect<irr::s32>>::iterator cur = Viewports.begin ();
|
std::vector<irr::core::rect<irr::s32>>::iterator cur = Viewports.begin ();
|
||||||
std::vector<irr::core::rect<irr::s32>>::iterator end = Viewports.end ();
|
std::vector<irr::core::rect<irr::s32>>::iterator end = Viewports.end ();
|
||||||
@ -324,13 +334,15 @@ int main (int argc, char* argv[])
|
|||||||
IrrlichtContext->getDevice ()->getVideoDriver ()->setViewPort (*cur);
|
IrrlichtContext->getDevice ()->getVideoDriver ()->setViewPort (*cur);
|
||||||
WallpaperEngine::video::renderer::render ();
|
WallpaperEngine::video::renderer::render ();
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTime = currentTime;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IrrlichtContext->getDevice ()->sleep (1, false);
|
WallpaperEngine::video::renderer::render ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endTime = IrrlichtContext->getDevice ()->getTimer ()->getTime ();
|
||||||
|
|
||||||
|
IrrlichtContext->getDevice ()->sleep (minimumTime - (endTime - startTime), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user