public StateTitle() { // Super super(ExampleState.TITLE, ExampleUtilities.BACKGROUND_FOLDER + "title.json"); // Create containers m_Buttons = new ButtonContainer(); Button Back = m_Buttons.addButton(BUTTON_BACK, ExampleUtilities.INTERFACE_FOLDER + "button.json", null); Back.setPosition( Utilities.instance().getWidth() - 20, Utilities.instance().getHeight() - 20, Drawable.ANCHOR_RIGHT, Drawable.ANCHOR_BOTTOM); }
public void scroll(float x, float y) { //// Scroll m_OffsetX += x; m_OffsetY += y; m_OffsetX = (Math.abs(m_OffsetX) % m_OriginalWidth) * Math.signum(m_OffsetX); m_OffsetY = (Math.abs(m_OffsetY) % m_OriginalHeight) * Math.signum(m_OffsetY); // Get original position float OriginalX = m_X / Utilities.instance().getScale(); float OriginalY = m_Y / Utilities.instance().getScale(); // Set images position m_Images[MAIN_IMAGE].setPosition(OriginalX + m_OffsetX, OriginalY + m_OffsetY); m_Images[VERTICAL_IMAGE].setPosition( OriginalX + m_OffsetX, OriginalY + m_OffsetY - (m_OriginalHeight * Math.signum(m_OffsetY))); m_Images[HORIZONTAL_IMAGE].setPosition( OriginalX + m_OffsetX - (m_OriginalWidth * Math.signum(m_OffsetX)), OriginalY + m_OffsetY); m_Images[DIAGONAL_IMAGE].setPosition( OriginalX + m_OffsetX - (m_OriginalWidth * Math.signum(m_OffsetX)), OriginalY + m_OffsetY - (m_OriginalHeight * Math.signum(m_OffsetY))); }