Skip to content

Instantly share code, notes, and snippets.

@toolforger
Created May 1, 2013 20:17
Show Gist options
  • Save toolforger/5498038 to your computer and use it in GitHub Desktop.
Save toolforger/5498038 to your computer and use it in GitHub Desktop.
Added Javadoc to TbtQuadComponent Please review whether the part about "all coordinates are relative to the lower-left border" is correct.
Index: com/simsilica/lemur/component/TbtQuadBackgroundComponent.java
===================================================================
--- com/simsilica/lemur/component/TbtQuadBackgroundComponent.java (Revision 1008)
+++ com/simsilica/lemur/component/TbtQuadBackgroundComponent.java (Arbeitskopie)
@@ -45,10 +45,45 @@
import com.simsilica.lemur.core.GuiMaterial;
import com.simsilica.lemur.geom.TbtQuad;
-
/**
- *
- * @author Paul Speed
+ * A texture-covered background quad.<br>
+ * The texture is split up into a three-by-three grid in this fashion:
+ *
+ * <pre>
+ * +---+--------------+-------+
+ * | | <-----> | |
+ * y2 +---+--------------+-------+
+ * | | | |
+ * | ^ | ^ | ^ |
+ * | | | | | | |
+ * | | | <-----> | | |
+ * | | | | | | |
+ * | v | v | v |
+ * | | | |
+ * y1 +---+--------------+-------+
+ * | | <-----> | |
+ * +---+--------------+-------+
+ * x1 x2
+ * </pre>
+ *
+ * Arrows indicate the direction in which each grid cell will stretch to fill
+ * the area given by the component.<br>
+ * All coordinates are relative to the lower-left border.
+ * <p>
+ * <b>Common pitfalls</b>
+ * <ul>
+ * <li>Placing controls on a fractional coordinate. This usually happens when
+ * centering controls.
+ * <li>Having a contrast at the border between stretched and unstretched texture
+ * zone (e.g. a black border and a white center). Stretching involves
+ * interpolating colors with the neighbouring pixels (i.e. you'll get a
+ * black-to-white color gradient).<br>
+ * The easiest workaround is to make the border one pixel wider so that the
+ * contrast will be safely inside the unstretched area.
+ * <li>Using a texture that is larger than the quad.
+ * </ul>
+ *
+ * @author Paul Speed, Joachim "Toolforger" Durchholz (Javadoc)
*/
public class TbtQuadBackgroundComponent extends AbstractGuiComponent
implements Cloneable, ColoredComponent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment