示例#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);
  }
示例#2
0
 public static Vec2 worldToScreen(float x, float y) {
   return m_viewport.getWorldToScreen(x, y);
 }
示例#3
0
 public static Vec2 worldToScreen(Vec2 m_in) {
   return m_viewport.getWorldToScreen(m_in);
 }
示例#4
0
 public static float screenToWorld(float a) {
   return m_viewport.getScreenToWorld(a);
 }
示例#5
0
 public static Vec2 screenToWorld(float x, float y) {
   return m_viewport.getScreenToWorld(x, y);
 }
示例#6
0
 public static Vec2 screenToWorld(Vec2 m_in) {
   return m_viewport.getScreenToWorld(m_in);
 }
示例#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;
 }
示例#8
0
 public static float worldToScreen(float a) {
   return m_viewport.getWorldToScreen(a);
 }