1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Add Godot export

Fix paths in sidebar now that we have multiple
storage paths
Add Godot wallpaper and edit to ScreenPlay
Fix showing Godot icon in task bar
This commit is contained in:
Elias Steurer 2023-09-28 15:55:11 +02:00
parent b4a3cb806a
commit 8223eb5c36
23 changed files with 356 additions and 124 deletions

17
.vscode/tasks.json vendored
View File

@ -85,6 +85,23 @@
"setup.py"
]
},
{
"type": "process",
"label": "Build Godot",
"command": "python",
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceFolder}/Tools"
},
"args": [
"build_godot.py",
"--build_path",
"${command:cmake.buildDirectory}/bin"
]
},
{
"type": "process",
"label": "Build ScreenPlay release, with deploy and steam enabled",

View File

@ -1,3 +1,4 @@
#pragma once
#define SCREENPLAY_SOURCE_DIR "@SOURCE_DIR@"
#define SCREENPLAY_SOURCE_DIR "@SOURCE_DIR@"
#define SCREENPLAY_GODOT_VERSION "@GODOT_VERSION@"

View File

@ -7,6 +7,7 @@
#
function(generate_cmake_variable_header TARGET)
set(SOURCE_DIR ${CMAKE_SOURCE_DIR})
set(SCREENPLAY_GODOT_VERSION ${GODOT_VERSION})
# Specify the configuration file from which the header file will be generated
configure_file(${CMAKE_SOURCE_DIR}/CMake/CMakeVariables.h.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/CMakeVariables.h @ONLY)

View File

@ -21,6 +21,19 @@ elseif(APPLE)
set(VCPKG_TARGET_ARCHITECTURE "arm64;x86_64")
endif()
# Godot Editor
set(GODOT_VERSION "v4.1.1")
if(WIN32)
set(GODOT_EDITOR_NAME "Godot_${GODOT_VERSION}-stable_win64.exe")
elseif(APPLE)
set(GODOT_EDITOR_NAME "Godot.app")
elseif(UNIX)
set(GODOT_EDITOR_NAME "Godot_${GODOT_VERSION}-stable_linux.x86_64")
else()
message(FATAL_ERROR "Unsupported OS")
endif()
# This sets cmake to compile all dlls into the main directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@ -56,7 +69,7 @@ set(VCPKG_BIN_PATH "${VCPKG_INSTALLED_PATH}/bin")
option(SCREENPLAY_STEAM "For FOSS distribution so we do not bundle proprietary code." ON)
option(SCREENPLAY_DEPLOY "Marks this version as an official deploy version. This version uses different import paths and other settings."
OFF)
OFF)
option(SCREENPLAY_TESTS "Enables UI tests." ON)
option(SCREENPLAY_INSTALLER "Indicates whether an installer via the Qt Installer Framework is created." OFF)
@ -69,11 +82,13 @@ file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_compile_definitions(COMPILE_INFO="Build Date: ${BUILD_DATE}. Git Hash: ${GIT_COMMIT_HASH}. ")
add_compile_definitions(SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
if(${SCREENPLAY_DEPLOY})
add_compile_definitions(DEPLOY_VERSION)
endif()
find_package(Git REQUIRED)
if(WIN32)
set(DATE_COMMAND "CMD")
set(DATE_ARG "/c date /t")
@ -124,7 +139,7 @@ add_subdirectory(ScreenPlayUtil)
add_subdirectory(ScreenPlayWeather)
if(GODOT_WALLPAPER)
add_subdirectory(ScreenPlayWallpaper/Godot/GDExtention)
add_subdirectory(ScreenPlayWallpaper/Godot)
endif()
if(${SCREENPLAY_TESTS})
@ -133,6 +148,7 @@ endif()
# Only add target SteamSDKQtEnums
add_subdirectory(ScreenPlayWorkshop/SteamSDK)
if(${SCREENPLAY_STEAM})
add_subdirectory(ScreenPlayWorkshop)
endif()

View File

@ -9,7 +9,6 @@ var speed = 0.4
func _process(delta):
# Update the offset to move the object along the path
path_follow.progress += speed * delta
print(path_follow.progress)
# Loop back to the start if we've reached the end of the path
if path_follow.progress > 10:

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

View File

@ -0,0 +1,11 @@
{
"description": "Godot",
"file": "main.qml",
"preview": "preview.png",
"tags": [
"Godot"
],
"title": "Godot Wallpaper",
"type": "godotWallpaper",
"visibility": "public"
}

View File

@ -18,20 +18,21 @@ class GlobalVariables : public QObject {
QML_ELEMENT
Q_PROPERTY(QVersionNumber version READ version CONSTANT)
Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged)
Q_PROPERTY(QUrl localSettingsPath READ localSettingsPath WRITE setLocalSettingsPath NOTIFY localSettingsPathChanged)
Q_PROPERTY(QUrl wallpaperExecutablePath READ wallpaperExecutablePath WRITE setWallpaperExecutablePath NOTIFY wallpaperExecutablePathChanged)
Q_PROPERTY(QUrl widgetExecutablePath READ widgetExecutablePath WRITE setWidgetExecutablePath NOTIFY widgetExecutablePathChanged)
Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged FINAL)
Q_PROPERTY(QUrl localSettingsPath READ localSettingsPath WRITE setLocalSettingsPath NOTIFY localSettingsPathChanged FINAL)
Q_PROPERTY(QUrl wallpaperExecutablePath READ wallpaperExecutablePath WRITE setWallpaperExecutablePath NOTIFY wallpaperExecutablePathChanged FINAL)
Q_PROPERTY(QUrl widgetExecutablePath READ widgetExecutablePath WRITE setWidgetExecutablePath NOTIFY widgetExecutablePathChanged FINAL)
Q_PROPERTY(QUrl godotWallpaperExecutablePath READ godotWallpaperExecutablePath WRITE setGodotWallpaperExecutablePath NOTIFY godotWallpaperExecutablePathChanged FINAL)
Q_PROPERTY(QUrl godotEditorExecutablePath READ godotEditorExecutablePath WRITE setGodotEditorExecutablePath NOTIFY godotEditorExecutablePathChanged FINAL)
public:
explicit GlobalVariables(QObject* parent = nullptr);
/*!
\brief We need to check if there was an error in the Wallpaper/Widgets.
For this we ping it every 3s.
*/
static const int contentPingAliveIntervalMS = 3000;
\property GlobalVariables::m_version
\brief Returns the current app version. Not yet used.
*/
QVersionNumber version() const { return m_version; }
/*!
\property GlobalVariables::localStoragePath
\brief Returns the localStoragePath.
@ -56,51 +57,35 @@ public:
\property GlobalVariables::m_version
\brief Returns the current app version. Not yet used.
*/
QVersionNumber version() const { return m_version; }
QUrl godotWallpaperExecutablePath() const { return m_godotWallpaperExecutablePath; }
/*!
\property GlobalVariables::m_version
\brief Returns the current app version. Not yet used.
*/
QUrl godotEditorExecutablePath() const { return m_godotEditorExecutablePath; }
signals:
void localStoragePathChanged(QUrl localStoragePath);
void localSettingsPathChanged(QUrl localSettingsPath);
void wallpaperExecutablePathChanged(QUrl wallpaperExecutablePath);
void widgetExecutablePathChanged(QUrl widgetExecutablePath);
void godotWallpaperExecutablePathChanged(QUrl godotWallpaperExecutablePath);
void godotEditorExecutablePathChanged(QUrl godotEditorExecutablePath);
public slots:
void setLocalStoragePath(QUrl localStoragePath);
void setLocalSettingsPath(QUrl localSettingsPath);
void setWallpaperExecutablePath(QUrl wallpaperExecutablePath);
void setWidgetExecutablePath(QUrl widgetExecutablePath);
void setGodotWallpaperExecutablePath(QUrl godotWallpaperExecutablePath);
void setGodotEditorExecutablePath(QUrl godotEditorExecutablePath);
void setLocalStoragePath(QUrl localStoragePath)
{
if (m_localStoragePath == localStoragePath)
return;
m_localStoragePath = localStoragePath;
emit localStoragePathChanged(m_localStoragePath);
}
void setLocalSettingsPath(QUrl localSettingsPath)
{
if (m_localSettingsPath == localSettingsPath)
return;
m_localSettingsPath = localSettingsPath;
emit localSettingsPathChanged(m_localSettingsPath);
}
void setWallpaperExecutablePath(QUrl wallpaperExecutablePath)
{
if (m_wallpaperExecutablePath == wallpaperExecutablePath)
return;
m_wallpaperExecutablePath = wallpaperExecutablePath;
emit wallpaperExecutablePathChanged(m_wallpaperExecutablePath);
}
void setWidgetExecutablePath(QUrl widgetExecutablePath)
{
if (m_widgetExecutablePath == widgetExecutablePath)
return;
m_widgetExecutablePath = widgetExecutablePath;
emit widgetExecutablePathChanged(m_widgetExecutablePath);
}
public:
/*!
\brief We need to check if there was an error in the Wallpaper/Widgets.
For this we ping it every 3s.
*/
static const int contentPingAliveIntervalMS = 3000;
private:
QUrl m_localStoragePath;
@ -108,5 +93,7 @@ private:
QUrl m_wallpaperExecutablePath;
QUrl m_widgetExecutablePath;
QVersionNumber m_version { 1, 0, 0 };
QUrl m_godotWallpaperExecutablePath;
QUrl m_godotEditorExecutablePath;
};
}

View File

@ -52,10 +52,10 @@ Item {
imagePreview.source = previewImageFilePath;
}
if (JSUtil.isWidget(root.type) || (monitorSelection.activeMonitors.length > 0)) {
btnSetWallpaper.enabled = true;
btnLaunchContent.enabled = true;
return;
}
btnSetWallpaper.enabled = false;
btnLaunchContent.enabled = false;
}
Connections {
@ -73,10 +73,10 @@ Item {
root.state = "activeWallpaper";
else
root.state = "activeScene";
btnSetWallpaper.text = qsTr("Set Wallpaper");
btnLaunchContent.text = qsTr("Set Wallpaper");
} else {
root.state = "activeWidget";
btnSetWallpaper.text = qsTr("Set Widget");
btnLaunchContent.text = qsTr("Set Widget");
}
}
@ -338,8 +338,8 @@ Item {
}
Button {
id: btnSetWallpaper
objectName: "btnSetWallpaper"
id: btnLaunchContent
objectName: "btnLaunchContent"
enabled: JSUtil.isWidget(root.type) ? true : monitorSelection.isSelected
Material.background: Material.accent
Material.foreground: "white"
@ -347,8 +347,9 @@ Item {
icon.color: "white"
font.pointSize: 12
onClicked: {
const absoluteStoragePath = App.globalVariables.localStoragePath + "/" + root.contentFolderName;
const previewImage = App.installedListModel.get(root.contentFolderName).m_preview;
const item = App.installedListModel.get(root.contentFolderName);
const absoluteStoragePath = item.m_absoluteStoragePath;
const previewImage =item.m_preview;
if (JSUtil.isWallpaper(root.type)) {
let activeMonitors = monitorSelection.getActiveMonitors();
// TODO Alert user to choose a monitor
@ -359,7 +360,7 @@ Item {
let volume = 0;
if (type === InstalledType.VideoWallpaper)
volume = Math.round(sliderVolume.slider.value * 100) / 100;
const screenFile = App.installedListModel.get(root.contentFolderName).m_file;
const screenFile = item.m_file;
let success = App.screenPlayManager.createWallpaper(root.type, cbVideoFillMode.currentValue, absoluteStoragePath, previewImage, screenFile, activeMonitors, volume, 1, {}, true);
}
if (JSUtil.isWidget(root.type))

View File

@ -19,6 +19,58 @@ ScreenPlay::GlobalVariables::GlobalVariables(QObject* parent)
setLocalSettingsPath(QUrl { QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) });
}
void GlobalVariables::setLocalStoragePath(QUrl localStoragePath)
{
if (m_localStoragePath == localStoragePath)
return;
m_localStoragePath = localStoragePath;
emit localStoragePathChanged(m_localStoragePath);
}
void GlobalVariables::setLocalSettingsPath(QUrl localSettingsPath)
{
if (m_localSettingsPath == localSettingsPath)
return;
m_localSettingsPath = localSettingsPath;
emit localSettingsPathChanged(m_localSettingsPath);
}
void GlobalVariables::setWallpaperExecutablePath(QUrl wallpaperExecutablePath)
{
if (m_wallpaperExecutablePath == wallpaperExecutablePath)
return;
m_wallpaperExecutablePath = wallpaperExecutablePath;
emit wallpaperExecutablePathChanged(m_wallpaperExecutablePath);
}
void GlobalVariables::setWidgetExecutablePath(QUrl widgetExecutablePath)
{
if (m_widgetExecutablePath == widgetExecutablePath)
return;
m_widgetExecutablePath = widgetExecutablePath;
emit widgetExecutablePathChanged(m_widgetExecutablePath);
}
void GlobalVariables::setGodotWallpaperExecutablePath(QUrl godotWallpaperExecutablePath)
{
if (m_godotWallpaperExecutablePath == godotWallpaperExecutablePath)
return;
m_godotWallpaperExecutablePath = godotWallpaperExecutablePath;
emit godotWallpaperExecutablePathChanged(m_godotWallpaperExecutablePath);
}
void GlobalVariables::setGodotEditorExecutablePath(QUrl godotEditorExecutablePath)
{
if (m_godotEditorExecutablePath == godotEditorExecutablePath)
return;
m_godotEditorExecutablePath = godotEditorExecutablePath;
emit godotEditorExecutablePathChanged(m_godotEditorExecutablePath);
}
}
#include "moc_globalvariables.cpp"

View File

@ -52,7 +52,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const QVector<int>& screenNumber,
if (auto obj = ScreenPlayUtil::openJsonFileToObject(absolutePath + "/project.json")) {
if (obj->contains("properties"))
projectSettingsListModelProperties = obj->value("properties").toObject();
}
}
} else {
projectSettingsListModelProperties = properties;
}
@ -86,20 +86,28 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const QVector<int>& screenNumber,
QVariant::fromValue(fillMode).toString(),
QVariant::fromValue(type).toString(),
QString::number(m_settings->checkWallpaperVisible()),
// Fixes issue 84 media key overlay
" --disable-features=HardwareMediaKeyHandling"
};
// Fixes issue 84 media key overlay in Qt apps
if (m_type != InstalledType::InstalledType::GodotWallpaper) {
m_appArgumentsList.append(" --disable-features=HardwareMediaKeyHandling");
}
}
bool ScreenPlayWallpaper::start()
{
m_process.setArguments(m_appArgumentsList);
m_process.setProgram(m_globalVariables->wallpaperExecutablePath().toString());
if (m_type == InstalledType::InstalledType::GodotWallpaper) {
m_process.setProgram(m_globalVariables->godotWallpaperExecutablePath().toString());
} else {
m_process.setProgram(m_globalVariables->wallpaperExecutablePath().toString());
}
// We must start detatched otherwise we would instantly close the process
// and would loose the animted fade-out and the background refresh needed
// to display the original wallpaper.
const bool success = m_process.startDetached();
qInfo() << "Starting ScreenPlayWallpaper detached: " << (success ? "success" : "failed!");
qInfo() << "Starting ScreenPlayWallpaper detached: " << (success ? "success" : "failed!") << m_process.program();
if (!success) {
qInfo() << m_process.program() << m_appArgumentsList;
emit error(QString("Could not start Wallpaper: " + m_process.errorString()));

View File

@ -2,6 +2,9 @@
#include "ScreenPlay/settings.h"
#include "ScreenPlayUtil/util.h"
#include <QFileInfo>
#include <QSysInfo>
#include "ScreenPlay/CMakeVariables.h"
#ifdef Q_OS_WIN
#include <qt_windows.h>
@ -52,6 +55,7 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
#ifdef SCREENPLAY_STEAM
setSteamVersion(true);
#endif
#ifdef Q_OS_WIN
setDesktopEnvironment(DesktopEnvironment::Windows);
#endif
@ -150,32 +154,37 @@ void Settings::writeJsonFileFromResource(const QString& filename)
void Settings::setupWidgetAndWindowPaths()
{
QDir workingDir(QGuiApplication::applicationDirPath());
const QString osType = QSysInfo::productType();
#ifdef Q_OS_WIN
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget" + ScreenPlayUtil::executableBinEnding()));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + ScreenPlayUtil::executableBinEnding()));
#endif
QString godotVersion = QString(SCREENPLAY_GODOT_VERSION);
if (osType == "windows") {
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget" + ScreenPlayUtil::executableBinEnding()));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + ScreenPlayUtil::executableBinEnding()));
m_globalVariables->setGodotWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaperGodot" + ScreenPlayUtil::executableBinEnding()));
m_globalVariables->setGodotEditorExecutablePath(QUrl(workingDir.path() + "/Godot" + ScreenPlayUtil::executableBinEnding()));
#ifdef Q_OS_LINUX
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget"));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper"));
#endif
#ifdef Q_OS_OSX
// ScreenPlayTest is not bundled in an .app so the working directory
// the the same as the executable.
if (QFileInfo(QCoreApplication::applicationFilePath()).fileName() != "tst_ScreenPlay") {
workingDir.cdUp();
workingDir.cdUp();
workingDir.cdUp();
} else if (osType == "osx") {
// ScreenPlayTest is not bundled in an .app so the working directory
// the the same as the executable.
if (QFileInfo(QCoreApplication::applicationFilePath()).fileName() != "tst_ScreenPlay") {
workingDir.cdUp();
workingDir.cdUp();
workingDir.cdUp();
}
const QString basePath = "/ScreenPlay.app/Contents/MacOS/";
m_globalVariables->setWidgetExecutablePath(QUrl::fromUserInput(workingDir.path() + basePath + "ScreenPlayWidget").toLocalFile());
m_globalVariables->setWallpaperExecutablePath(QUrl::fromUserInput(workingDir.path() + basePath + "ScreenPlayWallpaper").toLocalFile());
m_globalVariables->setGodotWallpaperExecutablePath(QUrl(workingDir.path() + basePath + "ScreenPlayWallpaperGodot").toLocalFile());
m_globalVariables->setGodotEditorExecutablePath(QUrl(workingDir.path() + basePath + "Godot").toLocalFile());
} else if (osType == "linux") {
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget"));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper"));
m_globalVariables->setGodotWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaperGodot"));
m_globalVariables->setGodotEditorExecutablePath(QUrl(workingDir.path() + "/Godot"));
} else {
qFatal("OS not supported.");
}
m_globalVariables->setWidgetExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlay.app/Contents/MacOS/ScreenPlayWidget").toLocalFile());
m_globalVariables->setWallpaperExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlay.app/Contents/MacOS/ScreenPlayWallpaper").toLocalFile());
#endif
if (!QFileInfo::exists(m_globalVariables->widgetExecutablePath().toString())) {
qInfo() << "widgetExecutablePath:" << m_globalVariables->widgetExecutablePath().toString();
qCritical("widget executable not found!");

View File

@ -22,17 +22,6 @@ bool ProjectFile::init()
if (obj.isEmpty())
return false;
// Required:
if (!obj.contains("file"))
return false;
file = obj.value("file").toString();
QFileInfo fileInfo(folder.path() + "/" + file);
if (!fileInfo.exists()) {
qCritical() << "Requested file:" << fileInfo.absoluteFilePath() << "does not exist!";
return false;
}
if (!obj.contains("title"))
return false;
title = obj.value("title").toString();
@ -47,6 +36,25 @@ bool ProjectFile::init()
}
type = typeParsed.value();
// Required:
if (!obj.contains("file"))
return false;
file = obj.value("file").toString();
if (type == ScreenPlay::InstalledType::InstalledType::GodotWallpaper) {
QFileInfo fileInfo(folder.path() + "/wallpaper.tscn");
if (!fileInfo.exists()) {
qCritical() << "Requested file:" << fileInfo.absoluteFilePath() << "does not exist!";
return false;
}
} else {
QFileInfo fileInfo(folder.path() + "/" + file);
if (!fileInfo.exists()) {
qCritical() << "Requested file:" << fileInfo.absoluteFilePath() << "does not exist!";
return false;
}
}
// Optional:
if (!obj.contains("description"))
description = obj.value("description").toString();

View File

@ -0,0 +1,35 @@
# SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
add_subdirectory(GDExtention)
# Disable for ci because it uses separate build step.
# if(NOT ${GITLAB_CI} AND ${GODOT_WALLPAPER})
# # Normally I would directly call the Godot executable here but after hours of failure without any error messages, lets just call the
# # python script that we want to have anyway...
# find_package(Python COMPONENTS Interpreter)
# message(STATUS "GODOT_WORKING_DIRECTORY = ${CMAKE_SOURCE_DIR}/Tools")
# message(STATUS "Generate Godot export:")
# message(STATUS "cd ${CMAKE_SOURCE_DIR}/Tools")
# message(STATUS "python build_godot.py --skip_if_exists --build_path '${CMAKE_RUNTIME_OUTPUT_DIRECTORY}'")
# execute_process(
# COMMAND ${Python_EXECUTABLE} build_godot.py --skip_if_exists --build_path "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
# WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Tools"
# TIMEOUT 30
# RESULT_VARIABLE GODOT_EXPORT_RESULT
# OUTPUT_VARIABLE GODOT_EXPORT_OUTPUT ENCODING UTF8)
# if(GODOT_EXPORT_RESULT EQUAL "1")
# message(STATUS "Godot export skipped because it already exists.")
# elseif(
# NOT
# GODOT_EXPORT_RESULT
# EQUAL
# "0")
# message(STATUS "################################################")
# message(STATUS "Unable to export Map. Please run Tools/setup.py!")
# message(STATUS "################################################")
# message(FATAL_ERROR "ERROR: ${GODOT_EXPORT_OUTPUT}")
# endif()
# endif()

View File

@ -19,6 +19,14 @@ void ScreenPlayGodotWallpaper::_bind_methods()
godot::ClassDB::bind_method(godot::D_METHOD("create_named_pipe"), &ScreenPlayGodotWallpaper::create_named_pipe);
}
void ScreenPlayGodotWallpaper::hideFromTaskbar(HWND hwnd)
{
LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
lExStyle |= WS_EX_TOOLWINDOW; // Add WS_EX_TOOLWINDOW
lExStyle &= ~WS_EX_APPWINDOW; // Remove WS_EX_APPWINDOW
SetWindowLong(hwnd, GWL_EXSTYLE, lExStyle);
}
ScreenPlayGodotWallpaper::ScreenPlayGodotWallpaper()
{
mID = ++sLastID;
@ -93,6 +101,7 @@ bool ScreenPlayGodotWallpaper::configureWindowGeometry()
SetWindowLongPtr(m_hook->windowHandle, GWL_STYLE, WS_POPUPWINDOW);
return true;
}
bool ScreenPlayGodotWallpaper::init(int activeScreen)
{
auto* displayServer = godot::DisplayServer::get_singleton();
@ -100,6 +109,7 @@ bool ScreenPlayGodotWallpaper::init(int activeScreen)
HWND hwnd = reinterpret_cast<HWND>(static_cast<intptr_t>(handle_int));
m_hook = std::make_unique<WindowsHook>();
m_hook->windowHandle = hwnd;
hideFromTaskbar(hwnd);
if (!configureWindowGeometry()) {
return false;
}

View File

@ -29,6 +29,7 @@ protected:
private:
bool configureWindowGeometry();
void hideFromTaskbar(HWND hwnd);
private:
static int sInstanceCount;
@ -37,6 +38,6 @@ private:
int mID;
std::unique_ptr<WindowsHook> m_hook;
HANDLE hPipe;
double time_since_last_read = 0.0;
double timesinceLastRead = 0.0;
bool isPipeActive = false;
};

View File

@ -8,3 +8,6 @@ compatibility_minimum = 4.1
linux.debug.x86_64 = "lib/Linux-x86_64/libScreenPlayGodotWallpaper-d.so"
macos.debug = "lib/Darwin-Universal/libScreenPlayGodotWallpaper-d.dylib"
windows.debug.x86_64 = "lib/Windows-AMD64/ScreenPlayGodotWallpaper-d.dll"
linux.release.x86_64 = "lib/Linux-x86_64/libScreenPlayGodotWallpaper.so"
macos.release = "lib/Darwin-universal/libScreenPlayGodotWallpaper.dylib"
windows.release.x86_64 = "lib/Windows-AMD64/ScreenPlayGodotWallpaper.dll"

View File

@ -8,7 +8,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../SP_export/export.exe"
export_path="./ScreenPlayWallpaperGodot.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false

View File

@ -11,7 +11,12 @@ var checkWallpaperVisible = false
func _ready():
# "C:\\Code\\cpp\\ScreenPlay\\ScreenPlay\\Content\\wallpaper_godot_fjord\\fjord.zip"
var path = "C:\\Code\\cpp\\ScreenPlay\\ScreenPlay\\Content\\wallpaper_godot_fjord\\fjord.zip"
var path
var args = OS.get_cmdline_args()
if( args.size() > 1):
parse_args()
path = "C:\\Code\\cpp\\ScreenPlay\\ScreenPlay\\Content\\wallpaper_godot_fjord\\fjord.zip"
var success = ProjectSettings.load_resource_pack (path)
if success:
var scene_resource = load("res://wallpaper.tscn")
@ -25,30 +30,26 @@ func _ready():
else:
print("Failed to load the PCK file.")
Engine.set_max_fps(24)
func parse_args():
var args = OS.get_cmdline_args()
var i = 0
while i < args.size():
match args[i]:
"--ActiveScreensList":
i += 1
activeScreensList = args[i].split(",")
for idx in range(activeScreensList.size()):
activeScreensList[idx] = int(activeScreensList[idx])
"--ProjectPath":
i += 1
projectPath = args[i]
"--appID":
i += 1
appID = args[i]
"--volume":
i += 1
volume = float(args[i])
"--fillmode":
i += 1
fillmode = int(args[i])
"--CheckWallpaperVisible":
i += 1
checkWallpaperVisible = args[i].to_lower() == "true"
i += 1
if args.size() < 7: # Adjust this number based on the expected number of arguments
print("Not enough arguments provided!")
return
# Parse the arguments based on their expected positions
activeScreensList = args[0].split(",")
for idx in range(activeScreensList.size()):
activeScreensList[idx] = int(activeScreensList[idx])
projectPath = args[1]
appID = args[2]
volume = float(args[3])
fillmode = int(args[4])
# Assuming 'type' is not a global variable since it's not listed above
var type = args[5] # This might need further parsing depending on its expected format
checkWallpaperVisible = args[6].to_lower() == "true"
# Print or use the parsed values as needed
print(activeScreensList, projectPath, appID, volume, fillmode, type, checkWallpaperVisible)

View File

@ -26,6 +26,10 @@ window/size/initial_position_type=0
window/size/initial_position=Vector2i(9999999, 9999999)
window/size/borderless=true
[filesystem]
import/blender/enabled=false
[rendering]
renderer/rendering_method="mobile"

View File

@ -9,3 +9,6 @@ add_custom_target(
${PROJECT_NAME}
SOURCES ${FILES} ${PYTHON}
COMMENT "Dummy target to list these files in the IDE")
set(GODOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Apps/Godot")
configure_file(${GODOT_PATH}/${GODOT_EDITOR_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ COPYONLY)

48
Tools/build_godot.py Normal file
View File

@ -0,0 +1,48 @@
#!/usr/bin/python3
import os
import util
import defines
from pathlib import Path
from execute_util import execute
import argparse
def main():
# Parse build folder as arugment
parser = argparse.ArgumentParser(description='Build K3000Map to the bin build folder: D:/Backup/Code/Qt/build_ScreenPlay_Qt_6.5.2_MSVC_Debug/bin')
parser.add_argument('--build_path', dest="build_path", type=str, help='Build folder')
parser.add_argument('--skip_if_exists', dest="skip_if_exists", default=False, action="store_true", help='Skips the build if the index.html file exists. This is used for faster CMake configure')
args = parser.parse_args()
if not args.build_path:
print("ERROR: Please specify the build folder")
print("py build_godot.py --build_path D:/Backup/Code/Qt/build_ScreenPlay_Qt_6.5.2_MSVC_Debug/bin/")
exit()
# if build path exists and contains a index.html file, skip the build
if args.skip_if_exists:
screenPlayWallpaperGodot_executable = Path(args.build_path).joinpath(defines.SCREENPLAYWALLPAPER_GODOT_EXECUTABLE)
if screenPlayWallpaperGodot_executable.exists:
print(f"Skipping build, because {defines.SCREENPLAYWALLPAPER_GODOT_EXECUTABLE} exists")
exit(1)
abs_build_path = args.build_path
if not os.path.isabs(args.build_path):
abs_build_path = os.path.abspath(os.path.join(os.getcwd(), args.build_path))
build_godot(abs_build_path)
def build_godot(abs_build_path: str):
project_path = Path(util.repo_root_path()).joinpath("ScreenPlayWallpaper/Godot/ScreenPlayGodot").resolve()
apps_path = os.path.join(util.repo_root_path(),"Tools/Apps/Godot")
godot_executable = os.path.join(apps_path, defines.GODOT_EDITOR_EXECUTABLE)
screenPlayWallpaperGodot_executable = Path(abs_build_path).joinpath(defines.SCREENPLAYWALLPAPER_GODOT_EXECUTABLE).resolve()
export_command = f'"{godot_executable}" -v --headless --export-release "Windows Desktop" "{screenPlayWallpaperGodot_executable}"'
# We get random error on successful export, so lets ignore it
execute(command=export_command,workingDir=project_path,ignore_error=True)
if __name__ == "__main__":
main()

View File

@ -28,4 +28,21 @@ QT_IFW_VERSION = "4.6"
VCPKG_VERSION = "f06975f46d8c7a1dad916e1e997584f77ae0c34a"
PYTHON_EXECUTABLE = "python" if sys.platform == "win32" else "python3"
FFMPEG_VERSION = "5.0.1"
GODOT_VERSION = "4.1.1"
GODOT_RELEASE_TYPE = "stable"
if sys.platform == "win32":
SCREENPLAYWALLPAPER_GODOT_EXECUTABLE = "ScreenPlayWallpaperGodot.exe"
GODOT_EDITOR_EXECUTABLE = f"Godot_v{GODOT_VERSION}-{GODOT_RELEASE_TYPE}_win64.exe"
GODOT_TEMPLATES_PATH = os.path.join(os.getenv(
'APPDATA'), f"Godot/templates/{GODOT_VERSION}.{GODOT_RELEASE_TYPE}")
elif sys.platform == "darwin":
SCREENPLAYWALLPAPER_GODOT_EXECUTABLE = "ScreenPlayWallpaperGodot.app"
GODOT_EDITOR_EXECUTABLE = f"Godot_v{GODOT_VERSION}-{GODOT_RELEASE_TYPE}_osx.universal"
GODOT_TEMPLATES_PATH = "TODO"
elif sys.platform == "linux":
SCREENPLAYWALLPAPER_GODOT_EXECUTABLE = "ScreenPlayWallpaperGodot"
GODOT_EDITOR_EXECUTABLE = f"Godot_v{GODOT_VERSION}-{GODOT_RELEASE_TYPE}_x11.64"
# /home/eli/.local/share/godot/templates/
GODOT_TEMPLATES_PATH = os.path.join(
Path.home(), f".local/share/godot/templates/{GODOT_VERSION}.{GODOT_RELEASE_TYPE}")