Get it building and launching something

This commit is contained in:
ultra
2016-10-11 22:56:28 -04:00
committed by Celtic Minstrel
parent ffa2d0e950
commit 057aade18b
8 changed files with 261 additions and 3 deletions

View File

@@ -302,7 +302,7 @@ Export("env platform")
common_classes, party_classes = SConscript("build/obj/classes/SConscript")
tools = SConscript("build/obj/tools/SConscript")
dlog_util = SConscript("build/obj/dialogxml/SConscript")
common_sources = common_classes + dlog_util + tools
common_sources = dlog_util + tools + common_classes
install_dir = "#build/Blades of Exile"
Export("install_dir party_classes common_sources")

View File

@@ -2,6 +2,7 @@
from __future__ import print_function
import os.path as path
import subprocess
import os
Import("env platform data_dir install_dir")
@@ -30,7 +31,9 @@ env.Install(path.join(install_dir, "Blades of Exile Base"), Glob("Blades of Exil
have_xmllint = False
if ((str(platform) != "win32" and subprocess.call(['which', '-s', 'xmllint']) == 0) or
nulldev = open(os.devnull, 'w')
if ((str(platform) != "win32" and subprocess.call(['which', 'xmllint'], stdout=nulldev, stderr=nulldev) == 0) or
(str(platform) == "win32" and subprocess.call(['where', '/Q', 'xmllint'])) == 0):
have_xmllint = True
xmllint_command = ('xmllint', '--nonet', '--noout', '--schema', '../schemas/dialog.xsd')

View File

@@ -34,8 +34,12 @@ elif str(platform) == "win32":
boe.menus.win.cpp
"""))
game_sources.append(env.RES('#build/obj/BladesOfExile.res', '#rsrc/menus/BladesOfExile.rc'))
elif str(platform) == "posix":
game_sources.extend(Split("""
boe.menus.linux.cpp
"""))
boe = env.Program("#build/bin/Blades of Exile", game_sources + common_sources + party_classes)
boe = env.Program("#build/bin/Blades of Exile", game_sources + party_classes + common_sources)
if str(platform) == "darwin":
boe_info = {

64
src/boe.menus.linux.cpp Normal file
View File

@@ -0,0 +1,64 @@
#include "boe.menus.hpp"
#include <map>
#include <sstream>
#include <SFML/Graphics/RenderWindow.hpp>
#include "universe.hpp"
#include "boe.party.hpp"
#include "boe.infodlg.hpp"
#include "boe.consts.hpp"
#include "spell.hpp"
#include "winutil.hpp"
// This is the index of each menu on the menubar
enum {
FILE_MENU_POS = 0,
OPT_MENU_POS = 1,
ACT_MENU_POS = 2,
MONST_MENU_POS = 3,
MAGE_MENU_POS = 4,
PRIEST_MENU_POS = 5,
LIB_MENU_POS = 6,
HELP_MENU_POS = 7,
};
extern short on_spell_menu[2][62];
extern short on_monst_menu[256];
extern bool party_in_memory;
extern cUniverse univ;
extern eGameMode overall_mode;
extern sf::RenderWindow mainPtr;
std::map<int,eMenu> menuChoices;
void init_menubar() {
}
void adjust_monst_menu() {
}
void init_spell_menus() {
}
void adjust_spell_menus() {
}
void menu_activate() {
}
void hideMenuBar() {
}
void showMenuBar() {
}
#include "cursors.hpp"
#include "fileio.hpp"
#include "boe.graphics.hpp"
#include "boe.actions.hpp"
#include "boe.fileio.hpp"
extern bool ae_loading, finished_init;
void set_up_apple_events(int argc, char* argv[]) {
}

View File

@@ -20,6 +20,9 @@ if str(platform) == "darwin":
tools.extend(Glob("*.mac.*"))
elif str(platform) == "win32":
tools.extend(Glob("*.win.cpp"))
elif str(platform) == "posix":
tools.extend(Glob("*.linux.cpp"))
tools.append("prefs.win.cpp")
tools_obj = env.StaticLibrary("#build/lib/tools", tools)

View File

@@ -0,0 +1,20 @@
#include "cursors.hpp"
Cursor::Cursor(fs::path imgPath, float hotSpotX, float hotSpotY) {
}
Cursor::~Cursor() {
}
void Cursor::apply() {
}
void obscureCursor() {
}
void set_cursor(cursor_type which_c) {
}
void restore_cursor() {
}

View File

@@ -11,6 +11,7 @@
#include <string>
#include <vector>
#include <algorithm>
void set_pref(std::string keypath, bool value);
bool get_bool_pref(std::string keypath, bool fallback = false);

163
src/tools/winutil.linux.cpp Normal file
View File

@@ -0,0 +1,163 @@
#include "winutil.hpp"
#include <iostream>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Image.hpp>
#include <sstream>
extern sf::RenderWindow mainPtr;
// TODO: I'm sure there's a better way to do this (maybe one that's keyboard layout agnostic)
// The proper way would involve use of the TextEntered event
char keyToChar(sf::Keyboard::Key key, bool isShift) {
using kb = sf::Keyboard;
switch(key) {
case kb::A: return isShift ? 'A' : 'a';
case kb::B: return isShift ? 'B' : 'b';
case kb::C: return isShift ? 'C' : 'c';
case kb::D: return isShift ? 'D' : 'd';
case kb::E: return isShift ? 'E' : 'e';
case kb::F: return isShift ? 'F' : 'f';
case kb::G: return isShift ? 'G' : 'g';
case kb::H: return isShift ? 'H' : 'h';
case kb::I: return isShift ? 'I' : 'i';
case kb::J: return isShift ? 'J' : 'j';
case kb::K: return isShift ? 'K' : 'k';
case kb::L: return isShift ? 'L' : 'l';
case kb::M: return isShift ? 'M' : 'm';
case kb::N: return isShift ? 'N' : 'n';
case kb::O: return isShift ? 'O' : 'o';
case kb::P: return isShift ? 'P' : 'p';
case kb::Q: return isShift ? 'Q' : 'q';
case kb::R: return isShift ? 'R' : 'r';
case kb::S: return isShift ? 'S' : 's';
case kb::T: return isShift ? 'T' : 't';
case kb::U: return isShift ? 'U' : 'u';
case kb::V: return isShift ? 'V' : 'v';
case kb::W: return isShift ? 'W' : 'w';
case kb::X: return isShift ? 'X' : 'x';
case kb::Y: return isShift ? 'Y' : 'y';
case kb::Z: return isShift ? 'Z' : 'z';
case kb::Num1: return isShift ? '!' : '1';
case kb::Num2: return isShift ? '@' : '2';
case kb::Num3: return isShift ? '#' : '3';
case kb::Num4: return isShift ? '$' : '4';
case kb::Num5: return isShift ? '%' : '5';
case kb::Num6: return isShift ? '^' : '6';
case kb::Num7: return isShift ? '&' : '7';
case kb::Num8: return isShift ? '*' : '8';
case kb::Num9: return isShift ? '(' : '9';
case kb::Num0: return isShift ? ')' : '0';
case kb::Tilde: return isShift ? '~' : '`';
case kb::Dash: return isShift ? '_' : '-';
case kb::Equal: return isShift ? '+' : '=';
case kb::LBracket: return isShift ? '{' : '[';
case kb::RBracket: return isShift ? '}' : ']';
case kb::SemiColon: return isShift ? ':' : ';';
case kb::Quote: return isShift ? '"' : '\'';
case kb::Comma: return isShift ? '<' : ',';
case kb::Period: return isShift ? '>' : '.';
case kb::Slash: return isShift ? '?' : '/';
case kb::BackSlash: return isShift ? '|' : '\\';
case kb::Tab: return '\t';
case kb::Space: return ' ';
case kb::Return: return '\n';
case kb::BackSpace: return '\b';
case kb::Delete: return '\x7f';
case kb::Numpad0: return '0';
case kb::Numpad1: return '1';
case kb::Numpad2: return '2';
case kb::Numpad3: return '3';
case kb::Numpad4: return '4';
case kb::Numpad5: return '5';
case kb::Numpad6: return '6';
case kb::Numpad7: return '7';
case kb::Numpad8: return '8';
case kb::Numpad9: return '9';
// TODO: Should have Equal here, but SFML doesn't distinguish between normal and keybad equal :/
// Ditto for the decimal point.
case kb::Divide: return '/';
case kb::Multiply: return '*';
case kb::Subtract: return '-';
case kb::Add: return '+';
default: break;
}
return 0;
}
std::string get_os_version() {
return "Microsoft Windows XP";
}
void makeFrontWindow(sf::Window& win) {
}
void setWindowFloating(sf::Window& win, bool floating) {
}
void init_fileio() {
}
fs::path nav_get_party() {
return "";
}
fs::path nav_put_party(fs::path def) {
return "";
}
fs::path nav_get_scenario() {
return "";
}
fs::path nav_put_scenario(fs::path def) {
return "";
}
fs::path nav_get_rsrc(std::initializer_list<std::string> extensions) {
return "";
}
fs::path nav_put_rsrc(std::initializer_list<std::string> extensions, fs::path def) {
return "";
}
void set_clipboard(std::string text) {
}
std::string get_clipboard() {
return "";
}
static void printErr(std::string msg) {
}
void set_clipboard_img(sf::Image& img) {
}
std::unique_ptr<sf::Image> get_clipboard_img() {
return nullptr;
}
void beep() {
}
void launchURL(std::string url) {
}
// TODO: Implement modal session.
// It seems that Windows doesn't have anything similar to the Mac modal session, so I might have to somehow simulate it myself.
void ModalSession::pumpEvents() {
}
ModalSession::ModalSession(sf::Window& win, sf::Window& p) : parent(&p) {
}
ModalSession::~ModalSession() {
}
int getMenubarHeight() {
return 1;
}