Java 类com.badlogic.gdx.Application 实例源码

项目:spacefish    文件:SpacefishTests.java   
@Before
public void setUp() {
  final BitmapFont bitmapFont = mock(BitmapFont.class);

  // setup Mock for Game resources
  when(mResources.getBackgroundMusic()).thenReturn(mock(Music.class));
  when(mResources.getGameOver()).thenReturn(mock(Sound.class));

  when(mResources.getFont()).thenReturn(bitmapFont);
  when(bitmapFont.getBounds(anyString())).thenReturn(new BitmapFont.TextBounds());

  // Mock Gdx lib
  Gdx.graphics = mock(Graphics.class);
  Gdx.app = mock(Application.class);

  mGame.create();
}
项目:mini2Dx    文件:UATApplication.java   
@Override
public void initialise() {
    FallbackFileHandleResolver fallbackFileHandleResolver = new FallbackFileHandleResolver(
            new ClasspathFileHandleResolver(), new InternalFileHandleResolver());
    assetManager = new AssetManager(fallbackFileHandleResolver);
    assetManager.setLogger(new Logger("AssetManager", Application.LOG_ERROR));

    assetManager.setLoader(UiTheme.class, new UiThemeLoader(fallbackFileHandleResolver));
    assetManager.setLoader(TiledMap.class, new TiledMapLoader(fallbackFileHandleResolver));

    addScreen(new LoadingScreen(assetManager));
    addScreen(new UATSelectionScreen(assetManager));
    addScreen(new BlendingUAT());
    addScreen(new ClippingUAT());
    addScreen(new GeometryUAT());
    addScreen(new GraphicsUAT(assetManager));
    addScreen(new TextureRegionUAT());
    addScreen(new OrthogonalTiledMapNoCachingUAT(assetManager));
    addScreen(new OrthogonalTiledMapWithCachingUAT(assetManager));
    addScreen(new IsometricTiledMapUAT(assetManager));
    addScreen(new HexagonalTiledMapUAT(assetManager));
    addScreen(new ParticleEffectsUAT());
    addScreen(new ControllerUAT());
    addScreen(new ControllerMapping());
    addScreen(new UiUAT(assetManager));
}
项目:libgdx-learnlib    文件:WorldController.java   
private void handleInputGame(float deltaTime) {
    if (cameraHelper.hasTarget(level.bunnyHead)) {
        // Player Movement
        if (Gdx.input.isKeyPressed(Keys.LEFT)) {
            level.bunnyHead.velocity.x = -level.bunnyHead.terminalVelocity.x;
        } else if (Gdx.input.isKeyPressed(Keys.RIGHT)) {
            level.bunnyHead.velocity.x = level.bunnyHead.terminalVelocity.x;
        } else {
            // Execute auto-forward movement on non-desktop platform
            if (Gdx.app.getType() != Application.ApplicationType.Desktop) {
                level.bunnyHead.velocity.x = level.bunnyHead.terminalVelocity.x;
            }
        }
        // Bunny Jump
        if (Gdx.input.isTouched() || Gdx.input.isKeyPressed(Keys.SPACE))
            level.bunnyHead.setJumping(true);
        else
            level.bunnyHead.setJumping(false);
    }
}
项目:penguins-in-space    文件:EffectComponentTest.java   
@Before
public void setup() {
    Gdx.app = mock(Application.class);
    engine = mock(PooledEngine.class);
    when(engine.createComponent(HealthComponent.class)).thenReturn(new HealthComponent());
    when(engine.createComponent(DamageComponent.class)).thenReturn(new DamageComponent());
    ServiceLocator.appComponent = mock(AppComponent.class);
    when(ServiceLocator.getAppComponent().getAudioService()).thenReturn(mock(AudioService.class));
    ServiceLocator.entityComponent = mock(EntityComponent.class);
    when(ServiceLocator.getEntityComponent().getEffectTextureFactory()).thenReturn(mock(EffectTextureFactory.class));
    entity = mock(Entity.class);
    fixture = new EffectComponent();
    effect1 = Mockito.spy(BaseEffect.class);
    when(effect1.tick(any(PooledEngine.class), any(Entity.class), any(EffectComponent.class), anyFloat())).thenReturn(false, false, false, true);
    effect2 = Mockito.spy(BaseEffect.class);
}
项目:Cubes_2    文件:WorldShaderProvider.java   
public static Setting getSetting() {
    return new BooleanSetting(false) {
        @Override
        public boolean shouldDisplay() {
            return Compatibility.get().getApplicationType() == Application.ApplicationType.Desktop;
        }

        @Override
        public void onChange() {
            Log.debug("Emptying shader cache");
            for (int i = 0; i < shaders.length; i++) {
                if (shaders[i] != null)
                    shaders[i].dispose();
                shaders[i] = null;
            }
        }
    };
}
项目:Klooni1010    文件:Klooni.java   
@Override
public void create() {
    onDesktop = Gdx.app.getType().equals(Application.ApplicationType.Desktop);
    prefs = Gdx.app.getPreferences("io.github.lonamiwebs.klooni.game");

    // Load the best match for the skin (depending on the device screen dimensions)
    skin = SkinLoader.loadSkin();

    // Use only one instance for the theme, so anyone using it uses the most up-to-date
    Theme.skin = skin; // Not the best idea
    final String themeName = prefs.getString("themeName", "default");
    if (Theme.exists(themeName))
        theme = Theme.getTheme(themeName);
    else
        theme = Theme.getTheme("default");

    Gdx.input.setCatchBackKey(true); // To show the pause menu
    setScreen(new MainMenuScreen(this));
    effect = new Effect(prefs.getString("effectName", "vanish"));
}
项目:Ponytron    文件:DS.java   
public static void init(DSGame game) {
        OPT = new PreferenceAssist();
        if(app_orientation == LANDSCAPE) {
            T_HEIGHT = 1080;
            T_WIDTH = 1920;
        } else {
            T_WIDTH = 1080;
            T_HEIGHT = 1920;
//            T_WIDTH = 720;
//            T_HEIGHT = 1280;
        }

        camera = new OrthographicCamera();
        camera.position.set((int)(DS.T_WIDTH/2.0), (int)(DS.T_HEIGHT/2.0), 0);
        viewport = new FitViewport(DS.T_WIDTH, DS.T_HEIGHT, camera);
        DS.game = game;
        sb = new SpriteBatch(150);

        Gdx.app.setLogLevel(Application.LOG_DEBUG);
    }
项目:gdx-fireapp    文件:PlatformDistributor.java   
/**
 * Creates platform specific object by reflection.
 * <p>
 * Uses class names given by {@link #getAndroidClassName()} and {@link #getIOSClassName()}
 * <p>
 * If you need to run project on different platform use {@link #setMockObject(Object)} to polyfill platform object.
 *
 * @throws PlatformDistributorException Throws when something is wrong with environment
 */
@SuppressWarnings("unchecked")
protected PlatformDistributor() throws PlatformDistributorException
{
    String className = null;
    if (Gdx.app.getType() == Application.ApplicationType.Android) {
        className = getAndroidClassName();
    } else if (Gdx.app.getType() == Application.ApplicationType.iOS) {
        className = getIOSClassName();
    } else if (Gdx.app.getType() == Application.ApplicationType.WebGL) {
        className = getWebGLClassName();
    } else {
        return;
    }
    try {
        Class objClass = ClassReflection.forName(className);
        platformObject = (T) ClassReflection.getConstructor(objClass).newInstance();
    } catch (ReflectionException e) {
        e.printStackTrace();
        throw new PlatformDistributorException("Something wrong with environment");
    }
}
项目:Cubes    文件:WorldShaderProvider.java   
public static Setting getSetting() {
  return new BooleanSetting(false) {
    @Override
    public boolean shouldDisplay() {
      return Compatibility.get().getApplicationType() == Application.ApplicationType.Desktop;
    }

    @Override
    public void onChange() {
      Log.debug("Emptying shader cache");
      for (int i = 0; i < shaders.length; i++) {
        if (shaders[i] != null) shaders[i].dispose();
        shaders[i] = null;
      }
    }
  };
}
项目:nhglib    文件:NhgFloatTextureData.java   
@Override
public void consumeCustomData(int target) {
    if (Gdx.app.getType() == Application.ApplicationType.Android || Gdx.app.getType() == Application.ApplicationType.iOS
            || Gdx.app.getType() == Application.ApplicationType.WebGL) {

        if (!Gdx.graphics.supportsExtension("OES_texture_float"))
            throw new GdxRuntimeException("Extension OES_texture_float not supported!");

        // GLES and WebGL defines texture format by 3rd and 8th argument,
        // so to get a float texture one needs to supply GL_RGBA and GL_FLOAT there.
        Gdx.gl.glTexImage2D(target, 0, internalFormat, width, height, 0, format, GL20.GL_FLOAT, buffer);
    } else {
        if (!Gdx.graphics.supportsExtension("GL_ARB_texture_float"))
            throw new GdxRuntimeException("Extension GL_ARB_texture_float not supported!");

        // in desktop OpenGL the texture format is defined only by the third argument,
        // hence we need to use GL_RGBA32F there (this constant is unavailable in GLES/WebGL)
        Gdx.gl.glTexImage2D(target, 0, internalFormat, width, height, 0, format, GL20.GL_FLOAT, buffer);
    }
}
项目:nhglib    文件:InputHandlerOld.java   
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Application.ApplicationType type = Gdx.app.getType();

    switch (type) {
        case Android:
        case iOS:
            NhgInput input = pointerInputsMap.get(pointer);
            touchDownPointer(input, pointer);
            break;

        case Desktop:
            MouseSourceType sourceType = MouseSourceType.fromButtonCode(button);
            NhgInput mouseInput = mouseInputsMap.get(sourceType);
            touchDownMouse(mouseInput, sourceType);
            break;
    }

    return false;
}
项目:nhglib    文件:InputHandlerOld.java   
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    Application.ApplicationType type = Gdx.app.getType();

    switch (type) {
        case Android:
        case iOS:
            NhgInput input = pointerInputsMap.get(pointer);
            touchUpPointer(input);
            break;

        case Desktop:
            MouseSourceType sourceType = MouseSourceType.fromButtonCode(button);
            NhgInput mouseInput = mouseInputsMap.get(sourceType);
            touchUpMouse(mouseInput);
            break;
    }

    return false;
}
项目:Quilly-s-Castle    文件:DesktopLauncher.java   
public static void main(String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

config.useGL30 = false;
config.width = 1024;
config.height = 768;
config.fullscreen = false;
config.vSyncEnabled = config.fullscreen;

Gdx.app = new LwjglApplication(new QuillysCastleGame(), config);

Gdx.app.setLogLevel(Application.LOG_DEBUG);
// Gdx.app.setLogLevel(Application.LOG_INFO);
// Gdx.app.setLogLevel(Application.LOG_ERROR);
// Gdx.app.setLogLevel(Application.LOG_NONE);
   }
项目:GDefence    文件:LibgdxUtils.java   
@Override
public void create() {
    try {
        logger.setLevel(Logger.DEBUG);
        Gdx.app.setLogLevel(Application.LOG_DEBUG);

        Texture.setAssetManager(assets);

        spriteBatch = new SpriteBatch();
        modelBatch = new ModelBatch();

        game.create();
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        Gdx.app.exit();
    }
}
项目:dice-heroes    文件:UserDataHelper.java   
void saveUserData(UserData userData) {
    DumperOptions options = new DumperOptions();
    options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
    String toSave = new Yaml(options).dump(UserData.serialize(userData));
    if (Gdx.app.getType() == Application.ApplicationType.Desktop) {
        Gdx.files.local("game.save").writeString(toSave, false);
        return;
    }
    try {
        loadKey();
        byte[] bytes = encrypt(key, toSave.getBytes("UTF-8"));
        Gdx.files.local("game.save").writeBytes(bytes, false);
    } catch (Exception e) {
        Gdx.files.local("game.save").writeString(toSave, false);
    }
}
项目:dice-heroes    文件:DiceHeroes.java   
@Override
public void create() {
    Gdx.app.setLogLevel(Application.LOG_DEBUG);
    Gdx.input.setCatchBackKey(true);
    Gdx.input.setCatchMenuKey(true);
    Config.clearRegions();
    Config.shapeRenderer = new ShapeRenderer();
    Config.assetManager = new AssetManager();
    Config.preferences = new DicePreferences(Gdx.app.getPreferences("com.vlaaad.dice.preferences"), this);
    Tutorial.killAll();

    setState(new IntroState(new IntroState.Callback() {
        @Override public void onEnded() {
            setScale(Config.preferences.getScale());
            setState(new LoadGameResourcesState(new LoadGameResourcesState.Callback() {
                @Override
                public void onResourcesLoaded() {
                    start();
                }
            }));
        }
    }));
}
项目:Inspiration    文件:DebugDesktopLauncher.java   
public static void main (String[] arg) {
        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
        cfg.title = "Inspiration";
        cfg.useGL30 = false;
        cfg.width = 640;
        cfg.height = 480;
//      cfg.width = 800;
//      cfg.height = 600;
        // fullscreen
//      cfg.fullscreen = true;
        // vSync
//      cfg.vSyncEnabled = true;
        cfg.addIcon("icon.png", Files.FileType.Internal);
        Gdx.app  = new LwjglApplication(new Inspiration(), cfg);
        //Gdx.app.setLogLevel(Application.LOG_INFO);
        Gdx.app.setLogLevel(Application.LOG_DEBUG);
        //Gdx.app.setLogLevel(Application.LOG_ERROR);
        //Gdx.app.setLogLevel(Application.LOG_NONE);
    }
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@Test
public void returnIOSGDXFacebookWhenOnIOS() {
    Application mockApplication = mock(Application.class);
    when(mockApplication.getType()).thenReturn(Application.ApplicationType.iOS);
    Gdx.app = mockApplication;

    try {
        Constructor mockConstructor = PowerMockito.mock(Constructor.class);
        GDXFacebook mockFacebook = mock(IOSGDXFacebook.class);

        when(ClassReflection.forName(GDXFacebookVars.CLASSNAME_IOS)).thenReturn(IOSGDXFacebook.class);
        when(ClassReflection.getConstructor(IOSGDXFacebook.class, GDXFacebookConfig.class)).thenReturn(mockConstructor);
        when(mockConstructor.newInstance(anyObject())).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof IOSGDXFacebook);
}
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@Test
public void returnDesktopGDXFacebookWhenOnDesktop() {
    Application mockApplication = mock(Application.class);
    when(mockApplication.getType()).thenReturn(Application.ApplicationType.Desktop);
    Gdx.app = mockApplication;

    try {
        Constructor mockConstructor = PowerMockito.mock(Constructor.class);
        GDXFacebook mockFacebook = mock(DesktopGDXFacebook.class);

        when(ClassReflection.forName(GDXFacebookVars.CLASSNAME_DESKTOP)).thenReturn(DesktopGDXFacebook.class);
        when(ClassReflection.getConstructor(DesktopGDXFacebook.class, GDXFacebookConfig.class)).thenReturn(mockConstructor);
        when(mockConstructor.newInstance(anyObject())).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof DesktopGDXFacebook);
}
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@Test
public void returnHTMLGDXFacebookWhenOnWebGL() {
    Application mockApplication = mock(Application.class);
    when(mockApplication.getType()).thenReturn(Application.ApplicationType.WebGL);
    Gdx.app = mockApplication;

    try {
        Constructor mockConstructor = PowerMockito.mock(Constructor.class);
        GDXFacebook mockFacebook = mock(HTMLGDXFacebook.class);

        when(ClassReflection.forName(GDXFacebookVars.CLASSNAME_HTML)).thenReturn(HTMLGDXFacebook.class);
        when(ClassReflection.getConstructor(HTMLGDXFacebook.class, GDXFacebookConfig.class)).thenReturn(mockConstructor);
        when(mockConstructor.newInstance(anyObject())).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof HTMLGDXFacebook);
}
项目:Radix    文件:DesktopLauncher.java   
public static void main (String[] arg) {
LwjglApplicationConfiguration config;
      FileHandle glConfigFile = new FileHandle("conf/lwjgl.json");
      Gson gson = new GsonBuilder().setPrettyPrinting().create();
      if(!glConfigFile.exists()) {
          config = createDefaultConfig();
          glConfigFile.writeString(gson.toJson(config), false);
      } else {
          try {
              config = gson.fromJson(glConfigFile.readString(), LwjglApplicationConfiguration.class);
          } catch (Exception e) {
              e.printStackTrace();
              System.err.println("Error reading lwjgl config! Using defaults.");
              config = createDefaultConfig();
          }
      }
new LwjglApplication(new RadixClient(), config);
      Gdx.app.setLogLevel(Application.LOG_DEBUG);
  }
项目:Mundus    文件:ShaderUtils.java   
/**
 * Compiles and links shader.
 *
 * @param vertexShader
 *            path to vertex shader
 * @param fragmentShader
 *            path to fragment shader
 *
 * @return compiled shader program
 */
public static ShaderProgram compile(String vertexShader, String fragmentShader) {
    String vert;
    String frag;

    if (Gdx.app.getType() == Application.ApplicationType.WebGL) {
        vert = Gdx.files.internal(vertexShader).readString();
        frag = Gdx.files.internal(fragmentShader).readString();
    } else {
        vert = Gdx.files.classpath(vertexShader).readString();
        frag = Gdx.files.classpath(fragmentShader).readString();
    }

    ShaderProgram program = new ShaderProgram(vert, frag);
    if (!program.isCompiled()) {
        throw new GdxRuntimeException(program.getLog());
    }

    return program;
}
项目:NerdShooter    文件:NerdShooter.java   
public void create() {
    shooter = this;

    if(Gdx.app.getType() == Application.ApplicationType.Android){
        GUI_SCALE = 0.75F;
    }

    layout = new GlyphLayout();
    prefs = Gdx.app.getPreferences("settings");

    reloadSettings();

    keys = (int[])InterScreenData.getInstance("desktop_keys").getData();
    if(keys != null){
        useKeys = true;
    } else {
        useKeys = false;
    }

    setScreen(new SplashScreen());
    new CompletedLevel();
    new OptionsScreen();
    new DownloadScreen();
    new PackScreen();
}
项目:NerdShooter    文件:GameScreen.java   
public boolean touchUp(int x, int y, int pointer, int button) {
    if(Gdx.app.getType().equals(Application.ApplicationType.Android)){
        if(left.contains(x, (y - height) * -1)) {
            controller.leftReleased();
        }

        if(right.contains(x, (y - height) * -1)) {
            controller.rightReleased();
        }

        if(jump.contains(x, (y - height) * -1)){
            controller.jumpReleased();
        }

        if(fire.contains(x, (y - height) * -1)){
            controller.fireReleased();
        }
        return true;
    }
    return false;
}
项目:gdx-lml    文件:GdxUtilities.java   
/** Attempts to close the application on each platform. Calls {@link Application#exit()} on regular platforms and
 * manually calls {@link ApplicationListener#dispose()} on GWT, as it doesn't implement exit method properly.
 * Null-safe, this method will have an effect only if both {@link Application} and {@link ApplicationListener} are
 * created and assigned. */
public static void exit() {
    final Application application = Gdx.app;
    if (application == null) {
        return;
    } else if (isRunningOnGwt()) {
        // GWT Application#exit() implementation is empty. Disposing manually.
        if (application.getApplicationListener() != null) {
            application.getApplicationListener().dispose();
            // Application is now destroyed - silencing the (expected) rendering exceptions:
            application.setLogLevel(Application.LOG_NONE);
        }
    } else {
        application.exit();
    }
}
项目:libgdxcn    文件:AndroidInputFactory.java   
public static AndroidInput newAndroidInput (Application activity, Context context, Object view,
    AndroidApplicationConfiguration config) {
    try {
        Class<?> clazz = null;
        AndroidInput input = null;

        int sdkVersion = android.os.Build.VERSION.SDK_INT;
        if (sdkVersion >= 12) {
            clazz = Class.forName("com.badlogic.gdx.backends.android.AndroidInputThreePlus");
        } else {
            clazz = Class.forName("com.badlogic.gdx.backends.android.AndroidInput");
        }
        Constructor<?> constructor = clazz.getConstructor(Application.class, Context.class, Object.class,
            AndroidApplicationConfiguration.class);
        input = (AndroidInput)constructor.newInstance(activity, context, view, config);
        return input;
    } catch (Exception e) {
        throw new RuntimeException("Couldn't construct AndroidInput, this should never happen", e);
    }
}
项目:sanko-game    文件:CloudsGame.java   
@Override
public void create() {
    Gdx.app.setLogLevel(Application.LOG_DEBUG);
    batch = new SpriteBatch();
    hero = new Hero(screenWidth, screenHeight);
    score = new Score(screenWidth, screenHeight);
    finalScore = new FinalScore(screenWidth, screenHeight);
    bullets = new ArrayList<Bullet>();
    clouds = new ArrayList<Cloud>();
    if (Controllers.getControllers().size > 0) {
        controller = Controllers.getControllers().first();
    }
    websocketHelper = new WebsocketHelper();
    websocketHelper.connectWebSocket();

    camera = new OrthographicCamera();
    camera.setToOrtho(true, screenWidth, screenHeight);

    lastTime = TimeUtils.nanoTime();
    lastTimeSpawnedCloud = lastTime;
}
项目:LibGdxJoystick-test    文件:TouchPadTest.java   
protected void setupUi() {

        stage = new Stage(uiViewport, batch);
        Gdx.input.setInputProcessor(stage);

        if(Gdx.app.getType() != Application.ApplicationType.Android && Gdx.app.getType() != Application.ApplicationType.iOS) {
            return;
        }

        touchpadSkin = new Skin();
        touchpadSkin.add("touchBackground", new Texture("data/touchBackground.png"));
        touchpadSkin.add("touchKnob", new Texture("data/touchKnob.png"));
        touchpadStyle = new Touchpad.TouchpadStyle();
        touchBackground = touchpadSkin.getDrawable("touchBackground");
        touchKnob = touchpadSkin.getDrawable("touchKnob");

        touchpadStyle.background = touchBackground;
        touchpadStyle.knob = touchKnob;

        touchpad = new Touchpad(10, touchpadStyle);
        touchpad.setBounds(15, 15, 200, 200);

        stage.addActor(touchpad);
    }
项目:libgdx-utils    文件:LibgdxUtils.java   
@Override
public void create() {
    try {
        logger.setLevel(Logger.DEBUG);
        Gdx.app.setLogLevel(Application.LOG_DEBUG);

        Texture.setAssetManager(assets);

        spriteBatch = new SpriteBatch();
        modelBatch = new ModelBatch();

        game.create();
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        Gdx.app.exit();
    }
}
项目:TDA367    文件:MainMenuScreen.java   
@Override
public boolean keyDown(int keyCode) {
    super.keyDown(keyCode);

    /**
     * If debugging is enabled
     */
    if (Gdx.app.getLogLevel() == Application.LOG_DEBUG) {
        if (keyCode == Input.Keys.NUM_1) {
            changeScreen("game");
        }

        if (keyCode == Input.Keys.NUM_2) {
            changeScreen("placement");
        }

        if (keyCode == Input.Keys.NUM_3) {
            changeScreen("gameover");
        }
    }

    return true;
}
项目:crabox    文件:Cbx.java   
public static void initialize(MainClass clase) {
    Gdx.app.setLogLevel(Application.LOG_DEBUG);

    prefs = new Preferences();
    assets = new AssetManager();
    audio = new AudioManager();

    main = clase;

    controller = new GameController();

    //load screens
    menu = new MenuScreen();
    game = new GameScreen();

    setScreen(menu); // Cargamose el men�.
}
项目:vtm    文件:GdxMap.java   
@Override
public void create() {

    Gdx.graphics.setContinuousRendering(false);
    Gdx.app.setLogLevel(Application.LOG_DEBUG);

    int w = Gdx.graphics.getWidth();
    int h = Gdx.graphics.getHeight();

    mMap.viewport().setScreenSize(w, h);
    mMapRenderer.onSurfaceCreated();
    mMapRenderer.onSurfaceChanged(w, h);

    InputMultiplexer mux = new InputMultiplexer();
    mux.addProcessor(new InputHandler(this));
    //mux.addProcessor(new GestureDetector(20, 0.5f, 2, 0.05f,
    //                                     new MapController(mMap)));
    mux.addProcessor(new MotionHandler(mMap));

    Gdx.input.setInputProcessor(mux);

    createLayers();
}
项目:Hakd    文件:Hakd.java   
private void newPrefs() {
    /*
     * the directory for these can't be changes, on linux it is /home/[user
     * name]/.prefs/, on windows it is users/[user name]/.prefs/, I have not
     * tested mac yet
     */

        prefs.putBoolean("played-before", false);
        prefs.putInteger("width", 800);
        prefs.putInteger("height", 600);
        prefs.putBoolean("fullscreen", false);
        prefs.putBoolean("vsync", true);
        prefs.putBoolean("sound", true);
        prefs.putInteger("log-level", Application.LOG_DEBUG);

//        prefs.flush();
        // unfortunately this makes this game non-portable, kind of

        // TODO ask user if they want the game to save anything, including settings and game save. Maybe ask in the settings and default to no saving
    }
项目:ead    文件:LibPreview.java   
private void previewLib() {
    final FileHandle libToPreview = availableLibs.get(libSelector
            .getSelectedIndex());
    if (libToPreview != null) {
        FileHandle temp = FileHandle.tempDirectory("preview");
        temp.mkdirs();
        ZipUtils.unzip(libToPreview, temp);

        EngineDesktop engine = new EngineDesktop(1800, 900) {
            @Override
            protected void dispose() {
                super.dispose();
                libToPreview.deleteDirectory();
            }
        };
        engine.run(temp.path(), false);
        Gdx.app.setLogLevel(Application.LOG_DEBUG);
        SwingEDTUtils.invokeLater(new Runnable() {
            @Override
            public void run() {
                dispose();
            }
        });
    }
}
项目:ead    文件:LoadingIndicatorDemo.java   
@Override
public void create() {
    Gdx.app.setLogLevel(Application.LOG_DEBUG);
    Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
    stage = new Stage(new ScreenViewport());
    WidgetGroup modalContainer = new WidgetGroup();
    modalContainer.setFillParent(true);

    WidgetGroup viewContainer = new WidgetGroup();
    viewContainer.setFillParent(true);

    stage.getRoot().addActor(viewContainer);
    stage.getRoot().addActor(modalContainer);
    Gdx.input.setInputProcessor(stage);
    actor = new LoadingIndicator();
    if (actor instanceof WidgetGroup) {
        ((WidgetGroup) actor).setFillParent(true);
    }
    viewContainer.addActor(actor);
}
项目:ead    文件:MokapDesktop.java   
public static void main(String[] args) {

        final DesktopDebugConfiguration config = DesktopDebugConfiguration
                .build();
        AbstractPlatform mokapDesktopPlatform = new MokapDesktopPlatform();
        mokapDesktopPlatform.setApplicationArguments(args);
        MokapApplicationListener mokapApplicationListener = new MokapApplicationListener(
                mokapDesktopPlatform) {
            @Override
            protected Controller buildController() {
                Controller controller = super.buildController();
                if (config.editorLanguage != null) {
                    controller.getPreferences().putString(
                            Preferences.EDITOR_LANGUAGE, config.editorLanguage);
                    controller.setLanguage(config.editorLanguage);
                }
                return controller;
            }
        };
        new LwjglApplication(mokapApplicationListener, config);
        Gdx.app.setLogLevel(Application.LOG_DEBUG);
    }
项目:spacedebris    文件:GdxGameMain.java   
@Override
public void create() {      
    screenlist = new Screen[SCREEN_NUMBER];
    screenlist[SCREEN_SPLASH] = new SplashScreen(SCREEN_SPLASH);
    screenlist[SCREEN_BATTLE] = new BattleScreen();

    // Creating global resource managers
    queueAssets();
    animman = new AnimationManager();

    setScreen(screenlist[SCREEN_SPLASH]);

    nextscreen = SCREEN_SPLASH;
    changescreen = false;

    debugtext = new BitmapFont();
    batch = new SpriteBatch();

    Gdx.app.setLogLevel(Application.LOG_DEBUG);
}
项目:legend-of-waffles    文件:DeathScene.java   
@Override
public void render(final Rectangle screenBounds) {
    final TilesetGraphicsGenerator g = (new TilesetGraphicsGenerator());
    final int centerX = (Constants.GameWidth / 2);
    drawBorder(7, 6, 32, 5);
    g.drawText(centerX - ((8 * 13) / 2), 22, "YOU HAS DIED!");
    g.drawText(centerX - ((8 * 27) / 2), 30, "TRY AGAIN FOR GREAT JUSTICE");

    drawBorder(92, 94, 11, 5);
    g.drawText(centerX - ((8 * 8) / 2), 110, "CONTINUE");
    g.drawText(centerX - ((8 * 4) / 2), 118, "QUIT");

    if (Gdx.app.getType() == Application.ApplicationType.Android) {

    } else {
        g.drawTile(centerX - ((8 * 10) / 2), 109 + (_menuSelection * 8), 1);
        g.drawTile(centerX + ((8 * 8) / 2), 109 + (_menuSelection * 8), 1);
    }
}
项目:evilrain    文件:ParticleRenderer.java   
static final public ShaderProgram createShader(Color pColor) {
    String prefix = "";
    if(Gdx.app.getType() == Application.ApplicationType.Desktop)
        prefix +="#version 120\n";
    else
        prefix +="#version 100\n";

    final String vertexShader = Gdx.files.internal("data/shaders/drop_pre_shader.vert").readString();
    final String fragmentShader = Gdx.files.internal("data/shaders/drop_pre_shader.frag").readString();

    ShaderProgram shader = new ShaderProgram(prefix + vertexShader,
            prefix + fragmentShader);
    if(!shader.isCompiled()) {
        Gdx.app.log("ERROR", shader.getLog());
    }

    return shader;
}
项目:MikuMikuStudio    文件:GdxAudioRenderer.java   
@Override
public void playSourceInstance(AudioNode audioNode) {
    Gdx.app.log("GdxAudioRenderer", "playSourceInstance");
    GdxAudioData audioData;
    audioData = (GdxAudioData) audioNode.getAudioData();
    Music music = musicMap.get(audioNode);
    if (Gdx.app.getType() == Application.ApplicationType.iOS && audioData.getAssetKey().getName().endsWith(".ogg")) {
        return;
    }
    if (music == null) {
        music = Gdx.audio.newMusic(GdxAssetCache.getFileHandle(audioData.getAssetKey().getName()));
        musicMap.put(audioNode, music);
    }
    music.stop();
    music.play();
    audioNode.setStatus(AudioNode.Status.Playing);
}