forked from andykorth/opentk
/
GameViewBase.cs
1157 lines (1080 loc) · 34.7 KB
/
GameViewBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#region --- License ---
/* Licensed under the MIT/X11 license.
* Copyright (c) 2011 Xamarin Inc.
* Copyright 2013 Xamarin Inc
* This notice may not be removed from any source distribution.
* See license.txt for licensing detailed licensing details.
*/
#endregion
using System;
using System.ComponentModel;
using System.Drawing;
using System.Timers;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Platform;
using OpenTK.Platform.Android;
using Android.Content;
using Android.Util;
using Android.Views;
using Android.Runtime;
using Java.Util;
using All = OpenTK.Graphics.ES11.All;
using ES11 = OpenTK.Graphics.ES11;
using ES20 = OpenTK.Graphics.ES20;
namespace OpenTK
{
#if OPENTK_0
[Register ("opentk/GameViewBase")]
#elif OPENTK_1
[Register ("opentk_1_0/GameViewBase")]
#elif OPENTK_1_1
[Register ("opentk_1_1/GameViewBase")]
#endif
public abstract class GameViewBase : SurfaceView, IGameWindow
{
[Register (".ctor", "(Landroid/content/Context;)V", "")]
public GameViewBase (Context context) : base (context)
{
}
[Register (".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "")]
public GameViewBase (Context context, IAttributeSet attrs) : base (context, attrs)
{
}
public GameViewBase (IntPtr handle, global::Android.Runtime.JniHandleOwnership transfer)
: base (handle, transfer)
{
}
/// <summary>
/// Gets the <see cref="T:OpenTK.Graphics.IGraphicsContext" /> instance
/// bound to this
/// <see cref="T:OpenTK.Platform.Android.AndroidGameView" /> instance.
/// </summary>
/// <value>
/// A <see cref="T:OpenTK.Graphics.IGraphicsContext" /> instance bound
/// to this <see cref="T:OpenTK.Platform.Android.AndroidGameView" />
/// instance.
/// </value>
IGraphicsContext ctx;
public IGraphicsContext GraphicsContext {
get {
return ctx;
}
set {
ctx = value;
OnContextSet (null);
}
}
/// <summary>
/// Controls whether the graphics context is recreated when the display
/// size changes.
/// </summary>
/// <remarks>
/// </remarks>
public bool AutoResize { get; set; }
protected virtual void CreateFrameBuffer ()
{
}
Point INativeWindow.PointToClient (Point point)
{
return point;
}
Point INativeWindow.PointToScreen (Point point)
{
return point;
}
#region IGameWindow implementation
/// <summary>
/// Occurs before the run loop starts.
/// </summary>
/// <remarks>
/// <para>
/// When using the run-loop processing architecture, events happen in
/// the following order:
/// </para>
/// <list type="number">
/// <item>
/// <term>
/// <c>Load</c>
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// </term>
/// </item>
/// </list>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run" /> and
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run(System.Double)" />,
/// invoke
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// before starting the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop which is invoked for every rendered frame.
/// </para>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Stop" />
/// ends the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop processing, then invokes the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// event.
/// </para>
/// </remarks>
public event EventHandler<EventArgs> Load;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// event.
/// </summary>
protected virtual void OnLoad (EventArgs e)
{
if (Load != null)
Load (this, e);
}
/// <summary>
/// Occurs when the run-loop is terminated.
/// </summary>
/// <remarks>
/// <para>
/// When using the run-loop processing architecture, events happen in
/// the following order:
/// </para>
/// <list type="number">
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <c>Unload</c>
/// </term>
/// </item>
/// </list>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run" /> and
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run(System.Double)" />,
/// invoke
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// before starting the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop which is invoked for every rendered frame.
/// </para>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Stop" />
/// ends the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop processing, then invokes the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// event.
/// </para>
/// </remarks>
public event EventHandler<EventArgs> Unload;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnUnload</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnUnload</c> in a derived class, be sure to
/// call the base class's <c>OnUnload</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnUnload (EventArgs e)
{
if (Unload != null)
Unload (this, e);
}
/// <summary>
/// Occurs part of run-loop processing when a frame should be updated prior to rendering.
/// </summary>
/// <remarks>
/// <para>
/// When using the run-loop processing architecture, events happen in
/// the following order:
/// </para>
/// <list type="number">
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <c>UpdateFrame</c>
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// </term>
/// </item>
/// </list>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run" /> and
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run(System.Double)" />,
/// invoke
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// before starting the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop which is invoked for every rendered frame.
/// </para>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Stop" />
/// ends the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop processing, then invokes the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// event.
/// </para>
/// </remarks>
public event EventHandler<FrameEventArgs> UpdateFrame;
/// <param name="e">
/// An <see cref="T:OpenTK.FrameEventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnUpdateFrame</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnUpdateFrame</c> in a derived class, be sure to
/// call the base class's <c>OnUpdateFrame</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnUpdateFrame (FrameEventArgs e)
{
if (UpdateFrame != null)
UpdateFrame (this, e);
}
/// <summary>
/// Occurs part of run-loop processing when a frame should be rendered.
/// </summary>
/// <remarks>
/// <para>
/// When using the run-loop processing architecture, events happen in
/// the following order:
/// </para>
/// <list type="number">
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />
/// </term>
/// </item>
/// <item>
/// <term>
/// <c>RenderFrame</c>
/// </term>
/// </item>
/// <item>
/// <term>
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// </term>
/// </item>
/// </list>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run" /> and
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Run(System.Double)" />,
/// invoke
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Load" />
/// before starting the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop which is invoked for every rendered frame.
/// </para>
/// <para>
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Stop" />
/// ends the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />/<see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// loop processing, then invokes the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Unload" />
/// event.
/// </para>
/// </remarks>
public event EventHandler<FrameEventArgs> RenderFrame;
/// <param name="e">
/// An <see cref="T:OpenTK.FrameEventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnRenderFrame</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnRenderFrame</c> in a derived class, be sure to
/// call the base class's <c>OnRenderFrame</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnRenderFrame (FrameEventArgs e)
{
if (RenderFrame != null)
RenderFrame (this, e);
}
/// <summary>
/// Starts as-fast-as-possible run-loop processing.
/// </summary>
/// <remarks>
/// <para>
/// In this <c>Run</c> overload, there is no delay between raising of the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.RenderFrame" />
/// event and the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.UpdateFrame" />
/// of the following frame; everything is executed as quickly as
/// possible. This may not be desirable.
/// </para>
/// </remarks>
/// <exception cref="T:System.ObjectDisposedException">
/// The instance has had
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Dispose" />
/// invoked on it.
/// </exception>
public abstract void Run ();
/// <param name="updateRate">
/// A <see cref="T:System.Double" /> containing the number of frames per
/// second that should be updated and rendered.
/// </param>
/// <summary>
/// Starts run-loop processing at a rate of <paramref name="updateRate" />
/// frames per second.
/// </summary>
/// <exception cref="T:System.ObjectDisposedException">
/// The instance has had
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Dispose" />
/// invoked on it.
/// </exception>
public abstract void Run (double updateRate);
/// <summary>
/// Makes the
/// <see cref="P:OpenTK.Platform.Android.AndroidGameView.GraphicsContext" />
/// current on the calling thread.
/// </summary>
/// <remarks>
/// <para>
/// This method is equivalent to calling:
/// <c>GraphicsContext.MakeCurrent(WindowInfo)</c>.
/// </para>
/// </remarks>
/// <exception cref="T:System.ObjectDisposedException">
/// The instance has had
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Dispose" />
/// invoked on it.
/// </exception>
public abstract void MakeCurrent ();
/// <summary>
/// Swaps the front and back buffers of the current GraphicsContext,
/// presenting the rendered scene to the user.
/// </summary>
/// <remarks>
/// <para>
/// This method rebinds
/// <see cref="P:OpenTK.Platform.Android.AndroidGameView.Renderbuffer" />
/// to the OpenGL context's <c>RenderbufferOes</c> property, then
/// invokes <see cref="M:OpenTK.Graphics.IGraphicsContext.SwapBuffers" />.
/// </para>
/// </remarks>
/// <exception cref="T:System.ObjectDisposedException">
/// The instance has had
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Dispose" />
/// invoked on it.
/// </exception>
public abstract void SwapBuffers ();
#endregion
#region INativeWindow implementation
/// <summary>This member is not supported.</summary>
/// <value>To be added.</value>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public event EventHandler<EventArgs> Move;
/// <summary>
/// Occurs when the view's
/// <see cref="P:OpenTK.Platform.Android.AndroidGameView.Size" />
/// changes.
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> Resize;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Resize" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnResize</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnResize</c> in a derived class, be sure to
/// call the base class's <c>OnResize</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnResize (EventArgs e)
{
if (Resize != null)
Resize (this, e);
}
/// <summary>This member is not supported.</summary>
/// <value>To be added.</value>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public event EventHandler<CancelEventArgs> Closing;
/// <summary>
/// Occurs when the view has been closed.
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> Closed;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Closed" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnClosed</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnClosed</c> in a derived class, be sure to
/// call the base class's <c>OnClosed</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnClosed (EventArgs e)
{
if (Closed != null)
Closed (this, e);
}
/// <summary>
/// Occurs when the view is disposed
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> Disposed;
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.Disposed" />
/// event.
/// </summary>
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <remarks>
/// <para>
/// The <c>OnDisposed</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnDisposed</c> in a derived class, be sure to
/// call the base class's <c>OnDisposed</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnDisposed (EventArgs e)
{
if (Disposed != null)
Disposed (this, e);
}
/// <summary>
/// Occurs when the
/// <see cref="T:OpenTK.Platform.Android.AndroidGameView" />
/// detects that the <see cref="P:OpenTK.Platform.Android.AndroidGameView.GraphicsContext"> was lost.
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> ContextLost;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.ContextLost" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnContextLost</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnContextLost</c> in a derived class, be sure to
/// call the base class's <c>OnContextLost</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnContextLost (EventArgs e)
{
if (ContextLost != null)
ContextLost (this, e);
}
/// <summary>
/// Occurs when the
/// <see cref="P:OpenTK.Platform.Android.AndroidGameView.GraphicsContext" />
/// is created.
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> ContextSet;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.ContextSet" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnContextSet</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnContextSet</c> in a derived class, be sure to
/// call the base class's <c>OnContextSet</c> method so that registered
/// delegates receive the event.
/// </block>
/// <block>
/// It is convenient place to create context related data, ie. load textures.
/// </block>
/// </remarks>
protected virtual void OnContextSet (EventArgs e)
{
MakeCurrent ();
if (ContextSet != null)
ContextSet (this, e);
}
/// <summary>
/// Occurs when the value of
/// <see cref="P:OpenTK.Platform.Android.AndroidGameView.Title" />
/// changes.
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> TitleChanged;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.TitleChanged" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnTitleChanged</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnTitleChanged</c> in a derived class, be sure to
/// call the base class's <c>OnTitleChanged</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnTitleChanged (EventArgs e)
{
if (TitleChanged != null)
TitleChanged (this, EventArgs.Empty);
}
/// <summary>
/// Occurs when the value of
/// <see cref="P:OpenTK.Platform.Android.AndroidGameView.Visible" />
/// changes.
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> VisibleChanged;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.VisibleChanged" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnVisibleChanged</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnVisibleChanged</c> in a derived class, be sure to
/// call the base class's <c>OnVisibleChanged</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnVisibleChanged (EventArgs e)
{
if (VisibleChanged != null)
VisibleChanged (this, EventArgs.Empty);
}
/// <summary>This member is not supported.</summary>
/// <value>To be added.</value>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public event EventHandler<EventArgs> FocusedChanged;
/// <summary>This member is not supported.</summary>
/// <value>To be added.</value>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public event EventHandler<EventArgs> WindowBorderChanged;
/// <summary>
/// Occurs when the value of
/// <see cref="P:OpenTK.Platform.Android.AndroidGameView.WindowState" />
/// changes.
/// </summary>
/// <remarks>
/// </remarks>
public event EventHandler<EventArgs> WindowStateChanged;
/// <param name="e">
/// An <see cref="T:System.EventArgs" /> that contains the event data.
/// </param>
/// <summary>
/// Raises the
/// <see cref="E:OpenTK.Platform.Android.AndroidGameView.WindowStateChanged" />
/// event.
/// </summary>
/// <remarks>
/// <para>
/// The <c>OnWindowStateChanged</c> method also allows derived classes to handle
/// the event without attaching a delegate. This is the preferred
/// technique for handling the event in a derived class.
/// </para>
/// <block subset="none" type="overrides">
/// When overriding <c>OnWindowStateChanged</c> in a derived class, be sure to
/// call the base class's <c>OnWindowStateChanged</c> method so that registered
/// delegates receive the event.
/// </block>
/// </remarks>
protected virtual void OnWindowStateChanged (EventArgs e)
{
if (WindowStateChanged != null)
WindowStateChanged (this, EventArgs.Empty);
}
/// <summary>
/// Invokes the
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.OnClosed(System.EventArgs)" />
/// event.
/// </summary>
/// <remarks>
/// This method only invokes the
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.OnClosed(System.EventArgs)" />
/// method.
/// </remarks>
/// <exception cref="T:System.ObjectDisposedException">
/// The instance has had
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Dispose" />
/// invoked on it.
/// </exception>
public virtual void Close ()
{
OnClosed (EventArgs.Empty);
}
/// <summary>This member is not supported.</summary>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
event EventHandler<KeyPressEventArgs> INativeWindow.KeyPress {
add { throw new NotSupportedException ();}
remove { throw new NotSupportedException ();}
}
public virtual int Width {
get; set;
}
public virtual int Height {
get;
set;
}
/// <summary>This member is not supported.</summary>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public event EventHandler<EventArgs> MouseEnter {
add { throw new NotSupportedException (); }
remove { throw new NotSupportedException (); }
}
/// <summary>This member is not supported.</summary>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public event EventHandler<EventArgs> MouseLeave {
add { throw new NotSupportedException (); }
remove { throw new NotSupportedException (); }
}
/// <summary>This member is not supported.</summary>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public void ProcessEvents ()
{
throw new NotImplementedException ();
}
public Point PointToClient (Point point)
{
throw new NotImplementedException ();
}
public Point PointToScreen (Point point)
{
throw new NotImplementedException ();
}
public string Title {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
/// <summary>This member is not supported.</summary>
/// <value>To be added.</value>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotSupportedException" />.
/// </para>
/// </remarks>
public bool Focused {
get {
throw new NotSupportedException ();
}
}
/// <summary>
/// Gets or sets a value specifying whether the view is visible.
/// </summary>
/// <value>
/// A <see cref="T:System.Boolean" /> specifying whether the view is
/// visible.
/// </value>
/// <remarks>
/// </remarks>
/// <exception cref="T:System.ObjectDisposedException">
/// The instance has had
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Dispose" />
/// invoked on it.
/// </exception>
public bool Visible {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
/// <summary>This member is not supported.</summary>
/// <value>To be added.</value>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotImplementedException" />.
/// </para>
/// </remarks>
public bool Exists {
get {
throw new NotImplementedException ();
}
}
/// <summary>
/// Gets information about the containing window.
/// </summary>
/// <value>
/// A <see cref="T:OpenTK.Platform.IWindowInfo" /> which provides
/// information about the containing window.
/// </value>
/// <exception cref="T:System.ObjectDisposedException">
/// The instance has had
/// <see cref="M:OpenTK.Platform.Android.AndroidGameView.Dispose" />
/// invoked on it.
/// </exception>
public virtual IWindowInfo WindowInfo {
get {
throw new NotImplementedException ();
}
}
/// <summary>
/// Gets or states the state of the view.
/// </summary>
/// <value>
/// A <see cref="T:OpenTK.WindowState" /> value specifying the state of
/// the window.
/// </value>
/// <remarks>
/// <para>
/// <see cref="F:OpenTK.WindowState.Normal" /> is always returned.
/// </para>
/// </remarks>
/// <exception cref="T:System.NotImplementedException">
/// </exception>
public virtual WindowState WindowState {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
/// <summary>
/// Always returns <see cref="F:OpenTK.WindowBorder.Hidden" />.
/// </summary>
/// <value>
/// A <see cref="T:OpenTK.WindowBorder" /> value controlling the border
/// of the view.
/// </value>
/// <remarks>
/// <para>
/// Always returns <see cref="F:OpenTK.WindowBorder.Hidden" />.
/// </para>
/// <para>
/// The setter is ignored.
/// </para>
/// </remarks>
/// <exception cref="T:System.NotImplementedException">
/// </exception>
public virtual WindowBorder WindowBorder {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
/// <summary>This member is not supported.</summary>
/// <value>To be added.</value>
/// <remarks>
/// <para>
/// Throws a <see cref="T:System.NotImplementedException" />.
/// </para>
/// </remarks>
public virtual Rectangle Bounds {