]> O.S.I.I.S - jp/crow.git/commitdiff
divers 4/head
authorjpbruyere <jp.bruyere@hotmail.com>
Sun, 6 Mar 2016 08:09:22 +0000 (09:09 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sun, 6 Mar 2016 08:09:22 +0000 (09:09 +0100)
OTKCrow/OpenTKGameWindow.cs
Tests/Interfaces/testWindow.goml
src/GraphicObjects/GraphicObject.cs
src/Interface.cs

index f9043c05a8331b327d1bf749c6462a1b5c678bd6..07dd1d5810ec4ed309815883c8616e4998277648 100644 (file)
@@ -67,7 +67,7 @@ namespace Crow
                                ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps));
                                #if MEASURE_TIME
                                ValueChanged.Raise (this, new ValueChangeEventArgs ("update",
-                                       this.CrowInterface.updateTime.ElapsedTicks.ToString () + " ticks"));
+                                       this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks"));
                                ValueChanged.Raise (this, new ValueChangeEventArgs ("layouting",
                                        this.CrowInterface.layoutTime.ElapsedTicks.ToString () + " ticks"));
                                ValueChanged.Raise (this, new ValueChangeEventArgs ("drawing",
@@ -120,7 +120,7 @@ namespace Crow
 
                        while (true) {
                                CrowInterface.Update ();
-                               Thread.Sleep (10);
+                               Thread.Sleep (5);
                        }
                }
 
@@ -201,8 +201,8 @@ namespace Crow
                                        CrowInterface.IsDirty = false;
                                }
                        }
-                       uiQuad.Render (PrimitiveType.TriangleStrip);
 
+                       uiQuad.Render (PrimitiveType.TriangleStrip);
                        GL.BindTexture(TextureTarget.Texture2D, 0);
 
                        shader.Disable ();
index 89e064d4ed1c5d648e2860d8d39139c0eb16447b..248f46767ad6cf3b049840b1853f5c6f969d1cb0 100755 (executable)
                                Margin="10" Focusable="True" >
                                        <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
                                                <HorizontalStack Fit="true">
-                                                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
-                                                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                                                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                                                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
                                                                Background="vgradient|0:AoEnglish|1:Black"/>
                                                </HorizontalStack>
                                                <HorizontalStack Fit="true">
-                                                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
-                                                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                                                       <Label Text="Clipping:" Width="50" TextAlignment="Right"/>
+                                                       <Label Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
                                                                Background="vgradient|0:AoEnglish|1:Black"/>
                                                </HorizontalStack>
                                                <HorizontalStack Fit="true">
@@ -68,7 +68,7 @@
                                        </VerticalStack>                                
                        </Container>
                </Border>
-               <Border Fit="true" CornerRadius="5" BorderWidth="1" >
+<!--           <Border Fit="true" CornerRadius="5" BorderWidth="1" >
                        <Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Fit="true" Margin="10">
                                        <VerticalStack Fit="true" Spacing="10" >
                                                <HorizontalStack Fit="true">
@@ -81,7 +81,7 @@
                                                </HorizontalStack>
                                        </VerticalStack>
                        </Container>
-               </Border>
+               </Border>-->
                <HorizontalStack Fit="true" Background="BlueCrayola" Margin="3">
                        <GraphicObject Margin="10" Background="LimeGreen" Width="5" Height="5"/>
                        <TextBox Font="droid, 16" Multiline="true" Text="this is a test\nmultiline" Margin="2"/>
index dd83c948dcfee99d377932af36b1fa7569ff6b97..b8b2a38fbd49af55f333b93be3fe3e1307c53899 100644 (file)
@@ -662,7 +662,7 @@ namespace Crow
                public virtual void RegisterForLayouting(LayoutingType layoutType){
                        if (Parent == null)
                                return;
-                       lock (Interface.CurrentInterface.LayoutingQueue) {
+                       lock (Interface.CurrentInterface.LayoutMutex) {
                                //dont set position for stretched item
                                if (Width == 0)
                                        layoutType &= (~LayoutingType.X);
index 8224f86f31298e353d1348f8eb7bd2eb608fa8a3..3f4cc918bf4490ac7a83aee2d3169ce96ab00428 100644 (file)
@@ -228,7 +228,7 @@ namespace Crow
 
                public GraphicObject LoadInterface (string path)
                {
-                       lock (this) {
+                       lock (UpdateMutex) {
                                GraphicObject tmp = Interface.Load (path, this);
                                AddWidget (tmp);
                                return tmp;
@@ -238,7 +238,7 @@ namespace Crow
                #endregion
 
                #if MEASURE_TIME
-               public Stopwatch updateTime = new Stopwatch ();
+               public Stopwatch clippingTime = new Stopwatch ();
                public Stopwatch layoutTime = new Stopwatch ();
                public Stopwatch guTime = new Stopwatch ();
                public Stopwatch drawingTime = new Stopwatch ();
@@ -259,6 +259,7 @@ namespace Crow
                public byte[] dirtyBmp;
                public bool IsDirty = false;
                public Rectangle DirtyRect;
+               public object LayoutMutex = new object();
                public object RenderMutex = new object();
                public object UpdateMutex = new object();
 
@@ -316,12 +317,8 @@ namespace Crow
                                        FocusedWidget.onMouseClick (this, new MouseButtonEventArgs (Mouse.X, Mouse.Y, MouseButton.Left, true));
                                }
                        }
-                       #if MEASURE_TIME
-                       guTime.Reset ();
-                       updateTime.Restart ();
-                       #endif
 
-                       lock (this) {
+                       lock (UpdateMutex) {
                                processLayouting ();
 
                                clippingRegistration ();
@@ -329,9 +326,6 @@ namespace Crow
                                processDrawing ();
                        }
 
-                       #if MEASURE_TIME
-                       updateTime.Stop ();
-                       #endif
                        //                      if (ToolTip.isVisible) {
                        //                              ToolTip.panel.processkLayouting();
                        //                              if (ToolTip.panel.layoutIsValid)
@@ -354,7 +348,7 @@ namespace Crow
                        #if MEASURE_TIME
                        layoutTime.Restart();
                        #endif
-                       lock (Interface.CurrentInterface.LayoutingQueue) {
+                       lock (LayoutMutex) {
                                //Debug.WriteLine ("======= Layouting queue start =======");
                                LayoutingQueueItem lqi = null;
                                while (Interface.CurrentInterface.LayoutingQueue.Count > 0) {
@@ -367,6 +361,9 @@ namespace Crow
                        #endif
                }
                void clippingRegistration(){
+                       #if MEASURE_TIME
+                       clippingTime.Restart ();
+                       #endif
                        lock (CurrentInterface.GraphicUpdateQueue) {
                                while (CurrentInterface.GraphicUpdateQueue.Count > 0) {
                                        GraphicObject g = CurrentInterface.GraphicUpdateQueue.Dequeue ();
@@ -388,6 +385,9 @@ namespace Crow
                                }
                        }
                        RedrawList.Clear ();
+                       #if MEASURE_TIME
+                       clippingTime.Stop ();
+                       #endif
                }
                void processDrawing(){
                        #if MEASURE_TIME
@@ -504,7 +504,7 @@ namespace Crow
 
 
                public void ProcessResize(Rectangle bounds){
-                       lock (CurrentInterface) {
+                       lock (UpdateMutex) {
                                clientRectangle = bounds;
 
                                int stride = 4 * ClientRectangle.Width;