Java Code Examples for aurelienribon.tweenengine.Tween#registerAccessor()

The following examples show how to use aurelienribon.tweenengine.Tween#registerAccessor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: URacer.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
public URacer (BootConfig boot) {
	running = true;
	this.boot = boot;

	Tween.registerAccessor(Message.class, new MessageAccessor());
	Tween.registerAccessor(HudLabel.class, new HudLabelAccessor());
	Tween.registerAccessor(BoxedFloat.class, new BoxedFloatAccessor());

	Convert.init(Config.Physics.PixelsPerMeter);

	// Initialize the timers after creating the game screen, so that there will be no huge discrepancies between the first
	// lastDeltaTimeSec value and the followers. Note those initial values are carefully choosen to ensure that the first
	// iteration ever is going to at least perform one single tick
	PhysicsDtNs = (long)((long)1000000000 / (long)Config.Physics.TimestepHz);
	timeStepHz = (long)Config.Physics.TimestepHz;
	timeAccuNs = PhysicsDtNs;

	temporalAliasing = 0;
	timeMultiplier = Config.Physics.TimeMultiplier;
	ShaderLoader.Pedantic = true;
}
 
Example 2
Source File: TimelineApplet.java    From universal-tween-engine with Apache License 2.0 6 votes vote down vote up
public MyCanvas() {
	Tween.enablePooling(false);
	Tween.registerAccessor(Sprite.class, new SpriteAccessor());
	
	imgUniversalSprite = new Sprite("img-universal.png").setCentered(false);
	imgTweenSprite = new Sprite("img-tween.png").setCentered(false);
	imgEngineSprite = new Sprite("img-engine.png").setCentered(false);
	imgLogoSprite = new Sprite("img-logo.png");
	blankStripSprite = new Sprite("blankStrip.png");

	try {
		BufferedImage bgImage = ImageIO.read(TimelineApplet.class.getResource("/aurelienribon/tweenengine/applets/gfx/transparent-dark.png"));
		bgPaint = new TexturePaint(bgImage, new Rectangle(0, 0, bgImage.getWidth(), bgImage.getHeight()));
	} catch (IOException ex) {
	}
}
 
Example 3
Source File: TweenApplet.java    From universal-tween-engine with Apache License 2.0 5 votes vote down vote up
public MyCanvas() {
	Tween.enablePooling(false);
	Tween.registerAccessor(Sprite.class, new SpriteAccessor());
	addMouseListener(mouseAdapter);

	vialSprite = new Sprite("vial.png");
	vialSprite.setPosition(100, 100);

	try {
		BufferedImage bgImage = ImageIO.read(TweenApplet.class.getResource("/aurelienribon/tweenengine/applets/gfx/transparent-dark.png"));
		bgPaint = new TexturePaint(bgImage, new Rectangle(0, 0, bgImage.getWidth(), bgImage.getHeight()));
	} catch (IOException ex) {
	}
}
 
Example 4
Source File: Main.java    From xibalba with MIT License 4 votes vote down vote up
/**
 * Setup & load the main menu.
 */
public void create() {
  // Debug shit
  debug = new Debug();

  // Load custom font
  assets = new AssetManager();
  FreeTypeFontGenerator generator =
      new FreeTypeFontGenerator(Gdx.files.internal("ui/Aller_Rg.ttf"));
  FreeTypeFontGenerator.FreeTypeFontParameter parameter =
      new FreeTypeFontGenerator.FreeTypeFontParameter();
  parameter.size = 12;
  BitmapFont font = generator.generateFont(parameter);
  generator.dispose();

  // Create UI skin
  skin = new Skin();
  skin.add("Aller", font, BitmapFont.class);
  skin.addRegions(new TextureAtlas(Gdx.files.internal("ui/uiskin.atlas")));
  skin.load(Gdx.files.internal("ui/uiskin.json"));
  skin.getFont("default-font").getData().markupEnabled = true;

  // Setup text colors
  Colors.put("LIGHT_GRAY", parseColor("c2c2c2"));
  Colors.put("DARK_GRAY", parseColor("666666"));
  Colors.put("CYAN", parseColor("67C8CF"));
  Colors.put("RED", parseColor("D67474"));
  Colors.put("YELLOW", parseColor("E0DFB1"));
  Colors.put("GREEN", parseColor("67CF8B"));

  // Environment colors
  Colors.put("forestFloor", parseColor("78AD8A"));
  Colors.put("forestFloorWet", parseColor("70BBAD"));
  Colors.put("forestTree-1", parseColor("67CF8B"));
  Colors.put("forestTree-2", parseColor("77E09B"));
  Colors.put("forestTree-3", parseColor("4AC775"));

  Colors.put("caveFloor-1", parseColor("7A7971"));
  Colors.put("caveFloor-2", parseColor("8C8B82"));
  Colors.put("caveFloor-3", parseColor("696862"));
  Colors.put("caveFloorWet", parseColor("71A48E"));
  Colors.put("caveWall", parseColor("66655C"));

  Colors.put("waterShallowLightBlue", parseColor("67C8CF"));
  Colors.put("waterShallowDarkBlue", parseColor("139EA8"));
  Colors.put("waterDeepLightBlue", parseColor("139EA8"));
  Colors.put("waterDeepDarkBlue", parseColor("0B7880"));

  Colors.put("waterShallowLightGreen", parseColor("67CFAB"));
  Colors.put("waterShallowDarkGreen", parseColor("13A88F"));
  Colors.put("waterDeepLightGreen", parseColor("13A88F"));
  Colors.put("waterDeepDarkGreen", parseColor("0B8074"));

  Colors.put("fire-1", parseColor("ED6161"));
  Colors.put("fire-2", parseColor("EDBE61"));
  Colors.put("fire-3", parseColor("ED9661"));

  // Decoration colors
  Colors.put("stone", Colors.get("LIGHT_GRAY"));
  Colors.put("bridge", parseColor("969482"));

  // Background colors
  Colors.put("screenBackground", parseColor("293033"));
  Colors.put("forestBackground", parseColor("29332F"));
  Colors.put("caveBackground", parseColor("293033"));

  // Tween manager
  tweenManager = new TweenManager();
  Tween.setCombinedAttributesLimit(4);
  Tween.registerAccessor(Sprite.class, new SpriteAccessor());

  // Cameras
  handheldCamera = new HandheldCamera();
  cameraShake = new CameraShake();

  // Start the main menu
  setScreen(new LoadingScreen(this));
}