/** * 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); }
public static Vec2 worldToScreen(float x, float y) { return m_viewport.getWorldToScreen(x, y); }
public static Vec2 worldToScreen(Vec2 m_in) { return m_viewport.getWorldToScreen(m_in); }
public static float screenToWorld(float a) { return m_viewport.getScreenToWorld(a); }
public static Vec2 screenToWorld(float x, float y) { return m_viewport.getScreenToWorld(x, y); }
public static Vec2 screenToWorld(Vec2 m_in) { return m_viewport.getScreenToWorld(m_in); }
/** * 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; }
public static float worldToScreen(float a) { return m_viewport.getWorldToScreen(a); }