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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: CastleWindowModes: Class TGLMode</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<a name="TGLMode"></a><h1 class="cio">Class TGLMode</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></td><td>Fields</td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td><a class="section" href="#PasDoc-Properties">Properties</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a href="CastleWindowModes.html">CastleWindowModes</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TGLMode = class(TObject)</code></p>
<h2 class="description">Description</h2>
<p>
Enter / exit modal state on a <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a>. Saves/restores the state of <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a>.</p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TObject</li>
<li class="thisitem">TGLMode</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Methods"></a><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a href="CastleWindowModes.TGLMode.html#Create">Create</a></b>(AWindow: <a href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a>);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a href="CastleWindowModes.TGLMode.html#CreateReset">CreateReset</a></b>(AWindow: <a href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a>; NewRender, NewResize, NewCloseQuery: <a href="CastleUIControls.html#TContainerEvent">TContainerEvent</a>);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>destructor <b><a href="CastleWindowModes.TGLMode.html#Destroy">Destroy</a></b>; override;</code></td>
</tr>
</table>
<a name="PasDoc-Properties"></a><h3 class="summary">Properties</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a></b>: boolean
read FFakeMouseDown write FFakeMouseDown default false;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>(AWindow: <a href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Constructor saves open <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> and OpenGL state. Destructor will restore them.
<p>Some gory details (that you will usually not care about... the point is: everything works sensibly of the box) :
<p></p>
<ul class="paragraph_spacing">
<li><p>We save/restore window state.</p></li>
<li><p>OpenGL context connected to this window is also made current during constructor and destructor. Also, <a class="normal" href="CastleWindow.TCastleWindowCustom.html#Invalidate">TCastleWindowCustom.Invalidate</a> is called (since new callbacks, as well as original callbacks, probably want to redraw window contents.)</p></li>
<li><p> All pressed keys and mouse butons are saved and faked to be released, by calling TCastleWindowCustom.EventRelease with original callbacks. This way, if user releases some keys/mouse inside modal box, your original <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> callbacks will not miss this fact. This way e.g. user scripts in VRML/X3D worlds that observe keys work fine.
<p>If <a class="normal" href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a> then at destruction (after restoring original callbacks) we will also notify your original callbacks that user pressed these buttons (by sending TCastleWindowCustom.EventMouseDown). Note that <a class="normal" href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a> feature turned out to be usually more troublesome than usefull — too often some unwanted MouseDown event was caused by this mechanism. That's because if original callbacks do something in MouseDown (like e.g. activate some click) then you don't want to generate fake MouseDown by <a class="normal" href="CastleWindowModes.TGLMode.html#Destroy">TGLMode.Destroy</a>. So the default value of <a class="normal" href="CastleWindowModes.TGLMode.html#FakeMouseDown">FakeMouseDown</a> is <code>False</code>. But this means that original callbacks have to be careful and <i>never assume</i> that when some button is pressed (because it's included in MousePressed, or has EventRelease generated for it) then for sure there occurred some MouseDown for it. </p></li>
<li><p>At destructor, we notify original callbacks about size changes by sending TCastleWindowCustom.EventResize. This way your original callbacks know about size changes, and can set OpenGL projection etc.</p></li>
<li><p> We call ZeroNextSecondsPassed at the end, when closing our mode, see <a class="normal" href="CastleTimeUtils.TFramesPerSecond.html#ZeroNextSecondsPassed">TFramesPerSecond.ZeroNextSecondsPassed</a> for comments why this is needed.</p></li>
<li><p>This also performs important optimization to avoid closing / reinitializing window <a class="normal" href="CastleWindow.TCastleWindowCustom.html#Controls">TCastleWindowCustom.Controls</a> OpenGL resources, see <a class="normal" href="CastleUIControls.TUIControl.html#DisableContextOpenClose">TUIControl.DisableContextOpenClose</a>.</p></li>
</ul>
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="CreateReset"></a><code>constructor <b>CreateReset</b>(AWindow: <a href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a>; NewRender, NewResize, NewCloseQuery: <a href="CastleUIControls.html#TContainerEvent">TContainerEvent</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Save <a class="normal" href="CastleWindow.TCastleWindowCustom.html">TCastleWindowCustom</a> state, and then change it to a standard state. Destructor will restore saved state.
<p>For most properties, we simply reset them to some sensible default values. For some important properties, we take their value explicitly by parameter.
<p>Window properties resetted:
<p></p>
<ul class="paragraph_spacing">
<li><p>All callbacks (OnXxx) are set to <code>Nil</code>.
<p>Except the open/close callbacks (OnOpen and OnClose, OnOpenObject and OnCloseObject). Actually, OnOpenObject and OnCloseObject are changed for internal purposes, but, assuming you use SetStandardState, the orignal ones will still happen. Global <a class="normal" href="CastleUIControls.html#OnGLContextOpen">CastleUIControls.OnGLContextOpen</a>, <a class="normal" href="CastleUIControls.html#OnGLContextClose">CastleUIControls.OnGLContextClose</a> are also untouched.
<p></p>
<ul class="paragraph_spacing">
<li><p>On standalone, we can expect that the window (and OpenGL context) will stay open during the lifetime of a single <a class="normal" href="CastleWindowModes.TGLMode.html">TGLMode</a>. So it doesn't really matter what we do with callbacks OnOpen / OnClose.</p></li>
<li><p>On mobiles (Android) this is not necessarily true. Window may get closed at any time. So be extra careful when implementing OnOpen / OnClose callbacks, remember that they may happen when we're inside a mode (for example inside a modal message in <a class="normal" href="CastleMessages.html">CastleMessages</a> or a progress bar).</p></li>
</ul>
<p> </p></li>
<li><p><a class="normal" href="CastleWindow.TCastleWindowCustom.html#Caption">TCastleWindowCustom.Caption</a> and <a class="normal" href="CastleWindow.TCastleWindowCustom.html#MainMenu">TCastleWindowCustom.MainMenu</a> are left as they were.</p></li>
<li><p><a class="normal" href="CastleWindow.TCastleWindowCustom.html#Cursor">TCastleWindowCustom.Cursor</a> is reset to mcDefault.</p></li>
<li><p><a class="normal" href="CastleWindow.TCastleWindowCustom.html#UserData">TCastleWindowCustom.UserData</a> is reset to <code>Nil</code>.</p></li>
<li><p><a class="normal" href="CastleWindow.TCastleWindowCustom.html#AutoRedisplay">TCastleWindowCustom.AutoRedisplay</a> is reset to <code>False</code>.</p></li>
<li><p><a class="normal" href="CastleWindow.TCastleWindowCustom.html#RenderStyle">TCastleWindowCustom.RenderStyle</a> is reset to rs2D.</p></li>
<li><p>TCastleWindowCustom.MainMenu.Enabled will be reset to <code>False</code> (only if MainMenu <> nil).</p></li>
<li><p>TCastleWindowDemo.SwapFullScreen_Key will be reset to K_None.</p></li>
<li><p>TCastleWindowDemo.Close_charkey will be reset to #0.</p></li>
<li><p>TCastleWindowDemo.FpsShowOnCaption will be reset to false.</p></li>
<li><p>Existing <a class="normal" href="CastleWindow.TCastleWindowCustom.html#Controls">TCastleWindowCustom.Controls</a> are set to non-existing. That is, their <a class="normal" href="CastleUIControls.TUIControl.html#Exists">TUIControl.Exists</a> is adjusted.</p></li>
</ul>
<p>
<p>If you're looking for a suitable callback to pass as NewCloseQuery (new <a class="normal" href="CastleWindow.TCastleWindowCustom.html#OnCloseQuery">TCastleWindowCustom.OnCloseQuery</a>), @<a class="normal" href="CastleWindowModes.html#NoClose">NoClose</a> may be suitable: it's an empty callback, thus using it disables the possibility to close the window by window manager (usually using "close" button in some window corner or Alt+F4).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Destroy"></a><code>destructor <b>Destroy</b>; override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<h3 class="detail">Properties</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="FakeMouseDown"></a><code>property <b>FakeMouseDown</b>: boolean
read FFakeMouseDown write FFakeMouseDown default false;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:13</em>
</span>
</td></tr></table></body></html>
|