Merge branch 'linux'

This commit is contained in:
Vinyl Darkscratch 2018-03-12 02:19:57 -07:00
commit 79e3449dd3
5 changed files with 73 additions and 8 deletions

1
.gitignore vendored
View file

@ -29,6 +29,7 @@ oneshot_JA_2_ver3_checked.pot
oneshot_JA_Mariko1_WIP.pot
*.pot
xScripts.rxdata
OneShot
.qmake.stash
CMakeCache.txt

View file

@ -20,7 +20,13 @@ static bool isCached = false;
#ifdef __APPLE__
#include "mac-desktop.h"
#else
// XXX Implement me!
#include <giomm/settings.h>
#include <unistd.h>
#include <sstream>
Glib::RefPtr<Gio::Settings> bgsetting = Gio::Settings::create("org.gnome.desktop.background");
std::string defPictureURI = bgsetting->get_string("picture-uri");
std::string defPictureOptions = bgsetting->get_string("picture-options");
std::string defPrimaryColor = bgsetting->get_string("primary-color");
#endif
#endif
@ -110,7 +116,17 @@ end:
}
MacDesktop::ChangeBackground(imgname, ((color >> 16) & 0xFF) / 255.0, ((color >> 8) & 0xFF) / 255.0, ((color) & 0xFF) / 255.0);
#else
// XXX Implement me!
char gameDir[1024];
if (getcwd(gameDir, sizeof(gameDir)) != NULL) {
std::string gameDirStr(gameDir);
std::stringstream hexColor;
hexColor << "#" << std::hex << color;
bgsetting->set_string("picture-uri", "file://" + gameDirStr + "/Wallpaper/" + imageName + ".png");
bgsetting->set_string("picture-options", "scaled");
bgsetting->set_string("primary-color", hexColor.str());
} else {
// Error handling?
}
#endif
#endif
return Qnil;
@ -148,7 +164,9 @@ RB_METHOD(wallpaperReset)
#ifdef __APPLE__
MacDesktop::ResetBackground();
#else
// XXX Implement me!
bgsetting->set_string("picture-uri", defPictureURI);
bgsetting->set_string("picture-options", defPictureOptions);
bgsetting->set_string("primary-color", defPrimaryColor);
#endif
#endif
return Qnil;
@ -156,9 +174,9 @@ RB_METHOD(wallpaperReset)
void wallpaperBindingInit()
{
VALUE module = rb_define_module("Wallpaper");
VALUE module = rb_define_module("Wallpaper");
//Functions
_rb_define_module_function(module, "set", wallpaperSet);
_rb_define_module_function(module, "reset", wallpaperReset);
// Functions
_rb_define_module_function(module, "set", wallpaperSet);
_rb_define_module_function(module, "reset", wallpaperReset);
}

View file

@ -5,4 +5,5 @@ rm -rf build
rm -rf dist
rm -rf _______.app
rm -rf OneShot.app
rm -rf OneShot
make distclean

45
make-oneshot-linux.sh Executable file
View file

@ -0,0 +1,45 @@
#!/bin/sh
set -e
cd `dirname $0`
# User-configurable variables
linux_version="0.1.0"
make_threads=8
ONESHOT_PATH=$HOME/.steam/steam/steamapps/common/OneShot
# Colors
white="\033[0;37m" # White - Regular
bold="\033[1;37m" # White - Bold
cyan="\033[1;36m" # Cyan - Bold
green="\033[1;32m" # Green - Bold
color_reset="\033[0m" # Reset Colors
echo "${white}Compiling ${bold}SyngleChance v${linux_version} ${white}engine for Linux...${color_reset}\n"
# Generate makefile and build main + journal
echo "-> ${cyan}Generate makefile...${color_reset}"
qmake MRIVERSION=2.3
echo "-> ${cyan}Compile engine...${color_reset}"
make -j${make_threads}
echo "-> ${cyan}Compile journal...${color_reset}"
pyinstaller journal/unix/journal.spec --onefile --windowed
# Set version number
echo "-> ${cyan}Set version number...${color_reset}"
# Compile scripts
echo "-> ${cyan}Compile xScripts.rxdata...${color_reset}"
ruby rpgscript.rb ./scripts "$ONESHOT_PATH"
echo "-> ${cyan}Install OneShot apps to Steam directory...${color_reset}"
cp -rf "./OneShot" "$ONESHOT_PATH"
cp -rf "./dist/_______" "$ONESHOT_PATH"
# Cleanup
echo "-> ${cyan}Cleanup files...${color_reset}"
rm -rf journal/unix/__pycache__
rm -rf build
rm -rf dist
echo "\n${green}Complete! ${white}Please report any issues to https://github.com/vinyldarkscratch/synglechance/issues${color_reset}"

View file

@ -47,7 +47,7 @@ unix {
SOURCES += src/mac-desktop.mm
}
!macx: {
# PKGCONFIG += openal zlib
PKGCONFIG += giomm-2.4
INCLUDEPATH += /usr/include/AL /usr/local/include/AL
SOURCES += src/xdg-user-dir-lookup.c
LIBS += -lX11