@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(); }
@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)); }
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); } }
@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); }
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; } } }; }
@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")); }
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); }
/** * 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"); } }
@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); } }
@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; }
@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; }
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); }
@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(); } }
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); } }
@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(); } })); } })); }
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); }
@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); }
@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); }
@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); }
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); }
/** * 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; }
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(); }
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; }
/** 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(); } }
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); } }
@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; }
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); }
@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; }
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�. }
@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(); }
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 }
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(); } }); } }
@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); }
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); }
@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); }
@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); } }
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; }
@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); }