From: Tim R. <ti...@us...> - 2004-07-30 10:28:43
|
Update of /cvsroot/csdopenglnet/csdOpenGL/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10760 Modified Files: gtkFrame.cs Log Message: programm is killed by kernel! don't know why Index: gtkFrame.cs =================================================================== RCS file: /cvsroot/csdopenglnet/csdOpenGL/samples/gtkFrame.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gtkFrame.cs 30 Jul 2004 06:46:15 -0000 1.1 --- gtkFrame.cs 30 Jul 2004 10:28:30 -0000 1.2 *************** *** 11,18 **** protected bool propStop = false; protected bool propMapped = false; ! protected float rotX = 0.0f; ! protected float rotY = 0.0f; ! protected float rotZ = 0.0f; protected Fixed fixedLayout; public GtkFrame() { --- 11,20 ---- protected bool propStop = false; protected bool propMapped = false; ! protected float propRotX = 0.0f; ! protected float propRotY = 0.0f; ! protected float propRotZ = 0.0f; protected Fixed fixedLayout; + protected Gtk.Window window; + protected VScale scaleRotX; public GtkFrame() { *************** *** 24,32 **** Debug.WriteLine( "Init Window" ); ! Gtk.Window window = new Gtk.Window( "Gtk Frame" ); window.ReallocateRedraws = true; window.DeleteEvent += new DeleteEventHandler( OnDeleteEvent ); window.Resize( 640, 480 ); Debug.WriteLine( "Init GtkGLArea" ); glarea = new GtkGLArea(); --- 26,35 ---- Debug.WriteLine( "Init Window" ); ! window = new Gtk.Window( "Gtk Frame" ); window.ReallocateRedraws = true; window.DeleteEvent += new DeleteEventHandler( OnDeleteEvent ); window.Resize( 640, 480 ); + Debug.WriteLine( "Init GtkGLArea" ); glarea = new GtkGLArea(); *************** *** 36,50 **** glarea.MapEvent += new MapEventHandler (OnMap); glarea.UnmapEvent += new UnmapEventHandler (OnUnmap); ! fixedLayout = new Fixed(); fixedLayout.Put( glarea, 50, 50 ); glarea.HeightRequest = 200; glarea.WidthRequest = 200; ! fixedLayout.Show(); window.Add( fixedLayout ); ! ! glarea.Show (); ! window.ShowAll (); Debug.WriteLine( "MainLoop" ); --- 39,52 ---- glarea.MapEvent += new MapEventHandler (OnMap); glarea.UnmapEvent += new UnmapEventHandler (OnUnmap); ! fixedLayout = new Fixed(); fixedLayout.Put( glarea, 50, 50 ); + //fixedLayout.SizeAllocated += new SizeAllocatedHandler( OnResize ); glarea.HeightRequest = 200; glarea.WidthRequest = 200; ! fixedLayout.Show(); window.Add( fixedLayout ); ! window.ShowAll(); Debug.WriteLine( "MainLoop" ); *************** *** 55,58 **** --- 57,71 ---- } + protected void OnResize( object obj, SizeAllocatedArgs args ) { + resize( glarea, args.Allocation.Height - 150, args.Allocation.Width - 150 ); + } + + protected void resize( Widget wdg, int h, int w ) { + if (wdg!=null) { + if ( (h>0) && (wdg.HeightRequest!=h) ) wdg.HeightRequest = h; + if ( (w>0) && (wdg.WidthRequest!=w) ) wdg.WidthRequest = w; + } + } + protected void OnDeleteEvent (object obj, DeleteEventArgs args) { Application.Quit (); *************** *** 143,147 **** --- 156,187 ---- } } + + protected float rotX { + get { return rotX; } + set { propRotX = value; + while (propRotX<0) propRotX += 360.0f; + while (propRotX>=360.0f) propRotX -= 360.0f; + if (glarea!=null) glarea.QueueDraw(); + } + } + + protected float rotY { + get { return rotY; } + set { propRotY = value; + while (propRotY<0) propRotY += 360.0f; + while (propRotY>=360.0f) propRotY -= 360.0f; + if (glarea!=null) glarea.QueueDraw(); + } + } + protected float rotZ { + get { return rotZ; } + set { propRotZ = value; + while (propRotZ<0) propRotZ += 360.0f; + while (propRotZ>=360.0f) propRotZ -= 360.0f; + if (glarea!=null) glarea.QueueDraw(); + } + } + public static void Main( string[] args) { Debug.Listeners.Add( new TextWriterTraceListener( Console.Out ) ); |