Well since the code is running natively over being interpreted, you would think it would be faster. But this line of code runs slower in Tier 1 than in Tier 2.
Quote: "IntesityMeter(1.0)"
TIER 1
setvirtualresolution(960,640)
global speed as float = 0
global stopIntesityMeter as integer = 0
global xpos as integer=0
bar = createsprite(loadimage("bar.jpg")) // 4x25 jpeg image
do
print(stopIntesityMeter)
if stopIntesityMeter = 0
IntesityMeter(1.0)
endif
//draw intensity meter
setspriteposition(bar,xpos, 320)
print(xpos)
Sync()
if GetPointerPressed ( ) = 1
if stopIntesityMeter = 0
stopIntesityMeter = 1
elseif stopIntesityMeter = 1
stopIntesityMeter = 0
endif
endif
loop
function IntesityMeter(accel as float)
xpos = sin(speed) * 200 + 250
speed = speed + accel
if speed = 360
speed = 0
endif
endfunction
TIER 2
float speed = 0.0;
int stopIntesityMeter = 0;
int xpos = 0;
int spectrum = 0;
int bar = 0;
void IntesityMeter(float accel)
{
xpos = sin(speed) * 200 + 250;
speed+=accel;
if (speed == 360)
{
speed=0;
}
}
// Begin app, called once at the start
void app::Begin( void )
{
// use device resolution
agk::SetVirtualResolution ( 960, 640 );
bar = agk::CreateSprite(agk::LoadImage("bar.jpg")); //4x25 jpg image
}
// Main loop, called every frame
void app::Loop ( void )
{
agk::Print(stopIntesityMeter);
if (stopIntesityMeter == 0)
{
IntesityMeter(1.0);
}
agk::SetSpritePosition(spectrum, 50,320);
agk::SetSpritePosition(bar, xpos,320);
agk::Print(xpos);
agk::Sync();
if (agk::GetPointerPressed() ==1)
{
if (stopIntesityMeter == 0)
{
stopIntesityMeter=1;
}
else if (stopIntesityMeter==1)
{
stopIntesityMeter=0;
}
}
}
// Called when the app ends
void app::End ( void )
{
}