88import com .ndsl .graphics .display .drawable .img .GImage ;
99import com .ndsl .graphics .display .drawable .img .ImageDrawable ;
1010import com .ndsl .graphics .display .drawable .non_sync .ui .Button ;
11+ import com .ndsl .graphics .display .drawable .synced .SyncedStringDrawable ;
1112import com .ndsl .graphics .display .layer .Layer ;
1213import com .ndsl .graphics .pos .Pos ;
1314import com .ndsl .graphics .pos .Rect ;
1415
1516import javax .imageio .ImageIO ;
1617import java .awt .*;
18+ import java .awt .event .KeyEvent ;
1719import java .io .File ;
1820import java .io .IOException ;
1921
@@ -25,7 +27,7 @@ public class GraphicsMain {
2527 public Display display ;
2628
2729 public static void main (String [] args ) throws IOException {
28- new GraphicsMain ().animatorTest ();
30+ new GraphicsMain ().syncTest ();
2931 }
3032
3133 public void onRun (){
@@ -77,4 +79,18 @@ public void animatorTest() throws IOException {
7779 if (display .limiter .onUpdate ()) display .update ();
7880 }
7981 }
82+
83+ public void syncTest (){
84+ display = new Display ("NDSL/Graphics" ,3 ,new Rect (new Pos (100 ,100 ),new Pos (600 ,600 )));
85+ int count =0 ;
86+ SyncedStringDrawable s_d =new SyncedStringDrawable ("Counts:" +count ,new Rect (100 ,100 ,200 ,200 ),"id" );
87+ display .layerManager .get ("default" ).add (new Drawable (s_d ));
88+ while (true ){
89+ if (display .keyHandler .isKeyPressing (KeyEvent .VK_ENTER )){
90+ ++count ;
91+ s_d .setText ("Counts:" +count );
92+ }
93+ if (display .limiter .onUpdate ()) display .update ();
94+ }
95+ }
8096}
0 commit comments