1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 13:07:16 +00:00

adjusted mobile to the new system

This commit is contained in:
Zeno Rogue 2020-04-06 08:37:22 +02:00
parent 548f1d3c1e
commit 9a84dfb497
10 changed files with 47 additions and 27 deletions

View File

@ -607,11 +607,11 @@ EX void resetGL() {
vector<int> graphdata;
void gdpush(int t) {
EX void gdpush(int t) {
graphdata.push_back(t);
}
bool displaychr(int x, int y, int shift, int size, char chr, color_t col) {
EX bool displaychr(int x, int y, int shift, int size, char chr, color_t col) {
gdpush(2); gdpush(x); gdpush(y); gdpush(8);
gdpush(col); gdpush(size); gdpush(0);
gdpush(1); gdpush(chr);

View File

@ -1965,7 +1965,11 @@ EX void draw_main() {
if(ray::in_use && ray::comparison_mode) {
glDepthFunc(GL_LEQUAL);
#ifdef GLES_ONLY
glClearDepthf(1.0f);
#else
glClearDepth(1.0f);
#endif
glClear(GL_DEPTH_BUFFER_BIT);
ray::cast();
}

View File

@ -5,6 +5,7 @@
#define MOBPAR_FORMAL int
#define MOBPAR_ACTUAL 0
#define MIX_MAX_VOLUME 128
#define NOMAIN
#include <string>
namespace hr {
@ -40,6 +41,8 @@ transmatrix getOrientation() {
return Orient;
}
void resetmusic() { printf("resetmusic\n"); }
void playSound(cell *c, const string& fname, int vol) {
printf("Play sound: %s\n", fname.c_str());
}

View File

@ -35,6 +35,7 @@ EX int hyper_main(int argc, char **argv) {
using namespace hr;
#if ISWEB
emscripten_get_commandline();
#elif ISMOBILE
#else
arg::init(argc, argv);
#endif

View File

@ -130,5 +130,6 @@
namespace hr { namespace daily { bool on; } }
#endif
#include "mobile.cpp"
#include "hyper-main.cpp"

View File

@ -22,6 +22,7 @@
#define CAP_VERTEXBUFFER 0
#define CAP_TIMEOFDAY 1
#define NO_STD_HYPOT
#define NOMAIN
#define HNEW 1
@ -60,7 +61,7 @@ bool settingsChanged = false;
struct transmatrix getOrientation();
}
#include "../../../../../init.cpp"
#include "../../../../../hyper.cpp"
namespace hr {
@ -168,19 +169,19 @@ Java_com_roguetemple_hyperroid_HyperRogue_glhrinit(MOBPAR_FORMAL)
extern "C" int
Java_com_roguetemple_hyperroid_HyperRogue_getaPosition(MOBPAR_FORMAL)
{
return glhr::aPosition;
return aPosition;
}
extern "C" int
Java_com_roguetemple_hyperroid_HyperRogue_getaTexture(MOBPAR_FORMAL)
{
return glhr::aTexture;
return aTexture;
}
extern "C" int
Java_com_roguetemple_hyperroid_HyperRogue_getuColor(MOBPAR_FORMAL)
{
return glhr::current->uColor;
return glhr::current_glprogram->uColor;
}
const char *scorefile;
@ -289,7 +290,7 @@ extern "C" void Java_com_roguetemple_hyperroid_HyperRogue_draw(MOBPAR_FORMAL) {
glhr::be_nontextured();
#if CAP_SHADER
glEnableVertexAttribArray(glhr::aPosition);
glEnableVertexAttribArray(aPosition);
#else
glEnableClientState(GL_VERTEX_ARRAY);
#endif
@ -349,8 +350,11 @@ extern "C" void Java_com_roguetemple_hyperroid_HyperRogue_update
// delref;
// if(debfile) fprintf(debfile, "update stopped.\n"), fflush(debfile);
}
void resetmusic() {}
void playSound(cell *c, const string& fname, int vol) {
LATE( hr::playSound(c, fname, vol); )
soundsToPlay.push_back(make_pair(fname, vol));
}

View File

@ -8,8 +8,6 @@
#include "hyper.h"
namespace hr {
#if CU_INIT
#if ISANDROID
string buildScoreDescription() {
string s;
@ -50,7 +48,9 @@ string buildScoreDescription() {
int andmode;
bool lclicked = false, clicked = false;
bool lclicked = false;
EX bool clicked = false;
EX bool buttonclicked = false;
string lmouseovers;
bool inmenu = false;
@ -90,9 +90,9 @@ void handleclick(MOBPAR_FORMAL) {
else if(statkeys && getcstat == 't') {
if(playermoved && items[itStrongWind]) {
cell *c = whirlwind::jumpDestination(cwt.at);
if(c) centerover.at = c, centerover.spin = 0;
if(c) centerover = c;
}
targetRangedOrb(centerover.at, roKeyboard);
targetRangedOrb(centerover, roKeyboard);
getcstat = 0;
}
@ -112,7 +112,7 @@ void handleclick(MOBPAR_FORMAL) {
ors::reset();
centerpc(INF);
View = Id;
centerover = cwt.at->master;
centerover = cwt.at;
}
andmode = 11;
}
@ -151,7 +151,7 @@ void handleclick(MOBPAR_FORMAL) {
if(!playerfound) {
centerpc(INF);
View = Id;
centerover = cwt.at->master;
centerover = cwt.at;
}
playermoved = true;
}
@ -198,7 +198,7 @@ void apply_orientation() {
}
#endif
void mobile_draw(MOBPAR_FORMAL) {
EX void mobile_draw(MOBPAR_FORMAL) {
apply_memory_reserve();
optimizeview();
@ -358,7 +358,7 @@ void mobile_draw(MOBPAR_FORMAL) {
lticks_rug = ticks;
if(andmode == 1 && lclicked && !clicked && normal_reaction && mouseover)
performMarkCommand(mouseover);
mine::performMarkCommand(mouseover);
if(clicked && andmode == 2 && (mouseover != lmouseover || mouseovers != lmouseovers) && normal_reaction) {
addMessage(mouseovers);
@ -394,10 +394,4 @@ void mobile_draw(MOBPAR_FORMAL) {
#endif
#if !CAP_AUDIO
void playSound(cell*, const string &s, int vol) { printf("play sound: %s vol %d\n", s.c_str(), vol); }
#endif
#endif
}

View File

@ -63,7 +63,9 @@ struct renderbuffer {
struct resetbuffer {
GLint drawFboId, readFboId;
#if CAP_SDL
SDL_Surface *sreset;
#endif
resetbuffer();
void reset();
};

View File

@ -14,9 +14,14 @@ bool hide_hud = true;
namespace shot { void default_screenshot_content(); }
#endif
#if CAP_SVG
// svg renderer
EX namespace svg {
#if !CAP_SVG
EX always_false in;
#endif
#if CAP_SVG
#if ISWEB
shstream f;
#else
@ -225,8 +230,9 @@ int read_args() {
auto ah = addHook(hooks_args, 0, read_args);
#endif
EX }
#endif
EX }
#if CAP_PNG
void IMAGESAVE(SDL_Surface *s, const char *fname) {

View File

@ -8,6 +8,11 @@
#include "hyper.h"
namespace hr {
#if HDR
void playSound(cell *c, const string& fname, int vol = 100);
void resetmusic();
#endif
EX const char *musicfile = "";
EX bool audio;
EX string musiclicense;
@ -215,7 +220,7 @@ string wheresounds = HYPERPATH "sounds/";
hookset<bool(const string& s, int vol)> *hooks_sound;
EX void playSound(cell *c, const string& fname, int vol IS(100)) {
EX void playSound(cell *c, const string& fname, int vol) {
LATE( hr::playSound(c, fname, vol); )
if(effvolume == 0) return;
if(callhandlers(false, hooks_sound, fname, vol)) return;
@ -284,8 +289,8 @@ auto ah_sound = addHook(hooks_args, 0, read_sound_args) + addHook(hooks_clear_ca
#endif
#if !CAP_SDLAUDIO
EX void playSound(cell *c, const string& fname, int vol IS(100)) { }
#if !CAP_AUDIO
EX void playSound(cell *c, const string& fname, int vol) { }
EX void resetmusic() { }
#endif