Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.simple
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ifeq (${OS},linux)
endif

ifeq (${OS},mingw)
CXXFLAGS_EARLY += -DWINDOWS -mwindows -D_A_VOLID=8
CXXFLAGS_EARLY += -DWINDOWS -mwindows -D_A_VOLID=8 -I/msys2/mingw64/include
EXE_EXTENSION := .exe
LDFLAGS_GL := -lopengl32
LDFLAGS_GLEW := -lglew32
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<img align="right" src="https://badges.herokuapp.com/travis/zenorogue/hyperrogue?branch=master&env=TRAVIS_BUILD_SYSTEM=autotools&label=autotools" alt="TravisCI badge">
<img align="right" src="https://badges.herokuapp.com/travis/zenorogue/hyperrogue?branch=master&env=TRAVIS_BUILD_SYSTEM=Makefile&label=make" alt="TravisCI badge">
<img align="right" src="https://badges.herokuapp.com/travis/zenorogue/hyperrogue?branch=master&env=TRAVIS_BUILD_SYSTEM=emscripten&label=web" alt="TravisCI badge">
<br>
<img align="right" src="https://ci.appveyor.com/api/projects/status/github/zenorogue/hyperrogue?svg=true" alt="AppVeyor badge">
</a>
</p>
<p align="left">
Expand Down
97 changes: 97 additions & 0 deletions appveyor.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
cd %APPVEYOR_BUILD_FOLDER%
setlocal

if "%TRAVIS_OS_NAME%" == "mingw" (
set "PATH=C:\%MSYS2_DIR%\%MSYSTEM%\bin;C:\%MSYS2_DIR%\usr\bin;%PATH%"
) else if "%TRAVIS_OS_NAME%" == "windows" (
call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG%
)

if "%TRAVIS_STAGE%" == "before_build" (

REM Install SDL.
if "%TRAVIS_OS_NAME%" == "mingw" (
pacman --noconfirm --noprogressbar -Syu
pacman --noconfirm --noprogressbar -Sy base-devel
pacman --noconfirm --noprogressbar -Sy mingw-w64-x86_64-SDL mingw-w64-x86_64-SDL_gfx mingw-w64-x86_64-SDL_mixer mingw-w64-x86_64-SDL_ttf
) else if "%TRAVIS_OS_NAME%" == "windows" (
cd %TEMP%
powershell Invoke-WebRequest -OutFile SDL.zip -Uri https://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip
unzip SDL.zip
mkdir %APPVEYOR_BUILD_FOLDER%\include\SDL
move SDL-1.2.15\include\*.h %APPVEYOR_BUILD_FOLDER%\include\SDL\
move SDL-1.2.15\lib\x64\*.* %APPVEYOR_BUILD_FOLDER%\dll\

powershell Invoke-WebRequest -OutFile SDL_mixer.zip -Uri https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-devel-1.2.12-VC.zip
unzip SDL_mixer.zip
mkdir %APPVEYOR_BUILD_FOLDER%\include\SDL
move SDL_mixer-1.2.12\include\*.h %APPVEYOR_BUILD_FOLDER%\include\SDL\
move SDL_mixer-1.2.12\lib\x64\*.* %APPVEYOR_BUILD_FOLDER%\dll\

powershell Invoke-WebRequest -OutFile SDL_ttf.zip -Uri https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-devel-2.0.11-VC.zip
unzip SDL_ttf.zip
mkdir %APPVEYOR_BUILD_FOLDER%\include\SDL
move SDL_ttf-2.0.11\include\*.h %APPVEYOR_BUILD_FOLDER%\include\SDL\
move SDL_ttf-2.0.11\lib\x64\*.* %APPVEYOR_BUILD_FOLDER%\dll\
cd %APPVEYOR_BUILD_FOLDER%
) else (
exit 'Unsupported OS'
)

REM Install GLEW if asked for
if "%HYPERROGUE_USE_GLEW%" == "1" (
if "%TRAVIS_OS_NAME%" == "mingw" (
pacman --noconfirm --noprogressbar -Sy mingw-w64-x86_64-glew
) else if "%TRAVIS_OS_NAME%" == "windows" (
cd %TEMP%
powershell Invoke-WebRequest -OutFile GLEW.zip -Uri https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0-win32.zip
unzip GLEW.zip
mkdir %APPVEYOR_BUILD_FOLDER%\include\GL
move glew-2.1.0\include\GL\* %APPVEYOR_BUILD_FOLDER%\include\GL\
move glew-2.1.0\lib\Release\x64\* %APPVEYOR_BUILD_FOLDER%\dll\
move glew-2.1.0\bin\Release\x64\* %APPVEYOR_BUILD_FOLDER%\dll\
cd %APPVEYOR_BUILD_FOLDER%
) else (
exit 'Unsupported OS'
)
)

REM Install autotools if asked for
if "%TRAVIS_BUILD_SYSTEM%" == "autotools" (
if "%TRAVIS_OS_NAME%" == "mingw" (
pacman --noconfirm --noprogressbar -Sy automake autoconf
) else (
exit 'Unsupported OS'
)
)

) else if "%TRAVIS_STAGE%" == "build_script" (

REM Build hyperrogue.
if "%TRAVIS_BUILD_SYSTEM%" == "autotools" (
bash -c "autoreconf -vi"
bash -c "./configure CXXFLAGS='-Wall -Werror'"
bash -c "make"
) else if "%TRAVIS_BUILD_SYSTEM%" == "Makefile" (
make -f Makefile.simple
) else if "%TRAVIS_BUILD_SYSTEM%" == "msvc" (
cl -std:c++latest -W2 -WX -EHsc langen.cpp
.\langen.exe > language-data.cpp
cl -std:c++latest -W2 -WX -wd4068 -wd4244 -EHsc -bigobj -I include -D_USE_MATH_DEFINES=1 ^
-DWINDOWS=1 -DCAP_SDLGFX=0 -DCAP_PNG=0 -DCAP_SAVE=0 -DCAP_ROGUEVIZ=1 hyper.cpp ^
opengl32.lib dll\glew32.lib dll\SDL.lib dll\SDL_mixer.lib dll\SDL_ttf.lib /Fe: hyperrogue.exe
) else (
exit 'Unsupported build system'
)

) else if "%TRAVIS_STAGE%" == "test_script" (

set "PATH=%APPVEYOR_BUILD_FOLDER%\dll;%PATH%"
.\hyperrogue.exe --help

REM Test "make dist". ("make distcheck" is expected to fail.)
if "%TRAVIS_BUILD_SYSTEM%" == "autotools" bash -c "make dist"

REM Test "sudo make install".
if "%TRAVIS_BUILD_SYSTEM%" == "autotools" bash -c "make install"
)
35 changes: 35 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
environment:
matrix:
- TRAVIS_OS_NAME: windows
TRAVIS_COMPILER_NAME: msvc
TRAVIS_BUILD_SYSTEM: msvc
HYPERROGUE_USE_GLEW: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
MSVC_SETUP_ARG: x64
- TRAVIS_OS_NAME: mingw
TRAVIS_COMPILER_NAME: gcc
TRAVIS_BUILD_SYSTEM: autotools
HYPERROGUE_USE_GLEW: 1
MSYS2_ARCH: x86_64
MSYS2_DIR: msys64
MSYSTEM: MINGW64
- TRAVIS_OS_NAME: mingw
TRAVIS_COMPILER_NAME: gcc
TRAVIS_BUILD_SYSTEM: Makefile
HYPERROGUE_USE_GLEW: 1
MSYS2_ARCH: x86_64
MSYS2_DIR: msys64
MSYSTEM: MINGW64

before_build:
- set TRAVIS_STAGE=before_build
- call appveyor.bat

build_script:
- set TRAVIS_STAGE=build_script
- call appveyor.bat

test_script:
- set TRAVIS_STAGE=test_script
- call appveyor.bat
3 changes: 1 addition & 2 deletions dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ namespace dialog {

color_t *colorPointer;

bool handleKeyColor(int sym, int uni) {
void handleKeyColor(int sym, int uni) {
unsigned& color = *colorPointer;
int shift = colorAlpha ? 0 : 8;

Expand Down Expand Up @@ -514,7 +514,6 @@ namespace dialog {
else if(doexiton(sym, uni)) {
popScreen();
}
return false;
}

bool colorAlpha;
Expand Down
6 changes: 3 additions & 3 deletions graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1840,9 +1840,9 @@ int taildist(cell *c) {
}

int last_wormsegment = -1;
vector<vector< std::function<void()> > > wormsegments;
vector<vector< function<void()> > > wormsegments;

void add_segment(int d, const std::function<void()>& s) {
void add_segment(int d, const function<void()>& s) {
if(isize(wormsegments) <= d) wormsegments.resize(d+1);
last_wormsegment = max(last_wormsegment, d);
wormsegments[d].push_back(s);
Expand Down Expand Up @@ -5727,7 +5727,7 @@ void drawscreen() {
mouseovers = " ";

cmode = 0;
keyhandler = [] (int sym, int uni) { return false; };
keyhandler = [] (int sym, int uni) {};
#if CAP_SDL
joyhandler = [] (SDL_Event& ev) { return false; };
#endif
Expand Down
7 changes: 6 additions & 1 deletion hyper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define VERNUM_HEX 0xA504

#include <stdarg.h>
#include "hyper_function.h"

namespace hr {

Expand All @@ -15,6 +16,8 @@ void ignore(T&&) {
// placate GCC's overzealous -Wunused-result
}

template<class Sig> using function = hyper_function<Sig>;

// functions and types used from the standard library
using std::vector;
using std::map;
Expand All @@ -24,7 +27,6 @@ using std::sort;
using std::multimap;
using std::set;
using std::string;
using std::function;
using std::pair;
using std::tuple;
using std::shared_ptr;
Expand Down Expand Up @@ -4216,6 +4218,9 @@ void virtualRebaseSimple(heptagon*& base, transmatrix& at);

extern bool game_active, playerfound;

extern bool twopoint_do_flips;
extern int twopoint_sphere_flips;

string bygen(reaction_t h);

#if CAP_URL
Expand Down
69 changes: 69 additions & 0 deletions hyper_function.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#pragma once

#include <type_traits>

template<class Sig>
class hyper_function;

template<class R, class... Args>
struct hyper_function_state_base {
virtual R call(Args...) const = 0;
virtual hyper_function_state_base *clone() const = 0;
virtual ~hyper_function_state_base() = default;
};

template<class T, class R, class... Args>
struct hyper_function_state : hyper_function_state_base<R, Args...> {
using Self = hyper_function_state<T, R, Args...>;
T t_;
explicit hyper_function_state(T t) : t_(std::move(t)) {}
R call(Args... args) const override {
return const_cast<T&>(t_)(static_cast<Args&&>(args)...);
}
hyper_function_state_base<R, Args...> *clone() const override {
return new Self(*this);
}
};

template<class R, class... Args>
class hyper_function<R(Args...)>
{
hyper_function_state_base<R, Args...> *ptr_ = nullptr;
public:
hyper_function() = default;

template<class Callable, class = decltype(R(std::declval<typename std::decay<Callable>::type>()(std::declval<Args>()...)))>
hyper_function(Callable&& t) :
ptr_(new hyper_function_state<typename std::decay<Callable>::type, R, Args...>(static_cast<Callable&&>(t)))
{}

~hyper_function() {
delete ptr_;
}

hyper_function(hyper_function& rhs) : ptr_(rhs.ptr_ ? rhs.ptr_->clone() : nullptr) {}
hyper_function(const hyper_function& rhs) : ptr_(rhs.ptr_ ? rhs.ptr_->clone() : nullptr) {}
hyper_function(hyper_function&& rhs) noexcept : ptr_(rhs.ptr_) { rhs.ptr_ = nullptr; }
hyper_function(const hyper_function&& rhs) = delete;

void operator=(const hyper_function& rhs) {
if (&rhs != this) {
delete ptr_;
ptr_ = (rhs.ptr_ ? rhs.ptr_->clone() : nullptr);
}
}
void operator=(hyper_function&& rhs) noexcept {
if (&rhs != this) {
delete ptr_;
ptr_ = rhs.ptr_; rhs.ptr_ = nullptr;
}
}

R operator()(Args... args) const {
return ptr_->call(static_cast<Args&&>(args)...);
}

explicit operator bool() const noexcept {
return ptr_ != nullptr;
}
};
4 changes: 1 addition & 3 deletions polygons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void addpoint(const hyperpoint& H) {
}
else {
poly_flags |= POLY_NOTINFRONT;
tofix.push_back(make_pair(glcoords.size(), H));
tofix.emplace_back(isize(glcoords), H);
add1(H);
return;
}
Expand Down Expand Up @@ -867,8 +867,6 @@ void dqi_poly::draw() {
if(sphere && pmodel == mdTwoPoint && !in_twopoint) {
#define MAX_PHASE 4
vector<glvertex> phases[MAX_PHASE];
extern int twopoint_sphere_flips;
extern bool twopoint_do_flips;
int pha;
if(twopoint_do_flips) {
for(int i=0; i<cnt; i++) {
Expand Down
3 changes: 1 addition & 2 deletions rogueviz-banachtarski.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ void bantar_anim() {

bool bmap;

bool bantar_stats() {
void bantar_stats() {
if(bmap) {
vid.linewidth *= (inHighQual ? 10 : 2);
for(auto p: parent) if(gmatrix.count(p.first) && gmatrix.count(p.second))
Expand All @@ -458,7 +458,6 @@ bool bantar_stats() {
vid.linewidth /= (inHighQual ? 10 : 2);
drawqueue();
}
return false;
}

void init_bantar() {
Expand Down
3 changes: 1 addition & 2 deletions rogueviz-graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,14 @@ void show_graph() {
};
}

bool frame() {
void frame() {
if(graphcolor) {
hyperpoint h0 = find_point(0);
hyperpoint h1 = find_point(1);
if(!iserror(h0)) xcurvepoint(h0);
draw_to(0, h0, 1, h1);
finish();
}
return false;
}

#if CAP_COMMANDLINE
Expand Down
6 changes: 3 additions & 3 deletions screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,11 +822,11 @@ void show() {
dialog::add_action([] () {
dialog::editNumber(cycle_length, 0, 10, 0.1, 2*M_PI, "shift", "");
dialog::extra_options = [] () {
dialog::addSelItem(XLAT("full circle"), fts(2 * M_PI), 'A');
dialog::addSelItem(XLAT("full circle"), fts(float(2 * M_PI)), 'A');
dialog::add_action([] () { cycle_length = 2 * M_PI; });
dialog::addSelItem(XLAT("Zebra period"), fts(2.898149445355172), 'B');
dialog::addSelItem(XLAT("Zebra period"), fts(2.898149445355172f), 'B');
dialog::add_action([] () { cycle_length = 2.898149445355172; });
dialog::addSelItem(XLAT("Bolza period"), fts(2 * 1.528571), 'C');
dialog::addSelItem(XLAT("Bolza period"), fts(2 * 1.528571f), 'C');
dialog::add_action([] () { cycle_length = 2 * 1.528571; });
};
});
Expand Down