@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)); }
@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(); } }
@Override public void show() { super.show(); layout = new GlyphLayout(); font = new NativeFont(new NativeFontPaint(25)); font.appendText("正在加载...0123456789%"); font.setColor(Color.BLACK); layout.setText(font, "正在加载...100%"); stage = new Stage(new StretchViewport(1280, 720)); assetManager = new AssetManager(); assetManager.setLogger(new Logger("log", Logger.DEBUG)); assetManager.setLoader(CocosScene.class, new CocosLoader(new InternalFileHandleResolver())); assetManager.load("mainscene/MenuScene.json", CocosScene.class); }
public CameraSystem(){ float viewWidth = App.engine.viewWidth, viewHeight = App.engine.viewHeight; logger = new Logger("CameraSystem",LOG_LEVEL); logger.debug("initializing"); logger.debug("ViewSize is " + viewWidth + "x" + viewHeight); camera = new OrthographicCamera(); viewport = new ExtendViewport(viewWidth,viewHeight,0,0,camera); this.setProcessing(false); camera.zoom = 1.1f; /* camera.position.x = viewport.getWorldWidth() / 2; camera.position.y = 200; */ camRect = new Rectangle(); }
public ParticleEffectPools() { logger = new Logger(TAG, Env.debugLevel); logger.info("initialising"); pools = new ObjectMap<String, ParticleEffectPool>(); try { JsonReader reader = new JsonReader(); JsonValue root = reader.parse(Gdx.files.internal(PARTICLES_FILE)); JsonIterator particlesIt = root.iterator(); while (particlesIt.hasNext()) { JsonValue particleValue = particlesIt.next(); String effectName = particleValue.asString(); logger.info("loading " + effectName); ParticleEffect effect = new ParticleEffect(); effect.load(Gdx.files.internal(effectName), Gdx.files.internal(PARTICLES_FOLDER)); pools.put(effectName, new ParticleEffectPool(effect, Env.particlePoolInitialCapacity, Env.particlePoolMaxCapacity)); } } catch (Exception e) { logger.error("failed to list directory " + PARTICLES_FILE); } }
/** * @param world box2D world to work with. * @param unitsPerPixel conversion ratio from pixel units to box2D metres. * @param materialsFile json file with specific physics properties to be assigned to newly created bodies. * @param loggingLevel verbosity of the embedded logger. */ public MapBodyManager(World world, float unitsPerPixel, FileHandle materialsFile, int loggingLevel) { logger = new Logger("MapBodyManager", loggingLevel); logger.info("initialising"); this.world = world; this.units = unitsPerPixel; FixtureDef defaultFixture = new FixtureDef(); defaultFixture.density = 1.0f; defaultFixture.friction = 0.8f; defaultFixture.restitution = 0.0f; materials.put("default", defaultFixture); if (materialsFile != null) { loadMaterialsFile(materialsFile); } }
public Assets(SoundService soundService, GraphicsService graphicsService, LocaleService localeService, TaflLevelService levelService, TaflGame game) { super(soundService, graphicsService, localeService, levelService, game); this.soundService = soundService; this.graphicsService = graphicsService; this.localeService = localeService; this.levelService = levelService; this.game = game; assetManager.setLoader(com.badlogic.gdx.scenes.scene2d.ui.Skin.class, new CustomSkinLoader(new InternalFileHandleResolver())); if (Constants.GameConstants.DEBUG) { assetManager.getLogger().setLevel(Logger.DEBUG); } }
/** * @param world * the EntityWorld to work with * @param unitsPerPixel * conversion ratio from pixel units to box2D metres. * @param materialsFile * xml file with specific physics properties to be assigned to * newly created bodies. * @param loggingLevel * verbosity of the embedded logger. */ public MapBodyManager(EntityWorld world, float unitsPerPixel, String materialsFile, int loggingLevel) { m_logger = new Logger("MapBodyManager", loggingLevel); m_logger.info("initialising"); m_world = world; m_physicsWorld = world.getBox2DWorld(); m_units = unitsPerPixel; FixtureDef defaultFixture = new FixtureDef(); defaultFixture.density = 1.0f; defaultFixture.friction = 0.8f; defaultFixture.restitution = 0.0f; m_materials.put("default", defaultFixture); if (materialsFile != null) { loadMaterialsFile(materialsFile); } }
public StartSession(AbstractGame game, int session) { this.game = game; this.session = session; log.setLevel(Logger.INFO); }
public AnimationStateDataLoader(FileHandleResolver resolver) { super(resolver); logger = new Logger("AnimationStateDataLoader"); data = null; logger.info("initialising"); }
@Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); getAssetManager().getLogger().setLevel(Logger.DEBUG); Screen currentScreen = new LoadingGameScreen(this, new GameScreen(this)); setScreen(currentScreen); }
public GameScreen(){ logger = new Logger("GameScreen",LOG_LEVEL); logger.debug("intitializing"); }
public UserInterface(){ logger = new Logger("UserInterface",LOG_LEVEL); logger.debug("initializing"); stage = new Stage(); isTouchScreen = (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS); if (isTouchScreen) { logger.info("Touchscreen detected"); createTouchControls(); } }
@Override public void create() { Gdx.app.setLogLevel(Logger.DEBUG); assets = new Assets(); engine = new GameEngine(); engine.initialize(); gameScreen = new GameScreen(); setScreen(gameScreen); }
@SuppressWarnings("unchecked") public SpriteRenderSystem() { super(Family.all(PhysicsComponent.class,SpriteComponent.class).get()); logger = new Logger("SpriteRenderSystem",LOG_LEVEL); logger.debug("initializing"); batch = new SpriteBatch(); for (SpriteLayer l : SpriteLayer.values()){ spriteLayers.put(l, new ObjectSet<Sprite>()); } }
public static void init(SionGame game) { logger.info("initialising"); Env.game = game; settings = new Settings("data/config/globals.xml"); virtualWidth = settings.getFloat("virtualWidth", 1280.0f); virtualHeight = settings.getFloat("virtualHeight", 720.0f); aspectRatio = virtualWidth / virtualHeight; metresToPixels = settings.getFloat("metresToPixels", 64); pixelsToMetres = 1.0f / metresToPixels; catchBack = settings.getBoolean("catchBack", true); catchMenu = settings.getBoolean("catchMenu", true); catchMenu = settings.getBoolean("catchMenu", true); Vector3 background = settings.getVector("backgroundColor", Vector3.Zero); backgroundColor = new Color(background.x, background.y, background.z, 1.0f); Vector3 gravity3 = settings.getVector("gravity", Vector3.Zero); gravity = new Vector2(gravity3.x, gravity3.y); doSleep = settings.getBoolean("doSleep", false); velocityIterations = settings.getInt("velocityIterations", 6); positionIterations = settings.getInt("positionIterations", 10); physicsDeltaTime = settings.getFloat("physicsDeltaTime", 0.01f); particlePoolInitialCapacity = settings.getInt("particlePoolInitialCapacity", 5); particlePoolMaxCapacity = settings.getInt("particlePoolMaxCapacity", 20); debugLevel = settings.getInt("debugLevel", Logger.INFO); debug = debugLevel > Logger.ERROR; drawBodies = settings.getBoolean("drawBodies", false); drawJoints = settings.getBoolean("drawJoints", false); drawABBs = settings.getBoolean("drawABBs", false); drawInactiveBodies = settings.getBoolean("drawInactiveBodies", false); drawVelocities = settings.getBoolean("drawVelocities", false); drawContacts = settings.getBoolean("drawContacts", false); drawStage = settings.getBoolean("drawStage", false); drawGrid = settings.getBoolean("drawGrid", true); drawFPS = settings.getBoolean("drawFPS", true); }
public EntityFactory () { logger = new Logger(TAG, Env.debugLevel); logger.info("initialising"); archetypes = new ObjectMap<String, Entity>(); readers = new ObjectMap<Class<? extends Component>, ComponentReader>(); constructors = new ObjectMap<Class<? extends Component>, Constructor<? extends Component>>(); }
/** * Creates a new AnimationLoader * * @param resolver file resolver to be used */ public SpriteAnimationLoader(FileHandleResolver resolver) { super(resolver); animationData = null; logger = new Logger("Animation", Env.debugLevel); }
public AnimationStateDataLoader(FileHandleResolver resolver) { super(resolver); logger = new Logger("AnimationStateDataLoader", Env.debugLevel); data = null; logger.info("initialising"); }
/** * Will load the folder + / + language + .csv file * * @param folder * @param language * @param loggingLevel */ public LanguageManager(String folder, String language) { this.logger = new Logger(TAG, Env.debugLevel); this.folder = folder; this.languageName = language; if (!loadLanguage(languageName) && !languageName.equals(DEFAULT_LANGUAGE)) { loadLanguage(DEFAULT_LANGUAGE); } }
public Assets(String assetFile) { logger = new Logger(TAG, Env.debugLevel); logger.info("initialising"); manager = new AssetManager(); // manager.setErrorListener(this); manager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver())); manager.setLoader(PhysicsData.class, new PhysicsLoader(new InternalFileHandleResolver())); manager.setLoader(SpriteAnimationData.class, new SpriteAnimationLoader(new InternalFileHandleResolver())); manager.setLoader(SkeletonData.class, new SkeletonDataLoader(new InternalFileHandleResolver())); manager.setLoader(AnimationStateData.class, new AnimationStateDataLoader(new InternalFileHandleResolver())); loadGroups(assetFile); }
public CategoryBitsManager() { logger = new Logger("CategoryBitsManager", Env.debugLevel); logger.info("initialising"); categoryBits = new ObjectMap<String, Short>(); categoryNames = new ObjectMap<Short, String>(); nextCategory = 0; }
public AssetLoadingTask (AssetManager manager, AssetDescriptor assetDesc, AssetLoader loader, AsyncExecutor threadPool) { this.manager = manager; this.assetDesc = assetDesc; this.loader = loader; this.executor = threadPool; startTime = manager.log.getLevel() == Logger.DEBUG ? TimeUtils.nanoTime() : 0; }
public static MemoryTrackingAssetManager assetManager() { if (assetManager == null) { assetManager = new MemoryTrackingAssetManager(new FileResolverMultiplexer()); if (TowerConsts.DEBUG) { assetManager.getLogger().setLevel(Logger.ERROR); } Texture.setAssetManager(assetManager); try { assetList = TowerGameService.instance().getObjectMapper().readValue(Gdx.files.internal("assets.json").read(), AssetList.class); ensureAssetsAreLoaded(); } catch (IOException e) { throw new RuntimeException(e); } TextureLoader.TextureParameter parameter = new TextureLoader.TextureParameter(); parameter.genMipMaps = true; parameter.minFilter = MipMapNearestNearest; parameter.magFilter = Linear; assetManager.load(checkForHDPI("elevator/shaft.png"), Texture.class, parameter); assetManager.load(checkForHDPI("elevator/empty.png"), Texture.class, parameter); defaultSkin = new Skin(Gdx.files.internal("default-skin.json")); makeCustomGUISkin(); } return assetManager; }
public Assets() { inst = this; manager = new AssetManager(); manager.setErrorListener(new AssetErrorListener() { @Override public void error(AssetDescriptor assetDescriptor, Throwable throwable) { Log.error(assetDescriptor.toString()); Log.error(throwable.getMessage()); } }); manager.getLogger().setLevel(Logger.DEBUG); }
@Override public void create() { Settings.DEBUG = true; Settings.DRAW_FPS = true; Settings.FIXED_TIME_STEP = 1 / 75F; Settings.DRAGGABLE_BOX2D_BODIES = true; Settings.DEBUG_LEVEL = Logger.DEBUG; Settings.DRAW_BOX2D_ABBs = false; Settings.DRAW_BOX2D_BODIES = true; Settings.DRAW_BOX2D_JOINTS = true; Settings.DRAW_BOX2D_CONTACTS = true; Settings.DRAW_BOX2D_VELOCITIES = true; //Settings.DEBUG_ENTITY = "Player"; Settings.DEBUG_TAGS.add("System"); Settings.DEBUG_TAGS.add("Game"); Settings.DEBUG_TAGS.add("LogicBricksEngine"); // Settings.DEBUG_TAGS.add("MotionActuatorSystem"); //Settings.DEBUG_TAGS.add("EntityBuilder"); context = new ContextTest(); context.load(); engine = context.get(LogicBricksEngine.class); physics = context.get(World.class); assetManager = context.get(AssetManager.class); builders = context.get(LBBuilders.class); game = context.get(Game.class); }
public BaseTest() { GdxNativesLoader.load(); SpriteBatch batch = Mockito.mock(SpriteBatch.class); when(batch.getColor()).thenReturn(new Color()); Gdx.input = Mockito.mock(Input.class); Gdx.app = Mockito.mock(Application.class); Gdx.graphics = Mockito.mock(Graphics.class); when(Gdx.graphics.getWidth()).thenReturn((int) Settings.WIDTH); when(Gdx.graphics.getHeight()).thenReturn((int) Settings.HEIGHT); Settings.DEBUG_LEVEL = Logger.DEBUG; Settings.TESTING = true; Settings.MAX_STEPS = 60; GameContext context = new ContextTest(); context.load(); this.game = context.get(Game.class); engine = context.get(LogicBricksEngine.class); builders = context.get(LBBuilders.class); entityBuilder = builders.getEntityBuilder(); bodyBuilder = builders.getBodyBuilder(); }
public OVDScriptManager() { log = new Logger( OVDScriptManager.class.getCanonicalName(), Logger.INFO ); bsh = new Interpreter(); /* try { bsh.eval( "print( \"Hello World\" );" ); } catch( EvalError e ) { log.error( "Error evaluating script.", e ); } */ }
/** * Retrieves a log from the LogManager or creates one if it doesn't exist. * * @param logName * The name of the log to retrieve. * @param type * The type of the log to retrieve. * @return The specified log from the manager. */ public static Logger getLog(String logName, LogType type) { // If the log does not exist in the current logs list. if (!logs.containsKey(logName)) { // Create a new log with logName. logs.put(logName, new com.badlogic.gdx.utils.Logger(logName, type.asInt())); } return logs.get(logName); }
public LibgdxLog(Class<?> objectType) { this.logger = new Logger(objectType.getSimpleName(), Gdx.app.getLogLevel()); }
@Before public void setup() { // TODO rimuovere sto porcame PreferencesBasedFeedbacksStorage.LOG.setLevel(Logger.ERROR); }
public RefCounts() { log.setLevel(Logger.NONE); }
@Override public void create () { logger = new Logger(LibgdxJam.class.getName(), Env.LOG_LEVEL); logger.info("create"); Env.init(this); Box2D.init(); categories = new Categories(); tags = new Tags(); assetManager = new AssetManager(); assetManager.setLoader( SkeletonData.class, new SkeletonDataLoader( new InternalFileHandleResolver() ) ); assetManager.setLoader( OverlapScene.class, new OverlapSceneLoader( new InternalFileHandleResolver() ) ); assetManager.setLoader( PhysicsData.class, new PhysicsDataLoader( new InternalFileHandleResolver(), categories ) ); assetManager.setLoader( AnimationControl.class, new AnimationControlLoader( new InternalFileHandleResolver(), tags ) ); tweenManager = new TweenManager(); Tween.registerAccessor(Camera.class, new CameraAccessor()); uiCamera = new OrthographicCamera(); uiViewport = new ExtendViewport( Env.MIN_UI_WIDTH, Env.MIN_UI_HEIGHT, Env.MAX_UI_WIDTH, Env.MAX_UI_HEIGHT, uiCamera ); stage = new Stage(uiViewport); Gdx.input.setInputProcessor(inputMultiplexer); inputMultiplexer.addProcessor(stage); setScreen( Screens.getLoadingScreen() ); }
public MenuScreen(){ logger = new Logger("MenuScreen",LOG_LEVEL); logger.info("intializing"); }
@SuppressWarnings("unchecked") public VisionSystem(){ super(Family.all(PhysicsComponent.class,LookComponent.class).get()); logger = new Logger("VisionSystem",LOG_LEVEL); logger.debug("initializing"); }
public StateMachine(String name, Entity entity) { logger = new Logger(name, Env.debugLevel); logger.info("initialising"); states = new ObjectMap<Class<? extends State>, State>(); this.entity = entity; }
/** * @param loggingLevel verbosity of the animation data logging */ public SpriteAnimationData() { logger = new Logger("Animation", Env.debugLevel); }
@Override public void create() { Env.init(this); logger = new Logger(TAG, Env.debugLevel); logger.info("initialising"); categoryBitsManager = new CategoryBitsManager(); assets = new Assets("data/config/assets.json"); assets.loadGroup("base"); assets.finishLoading(); screens = new ObjectMap<Class<? extends SionScreen>, SionScreen>(); nextScreen = null; currentScreen = null; camera = new OrthographicCamera(); viewport = new ExtendViewport(800 * Env.pixelsToMetres, 600 * Env.pixelsToMetres, 1280 * Env.pixelsToMetres, 720 * Env.pixelsToMetres, camera); uiCamera = new OrthographicCamera(); uiViewport = new ExtendViewport(800, 600, 1280, 720, uiCamera); tweenManager = new TweenManager(); Tween.registerAccessor(OrthographicCamera.class, new CameraTweener()); Tween.registerAccessor(Actor.class, new ActorTweener()); Tween.registerAccessor(TransformComponent.class, new TransformTweener()); Tween.setCombinedAttributesLimit(4); world = new World(Env.gravity, Env.doSleep); collisionHandler = new CollisionHandler(); world.setContactListener(collisionHandler); accumulator = 0.0; currentTime = TimeUtils.millis() / 1000.0; engine = new Engine(); stage = new Stage(); stage.setViewport(uiViewport); multiplexer = new InputMultiplexer(); Gdx.input.setInputProcessor(multiplexer); Gdx.input.setCatchBackKey(Env.catchBack); Gdx.input.setCatchMenuKey(Env.catchMenu); multiplexer.addProcessor(this); languageManager = new LanguageManager("data/lang", Locale.getDefault().getLanguage()); particlePools = new ParticleEffectPools(); shaderManager = new ShaderManager(); entityFactory = new EntityFactory(); entityFactory.registerReader(new ColorComponentReader()); entityFactory.registerReader(new FontComponentReader()); entityFactory.registerReader(new MapComponentReader()); entityFactory.registerReader(new OverridePhysicsComponentReader()); entityFactory.registerReader(new ParticleComponentReader()); entityFactory.registerReader(new PhysicsComponentReader()); entityFactory.registerReader(new ShaderComponentReader()); entityFactory.registerReader(new SpineComponentReader()); entityFactory.registerReader(new SpriteComponentReader()); entityFactory.registerReader(new StateComponentReader()); entityFactory.registerReader(new TextureComponentReader()); entityFactory.registerReader(new TransformComponentReader()); }
public PhysicsLoader(FileHandleResolver resolver) { super(resolver); logger = new Logger("Physics", Env.debugLevel); }