Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Bug Report (https://forums.graalonline.com/forums/forumdisplay.php?f=193)
-   -   iOS getAcceleratorAxis (https://forums.graalonline.com/forums/showthread.php?t=134261580)

fowlplay4 01-06-2011 08:13 PM

iOS getAcceleratorAxis
 
This was posted way back when in the Classic iPhone thread.

PHP Code:

xaxis = -(getangle(getAcceleratorAxis(0), getAcceleratorAxis(1)) - pi); // stays at pi/2
yaxis getAcceleratorAxis(2); // stays at 0 

Doesn't work.

Twinny 01-06-2011 10:19 PM

Quote:

Originally Posted by fowlplay4 (Post 1620837)
This was posted way back when in the Classic iPhone thread.

PHP Code:

xaxis = -(getangle(getAcceleratorAxis(0), getAcceleratorAxis(1)) - pi); // stays at pi/2
yaxis getAcceleratorAxis(2); // stays at 0 

Doesn't work.

I made this on Classic iPhone Dev

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
enableAccelerator(true);
  
createProfile(); 
  
this.running true;
  
  new 
GuiProgressCtrl("x_progress") {
    
profile axisprofile;
    
useownprofile true;        
    
resize(501520025);
    
progress .5;
  }

  new 
GuiProgressCtrl("y_progress") {
    
profile axisprofile;
    
useownprofile true;        
    
resize(503520025);
    
progress .5;
  }

  new 
GuiProgressCtrl("z_progress") {
    
profile axisprofile;
    
useownprofile true;        
    
resize(505520025);
    
progress .5;
  }
  
setTimer(0.05);
}

function 
onPlayerChats() {
  if (
player.chat == ":toggleaxis") {
    
this.running = !this.running;
    
    if (
this.running) {
      
enableAccelerator(true);
      if (
timeout <= 0)
        
setTimer(0.1);
    }
    else {
      
enableAccelerator(false);
      
setTimer(0);
    }
  }
}

function 
onTimeout() {
  
temp.xaxis = (roundto(getAcceleratorAxis(0), 0.05))/2;
  
temp.yaxis = (roundto(getAcceleratorAxis(1), 0.05))/2;
  
temp.zaxis = (roundto(getAcceleratorAxis(2), 0.05))/2;

  
x_progress.progress temp.xaxis+.5;
  
y_progress.progress temp.yaxis+.5;
  
z_progress.progress temp.zaxis+.5;    
  
setTimer(0.25);
}

function 
roundto(valdec)
  return 
int(val/dec 0.5) * dec;

function 
createProfile() {
  new 
GuiProgressProfile("axisprofile") {
    
this.copyfrom("GuiBlueProgressProfile");
    
bordercolor={0,0,0};
    
bordercolorhl={0,0,0};
    
bordercolorna={0,0,0};
    
fillcolor={255,0,0};
    
fillcolorhl={255,0,0};
    
fillcolorna={255,0,0};
  }


I found each axis has a value between -1 and 1. The bars make it quite easy to follow :)

WhiteDragon 01-06-2011 10:36 PM

PHP Code:

enableAccelerator(true); 

Seems to have been the missing key. :)

I imagine it's a good idea to turn it off when done for battery etc. as well.

fowlplay4 01-06-2011 11:44 PM

Thanks, I had a vague memory that there was some sort of enable function that had to be called before. Maybe I will add an easter egg effect here and there after all.


All times are GMT +2. The time now is 02:44 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.