Android Open Source - Gloomy-Dungeons-3D Config Zeemote






From Project

Back to project page Gloomy-Dungeons-3D.

License

The source code is released under:

MIT License

If you think the Android project Gloomy-Dungeons-3D listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package zame.game;
/*from  ww w. ja  v  a 2s .c o m*/
import android.content.SharedPreferences;
import com.zeemote.zc.Controller;
import com.zeemote.zc.event.ButtonEvent;

public class ConfigZeemote
{
    public static float zeemoteXAccel;
    public static float zeemoteYAccel;
    public static int[] zeemoteButtonMappings;

    public static void initialize(SharedPreferences sp)
    {
        int tmpZeemoteXAccel = sp.getInt("ZeemoteXAccel", 8);   // zeemoteXAccel : 0.5 (1) -> 1.0 (8) -> 2.0 (15)

        zeemoteXAccel = ((tmpZeemoteXAccel >= 8)
            ? (((float)tmpZeemoteXAccel - 8.0f) / 7.0f + 1.0f)
            : (1.0f / (2.0f - ((float)tmpZeemoteXAccel - 1.0f) / 7.0f))
        );

        int tmpZeemoteYAccel = sp.getInt("ZeemoteYAccel", 8);   // zeemoteYAccel : 0.5 (1) -> 1.0 (8) -> 2.0 (15)

        zeemoteYAccel = ((tmpZeemoteYAccel >= 8)
            ? (((float)tmpZeemoteYAccel - 8.0f) / 7.0f + 1.0f)
            : (1.0f / (2.0f - ((float)tmpZeemoteYAccel - 1.0f) / 7.0f))
        );

        zeemoteButtonMappings = new int[Math.max(
            Math.max(
                Math.max(ButtonEvent.BUTTON_A, ButtonEvent.BUTTON_B),
                ButtonEvent.BUTTON_C
            ),
            ButtonEvent.BUTTON_D
        ) + 1];

        zeemoteButtonMappings[ButtonEvent.BUTTON_A] = Config.getControlMaskByName(sp.getString("ZeemoteMappingFire", "None"));
        zeemoteButtonMappings[ButtonEvent.BUTTON_B] = Config.getControlMaskByName(sp.getString("ZeemoteMappingA", "None"));
        zeemoteButtonMappings[ButtonEvent.BUTTON_C] = Config.getControlMaskByName(sp.getString("ZeemoteMappingB", "None"));
        zeemoteButtonMappings[ButtonEvent.BUTTON_D] = Config.getControlMaskByName(sp.getString("ZeemoteMappingC", "None"));
    }
}




Java Source Code List

zame.game.AppConfig.java
zame.game.AppConfig.java
zame.game.Common.java
zame.game.ConfigZeemote.java
zame.game.ConfigZeemote.java
zame.game.Config.java
zame.game.GameActivityZeemoteHelper.java
zame.game.GameActivityZeemoteHelper.java
zame.game.GameActivity.java
zame.game.GamePreferencesActivity.java
zame.game.GamePreferencesActivity.java
zame.game.MenuActivityHelper.java
zame.game.MenuActivityHelper.java
zame.game.MenuActivity.java
zame.game.Renderer.java
zame.game.SoundManager.java
zame.game.ZameApplicationAnalyticsHelper.java
zame.game.ZameApplicationAnalyticsHelper.java
zame.game.ZameApplication.java
zame.game.ZameGame.java
zame.game.ZameJniRenderer.java
zame.game.engine.Action.java
zame.game.engine.AutoWall.java
zame.game.engine.Controls.java
zame.game.engine.Door.java
zame.game.engine.GameHelper.java
zame.game.engine.GameHelper.java
zame.game.engine.Game.java
zame.game.engine.Labels.java
zame.game.engine.LevelConfig.java
zame.game.engine.LevelRenderer.java
zame.game.engine.Level.java
zame.game.engine.Mark.java
zame.game.engine.Monster.java
zame.game.engine.Overlay.java
zame.game.engine.PortalTracer.java
zame.game.engine.State.java
zame.game.engine.Stats.java
zame.game.engine.TextureLoader.java
zame.game.engine.Weapons.java
zame.game.views.EndLevelView.java
zame.game.views.GameOverView.java
zame.game.views.GameView.java
zame.game.views.IZameView.java
zame.game.views.MenuViewHelper.java
zame.game.views.MenuViewHelper.java
zame.game.views.MenuView.java
zame.game.views.PreLevelView.java
zame.game.views.ZameGameView.java
zame.libs.FrameLayout.java
zame.libs.GLSurfaceView21.java
zame.libs.Grid.java
zame.libs.KeyMapPreference.java
zame.libs.LabelMaker.java
zame.libs.ListPreference.java
zame.libs.NumericSprite.java
zame.libs.SeekBarPreference.java
zame.promo.PromoView.java