Exemple #1
0
  /**
   * Initialize the library. Must be called before any use of the library. Must be called by passing
   * the PApplet. e.g. {@code Fisica.init(this)}
   *
   * @param applet The applet on which to use the library. This library can only be used with one
   *     applet
   */
  public static void init(PApplet applet) {
    m_parent = applet;
    m_initialized = true;

    m_viewport = new FViewport();
    m_viewport.setScaleTransform(20);
  }
Exemple #2
0
 public static Vec2 worldToScreen(float x, float y) {
   return m_viewport.getWorldToScreen(x, y);
 }
Exemple #3
0
 public static Vec2 worldToScreen(Vec2 m_in) {
   return m_viewport.getWorldToScreen(m_in);
 }
Exemple #4
0
 public static float screenToWorld(float a) {
   return m_viewport.getScreenToWorld(a);
 }
Exemple #5
0
 public static Vec2 screenToWorld(float x, float y) {
   return m_viewport.getScreenToWorld(x, y);
 }
Exemple #6
0
 public static Vec2 screenToWorld(Vec2 m_in) {
   return m_viewport.getScreenToWorld(m_in);
 }
Exemple #7
0
 /**
  * Set the scale from screen units to world units. By setting the scale to 20 we are stating that
  * 20 pixels is equivalent to 1 meter in the simulated world.
  *
  * @param scale the number of pixels that are equivalent to 1 meter in the simulated world.
  */
 public static void setScale(float scale) {
   m_viewport.m_scale = scale;
 }
Exemple #8
0
 public static float worldToScreen(float a) {
   return m_viewport.getWorldToScreen(a);
 }