22
33import com .cleanroommc .modularui .api .drawable .IDrawable ;
44import com .cleanroommc .modularui .api .drawable .IKey ;
5- import com .cleanroommc .modularui .drawable .GuiDraw ;
65import com .cleanroommc .modularui .drawable .GuiTextures ;
76import com .cleanroommc .modularui .drawable .Rectangle ;
87import com .cleanroommc .modularui .screen .CustomModularScreen ;
@@ -45,27 +44,35 @@ public class GLTestGui extends CustomModularScreen {
4544 public @ NotNull ModularPanel buildUI (ModularGuiContext context ) {
4645 this .ro1 = new RenderObject ();
4746 this .ro2 = new RenderObject ();
47+ this .ro1 .type = Type .ITEM ;
48+ this .ro1 .lighting = Lighting .GUI_ITEM ;
49+ this .ro1 .texture = true ;
4850 return new ModularPanel ("gl_test" )
4951 .size (250 )
5052 .padding (7 )
5153 .child (Flow .column ()
54+ .debugName ("main col" )
5255 .child (Flow .row ()
56+ .debugName ("config row" )
5357 .fullWidth ()
5458 .coverChildrenHeight ()
5559 .child (buildRenderObjectConfig (this .ro1 )
56- .marginRight ( 2 ))
60+ .debugName ( "config left col" ))
5761 .child (new Rectangle ().setColor (Color .TEXT_COLOR_DARK ).asWidget ()
62+ .debugName ("separator" )
5863 .width (1 )
64+ .margin (2 , 0 )
5965 .fullHeight ())
6066 .child (buildRenderObjectConfig (this .ro2 )
61- .marginLeft ( 2 )))
62- .child (createPreview ().expanded ()));
67+ .debugName ( "config right col" )))
68+ .child (createPreview ().expanded (). fullWidth (). debugName ( "preview" ) ));
6369
6470 }
6571
6672 private Flow buildRenderObjectConfig (RenderObject ro ) {
6773 return Flow .column ()
68- .widthRel (0.5f )
74+ //.widthRel(0.5f)
75+ .expanded ()
6976 .coverChildrenHeight ()
7077 .child (new CycleButtonWidget ()
7178 .value (new EnumValue .Dynamic <>(Type .class , () -> ro .type , val -> ro .type = val ))
@@ -159,21 +166,24 @@ public void draw(GuiContext context, int x, int y, int width, int height, Widget
159166 GlStateManager .pushMatrix ();
160167 GlStateManager .translate (0 , 0 , zLevel );
161168 if (depth ) GlStateManager .enableDepth ();
169+ else GlStateManager .disableDepth ();
162170 if (blend ) GlStateManager .enableBlend ();
171+ else GlStateManager .disableBlend ();
163172 if (texture ) GlStateManager .enableTexture2D ();
173+ else GlStateManager .disableTexture2D ();
164174 lighting .enable .run ();
165175 type .render .draw (context , x , y , width , height , widgetTheme );
166176 lighting .disable .run ();
167- if ( texture ) GlStateManager .disableTexture2D ();
168- if ( blend ) GlStateManager .disableBlend ();
169- if ( depth ) GlStateManager .disableDepth ();
177+ GlStateManager .disableTexture2D ();
178+ GlStateManager .disableBlend ();
179+ GlStateManager .disableDepth ();
170180 GlStateManager .popMatrix ();
171181 }
172182 }
173183
174184 private enum Type {
175- NONE (( ctx , x , y , w , h , wt ) -> {} ),
176- TEXTURE (( ctx , x , y , w , h , wt ) -> GuiDraw . drawTexture ( x , y , w , h , 0f , 0f , 1f , 1f ) ),
185+ NONE (IDrawable . EMPTY ),
186+ TEXTURE (GuiTextures . MUI_LOGO ),
177187 ITEM (GLTestGui ::drawItem ),
178188 COLOR (GLTestGui ::drawColor );
179189
@@ -183,7 +193,7 @@ private enum Type {
183193 }
184194
185195 private enum Lighting {
186- NONE (() -> {}, () -> {} ),
196+ NONE (GlStateManager :: disableLighting , GlStateManager :: disableLighting ),
187197 NORMAL (GlStateManager ::enableLighting , GlStateManager ::disableLighting ),
188198 STANDARD (RenderHelper ::enableStandardItemLighting , RenderHelper ::disableStandardItemLighting ),
189199 GUI_ITEM (RenderHelper ::enableGUIStandardItemLighting , RenderHelper ::disableStandardItemLighting );
0 commit comments