Minor Android changes. Barf. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5276 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2015-07-08 03:34:24 +00:00
parent 4846c838d5
commit 311086da3e
3 changed files with 200 additions and 154 deletions

View file

@ -1,8 +1,25 @@
//-------------------------------------------------------------------------
/* /*
* Copyright (C) 2015 EDuke32 developers and contributors
* Designed by Emile Belanger Copyright (C) 2015 Voidpoint, LLC
*
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
//-------------------------------------------------------------------------
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -231,9 +248,13 @@ void gameButton(int state, int code)
{ {
weaponWheel->setTapMode(true); weaponWheel->setTapMode(true);
showWeaponsInventory(true); showWeaponsInventory(true);
PortableTimer(30);
} }
else else
{
showWeaponsInventory(false); showWeaponsInventory(false);
PortableTimer(120);
}
} }
break; break;
@ -260,6 +281,7 @@ void inventoryButton(int state, int code)
{ {
// Inventory chosen, hide them and wheel // Inventory chosen, hide them and wheel
showWeaponsInventory(false); showWeaponsInventory(false);
PortableTimer(120);
} }
} }
@ -288,7 +310,10 @@ void blankTapButton(int state, int code)
PortableKeyEvent(state, SDL_SCANCODE_RETURN, 0); PortableKeyEvent(state, SDL_SCANCODE_RETURN, 0);
} }
void weaponWheelSelected(int enabled) { showWeaponsInventory(enabled ? true : false); } void weaponWheelSelected(int enabled) {
showWeaponsInventory(enabled ? true : false);
PortableTimer(enabled ? 30 : 120);
}
void weaponWheelChosen(int segment) void weaponWheelChosen(int segment)
{ {
@ -365,8 +390,9 @@ void initControls(int width, int height, const char *graphics_path)
LOGI("initControls %d x %d,x path = %s", width, height, graphics_path); LOGI("initControls %d x %d,x path = %s", width, height, graphics_path);
if (!controlsCreated) if (controlsCreated)
{ return;
LOGI("creating controls"); LOGI("creating controls");
touchcontrols::setGraphicsBasePath(graphics_path); touchcontrols::setGraphicsBasePath(graphics_path);
@ -402,8 +428,8 @@ void initControls(int width, int height, const char *graphics_path)
///////////////////////// MAIN MENU SCREEN ///////////////////// ///////////////////////// MAIN MENU SCREEN /////////////////////
tcMenuMain->addControl(new touchcontrols::Button("arrow_left", touchcontrols::RectF(0, 2, 2, 4), "arrow_left", tcMenuMain->addControl(
SDL_SCANCODE_ESCAPE)); new touchcontrols::Button("arrow_left", touchcontrols::RectF(0, 2, 2, 4), "arrow_left", SDL_SCANCODE_ESCAPE));
tcMenuMain->signal_button.connect(sigc::ptr_fun(&menuButton)); tcMenuMain->signal_button.connect(sigc::ptr_fun(&menuButton));
touchcontrols::MultitouchMouse *mouseMenu = touchcontrols::MultitouchMouse *mouseMenu =
@ -424,27 +450,25 @@ void initControls(int width, int height, const char *graphics_path)
tcGameMain->addControl( tcGameMain->addControl(
new touchcontrols::Button("game_menu", touchcontrols::RectF(0, 0, 2, 2), "settings_bars", MENU_BACK)); new touchcontrols::Button("game_menu", touchcontrols::RectF(0, 0, 2, 2), "settings_bars", MENU_BACK));
tcGameMain->addControl( tcGameMain->addControl(new touchcontrols::Button("use", touchcontrols::RectF(20, 4, 23, 7), "use", gamefunc_Open));
new touchcontrols::Button("use", touchcontrols::RectF(20, 4, 23, 7), "use", gamefunc_Open));
tcGameMain->addControl( tcGameMain->addControl(
new touchcontrols::Button("attack", touchcontrols::RectF(20, 7, 23, 10), "fire2", gamefunc_Fire)); new touchcontrols::Button("attack", touchcontrols::RectF(20, 7, 23, 10), "fire2", gamefunc_Fire));
tcGameMain->addControl( tcGameMain->addControl(
new touchcontrols::Button("jump", touchcontrols::RectF(23, 6, 26, 9), "jump", gamefunc_Jump)); new touchcontrols::Button("jump", touchcontrols::RectF(23, 6, 26, 9), "jump", gamefunc_Jump));
tcGameMain->addControl( tcGameMain->addControl(
new touchcontrols::Button("crouch", touchcontrols::RectF(24, 12, 26, 14), "crouch", gamefunc_Crouch)); new touchcontrols::Button("crouch", touchcontrols::RectF(24, 12, 26, 14), "crouch", gamefunc_Crouch));
tcGameMain->addControl(new touchcontrols::Button("kick", "Mighty Foot", touchcontrols::RectF(23, 3, 26, 6), tcGameMain->addControl(new touchcontrols::Button("kick", "Mighty Foot", touchcontrols::RectF(23, 3, 26, 6), "boot",
"boot", gamefunc_Quick_Kick, false, true)); gamefunc_Quick_Kick, false, true));
touchcontrols::Button *map_button = new touchcontrols::Button( touchcontrols::Button *map_button = new touchcontrols::Button(
"map", "Overhead map", touchcontrols::RectF(6, 0, 8, 2), "map", gamefunc_Map, false, true); "map", "Overhead map", touchcontrols::RectF(6, 0, 8, 2), "map", gamefunc_Map, false, true);
tcGameMain->addControl(map_button); tcGameMain->addControl(map_button);
tcGameMain->addControl(new touchcontrols::Button("show_inventory", "Inventory", tcGameMain->addControl(new touchcontrols::Button("show_inventory", "Inventory", touchcontrols::RectF(24, 0, 26, 2),
touchcontrols::RectF(24, 0, 26, 2), "inv", KEY_SHOW_INVEN)); "inv", KEY_SHOW_INVEN));
tcGameMain->addControl(new touchcontrols::Button("next_weapon", "Next weapon", touchcontrols::RectF(0, 3, 3, 5), tcGameMain->addControl(new touchcontrols::Button("next_weapon", "Next weapon", touchcontrols::RectF(0, 3, 3, 5),
"next_weap", gamefunc_Next_Weapon, false, true)); "next_weap", gamefunc_Next_Weapon, false, true));
tcGameMain->addControl(new touchcontrols::Button("prev_weapon", "Previous weapon", tcGameMain->addControl(new touchcontrols::Button("prev_weapon", "Previous weapon", touchcontrols::RectF(0, 5, 3, 7),
touchcontrols::RectF(0, 5, 3, 7), "prev_weap", "prev_weap", gamefunc_Previous_Weapon, false, true));
gamefunc_Previous_Weapon, false, true));
tcGameMain->addControl(new touchcontrols::Button("quick_save", "Save game", touchcontrols::RectF(22, 0, 24, 2), tcGameMain->addControl(new touchcontrols::Button("quick_save", "Save game", touchcontrols::RectF(22, 0, 24, 2),
"save", KEY_QUICK_SAVE, false, true)); "save", KEY_QUICK_SAVE, false, true));
tcGameMain->addControl(new touchcontrols::Button("quick_load", "Load game", touchcontrols::RectF(20, 0, 22, 2), tcGameMain->addControl(new touchcontrols::Button("quick_load", "Load game", touchcontrols::RectF(20, 0, 22, 2),
@ -502,8 +526,8 @@ void initControls(int width, int height, const char *graphics_path)
gamefunc_NightVision, false, false, true); gamefunc_NightVision, false, false, true);
inv_buttons[GET_HOLODUKE] = new touchcontrols::Button("holoduke", touchcontrols::RectF(0, 9, 2, 11), "holoduke", inv_buttons[GET_HOLODUKE] = new touchcontrols::Button("holoduke", touchcontrols::RectF(0, 9, 2, 11), "holoduke",
gamefunc_Holo_Duke, false, false, true); gamefunc_Holo_Duke, false, false, true);
inv_buttons[GET_STEROIDS] = new touchcontrols::Button("steroids", touchcontrols::RectF(0, 11, 2, 13), inv_buttons[GET_STEROIDS] = new touchcontrols::Button("steroids", touchcontrols::RectF(0, 11, 2, 13), "steroids",
"steroids", gamefunc_Steroids, false, false, true); gamefunc_Steroids, false, false, true);
tcGameWeapons->addControl(inv_buttons[GET_JETPACK]); tcGameWeapons->addControl(inv_buttons[GET_JETPACK]);
tcGameWeapons->addControl(inv_buttons[GET_FIRSTAID]); tcGameWeapons->addControl(inv_buttons[GET_FIRSTAID]);
@ -514,8 +538,8 @@ void initControls(int width, int height, const char *graphics_path)
tcGameWeapons->signal_button.connect(sigc::ptr_fun(&inventoryButton)); tcGameWeapons->signal_button.connect(sigc::ptr_fun(&inventoryButton));
// Weapons // Weapons
weaponWheel = new touchcontrols::WheelSelect("weapon_wheel", touchcontrols::RectF(7, 2, 19, 14), weaponWheel =
"weapon_wheel_orange_blank", 10); new touchcontrols::WheelSelect("weapon_wheel", touchcontrols::RectF(7, 2, 19, 14), "weapon_wheel_orange_blank", 10);
weaponWheel->signal_selected.connect(sigc::ptr_fun(&weaponWheelChosen)); weaponWheel->signal_selected.connect(sigc::ptr_fun(&weaponWheelChosen));
weaponWheel->signal_enabled.connect(sigc::ptr_fun(&weaponWheelSelected)); weaponWheel->signal_enabled.connect(sigc::ptr_fun(&weaponWheelSelected));
tcGameWeapons->addControl(weaponWheel); tcGameWeapons->addControl(weaponWheel);
@ -544,9 +568,6 @@ void initControls(int width, int height, const char *graphics_path)
// tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml"); // tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml");
setControlsContainer(&controlsContainer); setControlsContainer(&controlsContainer);
}
else
LOGI("NOT creating controls");
// controlsContainer.initGL(); // controlsContainer.initGL();
} }

View file

@ -1,3 +1,26 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2015 EDuke32 developers and contributors
Copyright (C) 2015 Voidpoint, LLC
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "compat.h" #include "compat.h"
#include "sdl_inc.h" #include "sdl_inc.h"
#include "baselayer.h" #include "baselayer.h"
@ -40,6 +63,8 @@ static char sdl_text[2];
droidinput_t droidinput; droidinput_t droidinput;
int PortableTimer(int tics) { G_InitTimer(tics); }
int PortableKeyEvent(int state, int code,int unicode) int PortableKeyEvent(int state, int code,int unicode)
{ {
LOGI("PortableKeyEvent %d %d %d",state,(SDL_Scancode)code,unicode); LOGI("PortableKeyEvent %d %d %d",state,(SDL_Scancode)code,unicode);

View file

@ -100,7 +100,7 @@ typedef struct
extern droidinput_t droidinput; extern droidinput_t droidinput;
extern droidsysinfo_t droidinfo; extern droidsysinfo_t droidinfo;
int PortableTimer(int tics);
int PortableKeyEvent(int state, int code, int unicode); int PortableKeyEvent(int state, int code, int unicode);
int PortableRead(portableread_t r); int PortableRead(portableread_t r);