Graphics lib of NDSLib
Display is made of JFrame(so Swing)
newDisplay("title",%BufferSize%,%OnDisplayRect%)BufferSize is 2 is Double Buffer. 3 is Triple Buffer. OnDisplayRect will decide Window Pos and Size
layer allows you easy operation.
e.g. for get Layer from Display LayerManager
Display.layerManager.get("%String id%")
Diaplay.layerManager.get(%FrameLayerNum%)newDrawable(newIDrawable(%SomeThing%))and Drawable register to Display Layer.
Layer.addDrawable(Drawable)If You Want to Changed State of Drawable,It's not hard.
newDrawable(newSynced...())IDrawable which is name starts with "Synced",It Supports dynamic Value Changing.
e.g. SyncedStringDrawable
SyncedStringDrawables_d=newSyncedStringDrawable("Before Change",newRect(100,100,200,200),"id");
display.layerManager.get("default").add(newDrawable(s_d));
s_d.setText("After Change");
while(true){
if (display.limiter.onUpdate()) display.update();
}It will draw "After Change",(Because It was Changed!)
if you want make CutomDrawable, you must implement IDrawable
publicclasstest_cutom_DrawableimplmentsIDrawable{
@OverridepublicvoidonDraw(Graphicsg, Rectrect) {
//To SomeThing draw.
}
@OverridepublicRectgetShowingRect(){
//Retrun border of Showing Content
}
@OverridepublicbooleanisShowing(Displaydisplay){
//returns Is this showing.//Usually Use Display.isShowing(Rect rect)returndisplay.isShowing(getShowingRect());
}
@OverridepublicStringgetID(){
return"Drawable ID";
}
} and Use this for
layer.addDrawable(newtest_custom_drawable());You can add own Drawable! (DefaultCustomDrawables is LineDrawable,StringDrawable,PointDrawable)
The diffrence between GUI and Drawable is GUI always Draw. (EASY!)
To make;
newGUIBase("test",newPos(),"id")and register,
Display.addDrawable(newDrawable(GUIBase))if you want make CutomGUI, you must implement IDrawable.
publicclasstest_cutom_GUIimplmentsIDrawable{
@OverridepublicvoidonDraw(Graphicsg, Rectrect) {
//To SomeThing draw.
}
@OverridepublicRectgetShowingRect(){
//Retrun border of Showing Content
}
@OverridepublicbooleanisShowing(Displaydisplay){
//It is GUI,so We always draw it.returntrue;
}
@OverridepublicStringgetID(){
return"GUI ID";
}
} and Use this for
newDrawable(newtest_custom_GUI())