|
/*
* input.h
*
* Created on: 31-Oct-2012
* Author: Praveen Ojha
*/
#ifndef Update_H_
#define Update_H_
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////updates keyboard accelerometer abd touch screen/////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Game::Update(JNIEnv *env,float ax,float ay,float az)
{gd.cur_ax=ax;
gd.cur_ay=ay;
gd.cur_az=az;
if(gd.herox>=gd.herominx&&gd.herox<=gd.heromaxx&&gd.Gamestate==0)
{gd.herox=gd.herox+ax*gd.senstivity;
}
if(gd.herox<gd.herominx)
gd.herox=gd.herominx;
if(gd.herox>gd.heromaxx)
gd.herox=gd.heromaxx;
}
void Game::Update(JNIEnv *env)
{
}
int bp=0;
bool Game::Update(JNIEnv *env,int key,int state)
{
gd.key=key;
gd.keystate=state;
if(gd.key==AKEYCODE_BACK&&gd.keystate==0)
{if(gd.Gamestate==0)
gd.Gamestate=3;
else if(vm.screenstate!=0)
{vm.screenstate=0;
gd.Gamestate=4;
}
if(gd.Gamestate==4&&vm.screenstate==3)
{
if(bp==1)
{bp=0;
return false;
}
else
{bp++;
}
}
if(gd.Gamestate==4&&vm.screenstate==0)
{
if(bp==1)
{bp=0;
return false;
}
else
{bp++;
}
}
return true;
}
/////////////////////////////////////hero on emulator via left and right/////////////////
if(gd.herox>=gd.herominx&&gd.herox<=gd.heromaxx&&gd.Gamestate==0)
{
if(key==AKEYCODE_DPAD_LEFT&&state==AKEY_STATE_DOWN)
gd.herox=gd.herox-gd.senstivity;
else if(key==AKEYCODE_DPAD_RIGHT &&state==AKEY_STATE_DOWN)
gd.herox=gd.herox+gd.senstivity;
if(gd.herox<gd.herominx)
gd.herox=gd.herominx;
if(gd.herox>gd.heromaxx)
gd.herox=gd.heromaxx;
return false;
}
return false;
}
void Game::Update(JNIEnv *env,float tx,float ty,int state,int index)
{
if(index==0)
{gd.pointx=tx;
gd.pointy=ty;
gd.pointerstate=state;
}
if(index==1)
{gd.pointx1=tx;
gd.pointy1=ty;
gd.pointerstate1=state;
}
////////////////////////////////////touch based action coded here like menu swap //////////
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Currently I am an independent developer usually develops under brand name Induction games sometimes under Induction labs ,Can say that I am professionally developing apps for more than 4 years .
Some links to my apps in different apps stores are ..
Windows Phone
http://www.windowsphone.com/en-US/store/publishers?publisherId=InductionGames
Android
1. https://play.google.com/store/apps/developer?id=Induction+Labs&hl=en
2.https://play.google.com/store/apps/developer?id=Induction%20Games
Blackberry Store
http://appworld.blackberry.com/webstore/vendor/39848/?lang=en
Flash Games :
http://www.mochigames.com/developer/praveenojha/
*my flash portal is no longer active so the quiz game cant be played .
Perceptual computing phase 1 first prize Winner app (air piano)
http://software.intel.com/sites/campaigns/perceptualshowcase/air-piano.htm
My Blog
http://praveenojha.com