You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
330 lines
57 KiB
330 lines
57 KiB
3 years ago
|
<html>
|
||
|
<head>
|
||
|
<title>owned_event.rs</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<style type="text/css">
|
||
|
.s0 { color: #ed864a;}
|
||
|
.s1 { color: #ebebeb;}
|
||
|
.s2 { color: #ffffff;}
|
||
|
.s3 { color: #ed864a; font-weight: bold;}
|
||
|
.s4 { color: #499936; font-style: italic;}
|
||
|
.s5 { color: #20999d; font-style: italic;}
|
||
|
.s6 { color: #54b33e;}
|
||
|
.s7 { color: #33ccff; font-weight: bold;}
|
||
|
.s8 { color: #7ec3e6;}
|
||
|
.ln { color: #999999; font-weight: normal; font-style: normal; }
|
||
|
</style>
|
||
|
</head>
|
||
|
<body bgcolor="#131314">
|
||
|
<table CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="100%" BGCOLOR="#606060" >
|
||
|
<tr><td><center>
|
||
|
<font face="Arial, Helvetica" color="#000000">
|
||
|
owned_event.rs</font>
|
||
|
</center></td></tr></table>
|
||
|
<pre><a name="l1"><span class="ln">1 </span></a><span class="s0">use </span><span class="s2">std</span><span class="s1">::</span><span class="s2">path</span><span class="s1">::</span><span class="s2">PathBuf</span><span class="s3">;</span>
|
||
|
<a name="l2"><span class="ln">2 </span></a>
|
||
|
<a name="l3"><span class="ln">3 </span></a><span class="s0">use </span><span class="s2">gilrs</span><span class="s1">::</span><span class="s2">Event </span><span class="s0">as </span><span class="s2">GilEvent</span><span class="s3">;</span>
|
||
|
<a name="l4"><span class="ln">4 </span></a><span class="s0">use </span><span class="s2">legion</span><span class="s1">::</span><span class="s2">world</span><span class="s1">::</span><span class="s2">SubWorld</span><span class="s3">;</span>
|
||
|
<a name="l5"><span class="ln">5 </span></a><span class="s0">use </span><span class="s2">legion</span><span class="s1">::*</span><span class="s3">;</span>
|
||
|
<a name="l6"><span class="ln">6 </span></a><span class="s0">use </span><span class="s2">winit_24</span><span class="s1">::</span><span class="s2">dpi</span><span class="s1">::{</span><span class="s2">PhysicalPosition</span><span class="s3">, </span><span class="s2">PhysicalSize</span><span class="s3">, </span><span class="s2">LogicalPosition</span><span class="s1">}</span><span class="s3">;</span>
|
||
|
<a name="l7"><span class="ln">7 </span></a><span class="s0">use </span><span class="s2">winit_24</span><span class="s1">::</span><span class="s2">event</span><span class="s1">::</span><span class="s2">DeviceEvent</span><span class="s1">::</span><span class="s2">MouseMotion</span><span class="s3">;</span>
|
||
|
<a name="l8"><span class="ln">8 </span></a><span class="s0">use </span><span class="s2">winit_24</span><span class="s1">::</span><span class="s2">event</span><span class="s1">::{</span><span class="s2">AxisId</span><span class="s3">, </span><span class="s2">DeviceEvent</span><span class="s3">, </span><span class="s2">DeviceId</span><span class="s3">, </span><span class="s2">ElementState</span><span class="s3">, </span><span class="s2">Event</span><span class="s3">, </span><span class="s2">KeyboardInput</span><span class="s3">, </span><span class="s2">ModifiersState</span><span class="s3">, </span><span class="s2">MouseButton</span><span class="s3">, </span><span class="s2">MouseScrollDelta</span><span class="s3">, </span><span class="s2">StartCause</span><span class="s3">, </span><span class="s2">Touch</span><span class="s3">, </span><span class="s2">TouchPhase</span><span class="s3">, </span><span class="s2">WindowEvent</span><span class="s3">, </span><span class="s2">VirtualKeyCode</span><span class="s1">}</span><span class="s3">;</span>
|
||
|
<a name="l9"><span class="ln">9 </span></a><span class="s0">use </span><span class="s2">winit_24</span><span class="s1">::</span><span class="s2">window</span><span class="s1">::{</span><span class="s2">Theme</span><span class="s3">, </span><span class="s2">WindowId</span><span class="s3">, </span><span class="s2">Window</span><span class="s1">}</span><span class="s3">;</span>
|
||
|
<a name="l10"><span class="ln">10 </span></a>
|
||
|
<a name="l11"><span class="ln">11 </span></a><span class="s0">use crate</span><span class="s1">::</span><span class="s2">camera</span><span class="s1">::{</span><span class="s2">Camera</span><span class="s3">, </span><span class="s2">CameraController</span><span class="s1">}</span><span class="s3">;</span>
|
||
|
<a name="l12"><span class="ln">12 </span></a><span class="s0">use crate</span><span class="s1">::</span><span class="s2">owned_event</span><span class="s1">::</span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">MouseWheel</span><span class="s3">;</span>
|
||
|
<a name="l13"><span class="ln">13 </span></a><span class="s0">use </span><span class="s2">std</span><span class="s1">::</span><span class="s2">sync</span><span class="s1">::{</span><span class="s2">Mutex</span><span class="s3">, </span><span class="s2">Arc</span><span class="s1">}</span><span class="s3">;</span>
|
||
|
<a name="l14"><span class="ln">14 </span></a><span class="s0">use </span><span class="s2">std</span><span class="s1">::</span><span class="s2">cmp</span><span class="s1">::</span><span class="s2">Ordering</span><span class="s3">;</span>
|
||
|
<a name="l15"><span class="ln">15 </span></a><span class="s0">use </span><span class="s2">imgui</span><span class="s1">::</span><span class="s2">Io</span><span class="s3">;</span>
|
||
|
<a name="l16"><span class="ln">16 </span></a><span class="s0">use crate</span><span class="s1">::</span><span class="s2">imgui_supp</span><span class="s1">::</span><span class="s2">imgui_support</span><span class="s1">::{</span><span class="s2">ImguiContext</span><span class="s3">, </span><span class="s2">ImguiPlatform</span><span class="s1">}</span><span class="s3">;</span>
|
||
|
<a name="l17"><span class="ln">17 </span></a>
|
||
|
<a name="l18"><span class="ln">18 </span></a><span class="s1">#[</span><span class="s2">derive</span><span class="s1">(</span><span class="s2">Clone</span><span class="s1">)]</span>
|
||
|
<a name="l19"><span class="ln">19 </span></a><span class="s0">pub enum </span><span class="s2">OwnedUIEvent</span><span class="s1"><</span><span class="s2">T</span><span class="s1">> {</span>
|
||
|
<a name="l20"><span class="ln">20 </span></a> <span class="s2">UIEvent</span><span class="s1">(</span><span class="s2">T</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l21"><span class="ln">21 </span></a><span class="s1">}</span>
|
||
|
<a name="l22"><span class="ln">22 </span></a>
|
||
|
<a name="l23"><span class="ln">23 </span></a><span class="s1">#[</span><span class="s2">derive</span><span class="s1">(</span><span class="s2">Clone</span><span class="s1">)]</span>
|
||
|
<a name="l24"><span class="ln">24 </span></a><span class="s0">pub enum </span><span class="s2">OwnedEventExtension </span><span class="s1">{</span>
|
||
|
<a name="l25"><span class="ln">25 </span></a> <span class="s4">/// Custom events here</span>
|
||
|
<a name="l26"><span class="ln">26 </span></a> <span class="s2">MouseHeldEvent </span><span class="s1">{}</span><span class="s3">,</span>
|
||
|
<a name="l27"><span class="ln">27 </span></a> <span class="s2">KeyHeldEvent </span><span class="s1">{}</span><span class="s3">,</span>
|
||
|
<a name="l28"><span class="ln">28 </span></a> <span class="s2">GamepadEvent </span><span class="s1">{</span>
|
||
|
<a name="l29"><span class="ln">29 </span></a> <span class="s2">gil_event</span><span class="s1">: </span><span class="s2">GilEvent</span><span class="s3">,</span>
|
||
|
<a name="l30"><span class="ln">30 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l31"><span class="ln">31 </span></a><span class="s1">}</span>
|
||
|
<a name="l32"><span class="ln">32 </span></a>
|
||
|
<a name="l33"><span class="ln">33 </span></a><span class="s1">#[</span><span class="s2">derive</span><span class="s1">(</span><span class="s2">Clone</span><span class="s3">, </span><span class="s2">Debug</span><span class="s1">)]</span>
|
||
|
<a name="l34"><span class="ln">34 </span></a><span class="s0">pub enum </span><span class="s2">OwnedEvent</span><span class="s1"><</span><span class="s2">T</span><span class="s1">> {</span>
|
||
|
<a name="l35"><span class="ln">35 </span></a> <span class="s4">/// Custom events here</span>
|
||
|
<a name="l36"><span class="ln">36 </span></a> <span class="s2">MouseHeldEvent </span><span class="s1">{}</span><span class="s3">,</span>
|
||
|
<a name="l37"><span class="ln">37 </span></a> <span class="s2">KeyHeldEvent </span><span class="s1">{}</span><span class="s3">,</span>
|
||
|
<a name="l38"><span class="ln">38 </span></a> <span class="s2">GamepadEvent </span><span class="s1">{</span>
|
||
|
<a name="l39"><span class="ln">39 </span></a> <span class="s2">gil_event</span><span class="s1">: </span><span class="s2">GilEvent</span><span class="s3">,</span>
|
||
|
<a name="l40"><span class="ln">40 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l41"><span class="ln">41 </span></a>
|
||
|
<a name="l42"><span class="ln">42 </span></a> <span class="s4">/// Winit events here</span>
|
||
|
<a name="l43"><span class="ln">43 </span></a> <span class="s2">NewEvents</span><span class="s1">(</span><span class="s2">StartCause</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l44"><span class="ln">44 </span></a> <span class="s2">WindowEvent </span><span class="s1">{</span>
|
||
|
<a name="l45"><span class="ln">45 </span></a> <span class="s2">window_id</span><span class="s1">: </span><span class="s2">WindowId</span><span class="s3">,</span>
|
||
|
<a name="l46"><span class="ln">46 </span></a> <span class="s2">event</span><span class="s1">: </span><span class="s2">OwnedWindowEvent</span><span class="s3">,</span>
|
||
|
<a name="l47"><span class="ln">47 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l48"><span class="ln">48 </span></a> <span class="s2">DeviceEvent </span><span class="s1">{</span>
|
||
|
<a name="l49"><span class="ln">49 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l50"><span class="ln">50 </span></a> <span class="s2">event</span><span class="s1">: </span><span class="s2">DeviceEvent</span><span class="s3">,</span>
|
||
|
<a name="l51"><span class="ln">51 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l52"><span class="ln">52 </span></a> <span class="s2">UserEvent</span><span class="s1">(</span><span class="s2">T</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l53"><span class="ln">53 </span></a> <span class="s2">Suspended</span><span class="s3">,</span>
|
||
|
<a name="l54"><span class="ln">54 </span></a> <span class="s2">Resumed</span><span class="s3">,</span>
|
||
|
<a name="l55"><span class="ln">55 </span></a> <span class="s2">MainEventsCleared</span><span class="s3">,</span>
|
||
|
<a name="l56"><span class="ln">56 </span></a> <span class="s2">RedrawRequested</span><span class="s1">(</span><span class="s2">WindowId</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l57"><span class="ln">57 </span></a> <span class="s2">RedrawEventsCleared</span><span class="s3">,</span>
|
||
|
<a name="l58"><span class="ln">58 </span></a> <span class="s2">LoopDestroyed</span><span class="s3">,</span>
|
||
|
<a name="l59"><span class="ln">59 </span></a><span class="s1">}</span>
|
||
|
<a name="l60"><span class="ln">60 </span></a>
|
||
|
<a name="l61"><span class="ln">61 </span></a><span class="s0">impl</span><span class="s1"><</span><span class="s2">T</span><span class="s1">> </span><span class="s2">From</span><span class="s1"><</span><span class="s2">Event</span><span class="s1"><</span><span class="s5">'_</span><span class="s3">, </span><span class="s2">T</span><span class="s1">>> </span><span class="s0">for </span><span class="s2">OwnedEvent</span><span class="s1"><</span><span class="s2">T</span><span class="s1">> {</span>
|
||
|
<a name="l62"><span class="ln">62 </span></a> <span class="s0">fn </span><span class="s2">from</span><span class="s1">(</span><span class="s2">event</span><span class="s1">: </span><span class="s2">Event</span><span class="s1"><</span><span class="s2">T</span><span class="s1">>) -> </span><span class="s0">Self </span><span class="s1">{</span>
|
||
|
<a name="l63"><span class="ln">63 </span></a> <span class="s0">match </span><span class="s2">event </span><span class="s1">{</span>
|
||
|
<a name="l64"><span class="ln">64 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">NewEvents</span><span class="s1">(</span><span class="s2">cause</span><span class="s1">) => </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">NewEvents</span><span class="s1">(</span><span class="s2">cause</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l65"><span class="ln">65 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">WindowEvent </span><span class="s1">{</span>
|
||
|
<a name="l66"><span class="ln">66 </span></a> <span class="s2">window_id</span><span class="s1">: </span><span class="s2">window_id</span><span class="s3">,</span>
|
||
|
<a name="l67"><span class="ln">67 </span></a> <span class="s2">event</span><span class="s1">: </span><span class="s2">event</span><span class="s3">,</span>
|
||
|
<a name="l68"><span class="ln">68 </span></a> <span class="s1">} => </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">WindowEvent </span><span class="s1">{</span>
|
||
|
<a name="l69"><span class="ln">69 </span></a> <span class="s2">window_id</span><span class="s1">: </span><span class="s2">window_id</span><span class="s3">,</span>
|
||
|
<a name="l70"><span class="ln">70 </span></a> <span class="s2">event</span><span class="s1">: </span><span class="s0">match </span><span class="s2">event </span><span class="s1">{</span>
|
||
|
<a name="l71"><span class="ln">71 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">AxisMotion </span><span class="s1">{</span>
|
||
|
<a name="l72"><span class="ln">72 </span></a> <span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l73"><span class="ln">73 </span></a> <span class="s2">axis</span><span class="s3">,</span>
|
||
|
<a name="l74"><span class="ln">74 </span></a> <span class="s2">value</span><span class="s3">,</span>
|
||
|
<a name="l75"><span class="ln">75 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">AxisMotion </span><span class="s1">{</span>
|
||
|
<a name="l76"><span class="ln">76 </span></a> <span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l77"><span class="ln">77 </span></a> <span class="s2">axis</span><span class="s3">,</span>
|
||
|
<a name="l78"><span class="ln">78 </span></a> <span class="s2">value</span><span class="s3">,</span>
|
||
|
<a name="l79"><span class="ln">79 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l80"><span class="ln">80 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">Resized</span><span class="s1">(</span><span class="s2">physical_size</span><span class="s1">) => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">Resized</span><span class="s1">(</span><span class="s2">physical_size</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l81"><span class="ln">81 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">Moved</span><span class="s1">(</span><span class="s2">physical_position</span><span class="s1">) => {</span>
|
||
|
<a name="l82"><span class="ln">82 </span></a> <span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">Moved</span><span class="s1">(</span><span class="s2">physical_position</span><span class="s1">)</span>
|
||
|
<a name="l83"><span class="ln">83 </span></a> <span class="s1">}</span>
|
||
|
<a name="l84"><span class="ln">84 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">CloseRequested </span><span class="s1">=> </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">CloseRequested</span><span class="s3">,</span>
|
||
|
<a name="l85"><span class="ln">85 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">Destroyed </span><span class="s1">=> </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">Destroyed</span><span class="s3">,</span>
|
||
|
<a name="l86"><span class="ln">86 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">DroppedFile</span><span class="s1">(</span><span class="s2">path_buf</span><span class="s1">) => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">DroppedFile</span><span class="s1">(</span><span class="s2">path_buf</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l87"><span class="ln">87 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">HoveredFile</span><span class="s1">(</span><span class="s2">path_buf</span><span class="s1">) => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">HoveredFile</span><span class="s1">(</span><span class="s2">path_buf</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l88"><span class="ln">88 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">HoveredFileCancelled </span><span class="s1">=> </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">HoveredFileCancelled</span><span class="s3">,</span>
|
||
|
<a name="l89"><span class="ln">89 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">ReceivedCharacter</span><span class="s1">(</span><span class="s2">char</span><span class="s1">) => {</span>
|
||
|
<a name="l90"><span class="ln">90 </span></a> <span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">ReceivedCharacter</span><span class="s1">(</span><span class="s2">char</span><span class="s1">)</span>
|
||
|
<a name="l91"><span class="ln">91 </span></a> <span class="s1">}</span>
|
||
|
<a name="l92"><span class="ln">92 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">Focused</span><span class="s1">(</span><span class="s2">bool</span><span class="s1">) => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">Focused</span><span class="s1">(</span><span class="s2">bool</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l93"><span class="ln">93 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">KeyboardInput </span><span class="s1">{</span>
|
||
|
<a name="l94"><span class="ln">94 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l95"><span class="ln">95 </span></a> <span class="s2">input</span><span class="s1">: </span><span class="s2">input</span><span class="s3">,</span>
|
||
|
<a name="l96"><span class="ln">96 </span></a> <span class="s2">is_synthetic</span><span class="s1">: </span><span class="s2">is_synthetic</span><span class="s3">,</span>
|
||
|
<a name="l97"><span class="ln">97 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">KeyboardInput </span><span class="s1">{</span>
|
||
|
<a name="l98"><span class="ln">98 </span></a> <span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l99"><span class="ln">99 </span></a> <span class="s2">input</span><span class="s3">,</span>
|
||
|
<a name="l100"><span class="ln">100 </span></a> <span class="s2">is_synthetic</span><span class="s3">,</span>
|
||
|
<a name="l101"><span class="ln">101 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l102"><span class="ln">102 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">ModifiersChanged</span><span class="s1">(</span><span class="s2">modifiers_state</span><span class="s1">) => {</span>
|
||
|
<a name="l103"><span class="ln">103 </span></a> <span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">ModifiersChanged</span><span class="s1">(</span><span class="s2">modifiers_state</span><span class="s1">)</span>
|
||
|
<a name="l104"><span class="ln">104 </span></a> <span class="s1">}</span>
|
||
|
<a name="l105"><span class="ln">105 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">CursorMoved </span><span class="s1">{</span>
|
||
|
<a name="l106"><span class="ln">106 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l107"><span class="ln">107 </span></a> <span class="s2">position</span><span class="s1">: </span><span class="s2">position</span><span class="s3">,</span>
|
||
|
<a name="l108"><span class="ln">108 </span></a> <span class="s2">modifiers</span><span class="s1">: </span><span class="s2">modifiers</span><span class="s3">,</span>
|
||
|
<a name="l109"><span class="ln">109 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">CursorMoved </span><span class="s1">{</span>
|
||
|
<a name="l110"><span class="ln">110 </span></a> <span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l111"><span class="ln">111 </span></a> <span class="s2">position</span><span class="s3">,</span>
|
||
|
<a name="l112"><span class="ln">112 </span></a> <span class="s2">modifiers</span><span class="s3">,</span>
|
||
|
<a name="l113"><span class="ln">113 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l114"><span class="ln">114 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">CursorEntered </span><span class="s1">{</span>
|
||
|
<a name="l115"><span class="ln">115 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l116"><span class="ln">116 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">CursorEntered </span><span class="s1">{ </span><span class="s2">device_id </span><span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l117"><span class="ln">117 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">CursorLeft </span><span class="s1">{</span>
|
||
|
<a name="l118"><span class="ln">118 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l119"><span class="ln">119 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">CursorLeft </span><span class="s1">{ </span><span class="s2">device_id </span><span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l120"><span class="ln">120 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">MouseWheel </span><span class="s1">{</span>
|
||
|
<a name="l121"><span class="ln">121 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l122"><span class="ln">122 </span></a> <span class="s2">delta</span><span class="s1">: </span><span class="s2">delta</span><span class="s3">,</span>
|
||
|
<a name="l123"><span class="ln">123 </span></a> <span class="s2">phase</span><span class="s1">: </span><span class="s2">phase</span><span class="s3">,</span>
|
||
|
<a name="l124"><span class="ln">124 </span></a> <span class="s2">modifiers</span><span class="s1">: </span><span class="s2">modifiers</span><span class="s3">,</span>
|
||
|
<a name="l125"><span class="ln">125 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">MouseWheel </span><span class="s1">{</span>
|
||
|
<a name="l126"><span class="ln">126 </span></a> <span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l127"><span class="ln">127 </span></a> <span class="s2">delta</span><span class="s3">,</span>
|
||
|
<a name="l128"><span class="ln">128 </span></a> <span class="s2">phase</span><span class="s3">,</span>
|
||
|
<a name="l129"><span class="ln">129 </span></a> <span class="s2">modifiers</span><span class="s3">,</span>
|
||
|
<a name="l130"><span class="ln">130 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l131"><span class="ln">131 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">MouseInput </span><span class="s1">{</span>
|
||
|
<a name="l132"><span class="ln">132 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l133"><span class="ln">133 </span></a> <span class="s2">state</span><span class="s1">: </span><span class="s2">state</span><span class="s3">,</span>
|
||
|
<a name="l134"><span class="ln">134 </span></a> <span class="s2">button</span><span class="s1">: </span><span class="s2">button</span><span class="s3">,</span>
|
||
|
<a name="l135"><span class="ln">135 </span></a> <span class="s2">modifiers</span><span class="s1">: </span><span class="s2">modifiers</span><span class="s3">,</span>
|
||
|
<a name="l136"><span class="ln">136 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">MouseInput </span><span class="s1">{</span>
|
||
|
<a name="l137"><span class="ln">137 </span></a> <span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l138"><span class="ln">138 </span></a> <span class="s2">state</span><span class="s3">,</span>
|
||
|
<a name="l139"><span class="ln">139 </span></a> <span class="s2">button</span><span class="s3">,</span>
|
||
|
<a name="l140"><span class="ln">140 </span></a> <span class="s2">modifiers</span><span class="s3">,</span>
|
||
|
<a name="l141"><span class="ln">141 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l142"><span class="ln">142 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">TouchpadPressure </span><span class="s1">{</span>
|
||
|
<a name="l143"><span class="ln">143 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l144"><span class="ln">144 </span></a> <span class="s2">pressure</span><span class="s1">: </span><span class="s2">pressure</span><span class="s3">,</span>
|
||
|
<a name="l145"><span class="ln">145 </span></a> <span class="s2">stage</span><span class="s1">: </span><span class="s2">stage</span><span class="s3">,</span>
|
||
|
<a name="l146"><span class="ln">146 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">TouchpadPressure </span><span class="s1">{</span>
|
||
|
<a name="l147"><span class="ln">147 </span></a> <span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l148"><span class="ln">148 </span></a> <span class="s2">pressure</span><span class="s3">,</span>
|
||
|
<a name="l149"><span class="ln">149 </span></a> <span class="s2">stage</span><span class="s3">,</span>
|
||
|
<a name="l150"><span class="ln">150 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l151"><span class="ln">151 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">Touch</span><span class="s1">(</span><span class="s2">touch</span><span class="s1">) => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">Touch</span><span class="s1">(</span><span class="s2">touch</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l152"><span class="ln">152 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">ScaleFactorChanged </span><span class="s1">{</span>
|
||
|
<a name="l153"><span class="ln">153 </span></a> <span class="s2">scale_factor</span><span class="s1">: </span><span class="s2">scale_factor</span><span class="s3">,</span>
|
||
|
<a name="l154"><span class="ln">154 </span></a> <span class="s2">new_inner_size</span><span class="s1">: </span><span class="s2">new_inner_size</span><span class="s3">,</span>
|
||
|
<a name="l155"><span class="ln">155 </span></a> <span class="s1">} => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">ScaleFactorChanged </span><span class="s1">{</span>
|
||
|
<a name="l156"><span class="ln">156 </span></a> <span class="s2">scale_factor</span><span class="s3">,</span>
|
||
|
<a name="l157"><span class="ln">157 </span></a> <span class="s2">new_inner_size</span><span class="s1">: </span><span class="s2">PhysicalSize </span><span class="s1">{</span>
|
||
|
<a name="l158"><span class="ln">158 </span></a> <span class="s2">width</span><span class="s1">: </span><span class="s2">new_inner_size</span><span class="s1">.</span><span class="s2">width</span><span class="s3">,</span>
|
||
|
<a name="l159"><span class="ln">159 </span></a> <span class="s2">height</span><span class="s1">: </span><span class="s2">new_inner_size</span><span class="s1">.</span><span class="s2">height</span><span class="s3">,</span>
|
||
|
<a name="l160"><span class="ln">160 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l161"><span class="ln">161 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l162"><span class="ln">162 </span></a> <span class="s2">WindowEvent</span><span class="s1">::</span><span class="s2">ThemeChanged</span><span class="s1">(</span><span class="s2">theme</span><span class="s1">) => </span><span class="s2">OwnedWindowEvent</span><span class="s1">::</span><span class="s2">ThemeChanged</span><span class="s1">(</span><span class="s2">theme</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l163"><span class="ln">163 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l164"><span class="ln">164 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l165"><span class="ln">165 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">DeviceEvent </span><span class="s1">{</span>
|
||
|
<a name="l166"><span class="ln">166 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">device_id</span><span class="s3">,</span>
|
||
|
<a name="l167"><span class="ln">167 </span></a> <span class="s2">event</span><span class="s1">: </span><span class="s2">event</span><span class="s3">,</span>
|
||
|
<a name="l168"><span class="ln">168 </span></a> <span class="s1">} => </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">DeviceEvent </span><span class="s1">{ </span><span class="s2">device_id</span><span class="s3">, </span><span class="s2">event </span><span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l169"><span class="ln">169 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">UserEvent</span><span class="s1">(</span><span class="s2">user_event</span><span class="s1">) => </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">UserEvent</span><span class="s1">(</span><span class="s2">user_event</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l170"><span class="ln">170 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">Suspended </span><span class="s1">=> </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">Suspended</span><span class="s3">,</span>
|
||
|
<a name="l171"><span class="ln">171 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">Resumed </span><span class="s1">=> </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">Resumed</span><span class="s3">,</span>
|
||
|
<a name="l172"><span class="ln">172 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">MainEventsCleared </span><span class="s1">=> </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">MainEventsCleared</span><span class="s3">,</span>
|
||
|
<a name="l173"><span class="ln">173 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">RedrawRequested</span><span class="s1">(</span><span class="s2">window_id</span><span class="s1">) => </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">RedrawRequested</span><span class="s1">(</span><span class="s2">window_id</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l174"><span class="ln">174 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">RedrawEventsCleared </span><span class="s1">=> </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">RedrawEventsCleared</span><span class="s3">,</span>
|
||
|
<a name="l175"><span class="ln">175 </span></a> <span class="s2">Event</span><span class="s1">::</span><span class="s2">LoopDestroyed </span><span class="s1">=> </span><span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">LoopDestroyed</span><span class="s3">,</span>
|
||
|
<a name="l176"><span class="ln">176 </span></a> <span class="s1">}</span>
|
||
|
<a name="l177"><span class="ln">177 </span></a> <span class="s1">}</span>
|
||
|
<a name="l178"><span class="ln">178 </span></a><span class="s1">}</span>
|
||
|
<a name="l179"><span class="ln">179 </span></a>
|
||
|
<a name="l180"><span class="ln">180 </span></a><span class="s1">#[</span><span class="s2">derive</span><span class="s1">(</span><span class="s2">Debug</span><span class="s3">, </span><span class="s2">PartialEq</span><span class="s3">, </span><span class="s2">Clone</span><span class="s1">)]</span>
|
||
|
<a name="l181"><span class="ln">181 </span></a><span class="s0">pub enum </span><span class="s2">OwnedWindowEvent </span><span class="s1">{</span>
|
||
|
<a name="l182"><span class="ln">182 </span></a> <span class="s2">Resized</span><span class="s1">(</span><span class="s2">PhysicalSize</span><span class="s1"><</span><span class="s2">u32</span><span class="s1">>)</span><span class="s3">,</span>
|
||
|
<a name="l183"><span class="ln">183 </span></a> <span class="s2">Moved</span><span class="s1">(</span><span class="s2">PhysicalPosition</span><span class="s1"><</span><span class="s2">i32</span><span class="s1">>)</span><span class="s3">,</span>
|
||
|
<a name="l184"><span class="ln">184 </span></a> <span class="s2">CloseRequested</span><span class="s3">,</span>
|
||
|
<a name="l185"><span class="ln">185 </span></a> <span class="s2">Destroyed</span><span class="s3">,</span>
|
||
|
<a name="l186"><span class="ln">186 </span></a> <span class="s2">DroppedFile</span><span class="s1">(</span><span class="s2">PathBuf</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l187"><span class="ln">187 </span></a> <span class="s2">HoveredFile</span><span class="s1">(</span><span class="s2">PathBuf</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l188"><span class="ln">188 </span></a> <span class="s2">HoveredFileCancelled</span><span class="s3">,</span>
|
||
|
<a name="l189"><span class="ln">189 </span></a> <span class="s2">ReceivedCharacter</span><span class="s1">(</span><span class="s2">char</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l190"><span class="ln">190 </span></a> <span class="s2">Focused</span><span class="s1">(</span><span class="s2">bool</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l191"><span class="ln">191 </span></a> <span class="s2">KeyboardInput </span><span class="s1">{</span>
|
||
|
<a name="l192"><span class="ln">192 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l193"><span class="ln">193 </span></a> <span class="s2">input</span><span class="s1">: </span><span class="s2">KeyboardInput</span><span class="s3">,</span>
|
||
|
<a name="l194"><span class="ln">194 </span></a> <span class="s2">is_synthetic</span><span class="s1">: </span><span class="s2">bool</span><span class="s3">,</span>
|
||
|
<a name="l195"><span class="ln">195 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l196"><span class="ln">196 </span></a> <span class="s2">ModifiersChanged</span><span class="s1">(</span><span class="s2">ModifiersState</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l197"><span class="ln">197 </span></a> <span class="s2">CursorMoved </span><span class="s1">{</span>
|
||
|
<a name="l198"><span class="ln">198 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l199"><span class="ln">199 </span></a> <span class="s2">position</span><span class="s1">: </span><span class="s2">PhysicalPosition</span><span class="s1"><</span><span class="s2">f64</span><span class="s1">></span><span class="s3">,</span>
|
||
|
<a name="l200"><span class="ln">200 </span></a> <span class="s1">#[</span><span class="s2">deprecated </span><span class="s1">= </span><span class="s6">"Deprecated in favor of WindowEvent::ModifiersChanged"</span><span class="s1">]</span>
|
||
|
<a name="l201"><span class="ln">201 </span></a> <span class="s2">modifiers</span><span class="s1">: </span><span class="s2">ModifiersState</span><span class="s3">,</span>
|
||
|
<a name="l202"><span class="ln">202 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l203"><span class="ln">203 </span></a> <span class="s2">CursorEntered </span><span class="s1">{</span>
|
||
|
<a name="l204"><span class="ln">204 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l205"><span class="ln">205 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l206"><span class="ln">206 </span></a> <span class="s2">CursorLeft </span><span class="s1">{</span>
|
||
|
<a name="l207"><span class="ln">207 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l208"><span class="ln">208 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l209"><span class="ln">209 </span></a> <span class="s2">MouseWheel </span><span class="s1">{</span>
|
||
|
<a name="l210"><span class="ln">210 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l211"><span class="ln">211 </span></a> <span class="s2">delta</span><span class="s1">: </span><span class="s2">MouseScrollDelta</span><span class="s3">,</span>
|
||
|
<a name="l212"><span class="ln">212 </span></a> <span class="s2">phase</span><span class="s1">: </span><span class="s2">TouchPhase</span><span class="s3">,</span>
|
||
|
<a name="l213"><span class="ln">213 </span></a> <span class="s1">#[</span><span class="s2">deprecated </span><span class="s1">= </span><span class="s6">"Deprecated in favor of WindowEvent::ModifiersChanged"</span><span class="s1">]</span>
|
||
|
<a name="l214"><span class="ln">214 </span></a> <span class="s2">modifiers</span><span class="s1">: </span><span class="s2">ModifiersState</span><span class="s3">,</span>
|
||
|
<a name="l215"><span class="ln">215 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l216"><span class="ln">216 </span></a> <span class="s2">MouseInput </span><span class="s1">{</span>
|
||
|
<a name="l217"><span class="ln">217 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l218"><span class="ln">218 </span></a> <span class="s2">state</span><span class="s1">: </span><span class="s2">ElementState</span><span class="s3">,</span>
|
||
|
<a name="l219"><span class="ln">219 </span></a> <span class="s2">button</span><span class="s1">: </span><span class="s2">MouseButton</span><span class="s3">,</span>
|
||
|
<a name="l220"><span class="ln">220 </span></a> <span class="s1">#[</span><span class="s2">deprecated </span><span class="s1">= </span><span class="s6">"Deprecated in favor of WindowEvent::ModifiersChanged"</span><span class="s1">]</span>
|
||
|
<a name="l221"><span class="ln">221 </span></a> <span class="s2">modifiers</span><span class="s1">: </span><span class="s2">ModifiersState</span><span class="s3">,</span>
|
||
|
<a name="l222"><span class="ln">222 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l223"><span class="ln">223 </span></a> <span class="s2">TouchpadPressure </span><span class="s1">{</span>
|
||
|
<a name="l224"><span class="ln">224 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l225"><span class="ln">225 </span></a> <span class="s2">pressure</span><span class="s1">: </span><span class="s2">f32</span><span class="s3">,</span>
|
||
|
<a name="l226"><span class="ln">226 </span></a> <span class="s2">stage</span><span class="s1">: </span><span class="s2">i64</span><span class="s3">,</span>
|
||
|
<a name="l227"><span class="ln">227 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l228"><span class="ln">228 </span></a> <span class="s2">AxisMotion </span><span class="s1">{</span>
|
||
|
<a name="l229"><span class="ln">229 </span></a> <span class="s2">device_id</span><span class="s1">: </span><span class="s2">DeviceId</span><span class="s3">,</span>
|
||
|
<a name="l230"><span class="ln">230 </span></a> <span class="s2">axis</span><span class="s1">: </span><span class="s2">AxisId</span><span class="s3">,</span>
|
||
|
<a name="l231"><span class="ln">231 </span></a> <span class="s2">value</span><span class="s1">: </span><span class="s2">f64</span><span class="s3">,</span>
|
||
|
<a name="l232"><span class="ln">232 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l233"><span class="ln">233 </span></a> <span class="s2">Touch</span><span class="s1">(</span><span class="s2">Touch</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l234"><span class="ln">234 </span></a> <span class="s2">ScaleFactorChanged </span><span class="s1">{</span>
|
||
|
<a name="l235"><span class="ln">235 </span></a> <span class="s2">scale_factor</span><span class="s1">: </span><span class="s2">f64</span><span class="s3">,</span>
|
||
|
<a name="l236"><span class="ln">236 </span></a> <span class="s2">new_inner_size</span><span class="s1">: </span><span class="s2">PhysicalSize</span><span class="s1"><</span><span class="s2">u32</span><span class="s1">></span><span class="s3">,</span>
|
||
|
<a name="l237"><span class="ln">237 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l238"><span class="ln">238 </span></a> <span class="s2">ThemeChanged</span><span class="s1">(</span><span class="s2">Theme</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l239"><span class="ln">239 </span></a><span class="s1">}</span>
|
||
|
<a name="l240"><span class="ln">240 </span></a>
|
||
|
<a name="l241"><span class="ln">241 </span></a>
|
||
|
<a name="l242"><span class="ln">242 </span></a><span class="s4">/// Because I am a glutton for punishment I am going to just do a mono-event-dispatch-magoooo</span>
|
||
|
<a name="l243"><span class="ln">243 </span></a><span class="s1">#[</span><span class="s2">system</span><span class="s1">]</span>
|
||
|
<a name="l244"><span class="ln">244 </span></a><span class="s1">#[</span><span class="s2">write_component</span><span class="s1">(</span><span class="s2">Camera</span><span class="s1">)]</span>
|
||
|
<a name="l245"><span class="ln">245 </span></a><span class="s1">#[</span><span class="s2">write_component</span><span class="s1">(</span><span class="s2">CameraController</span><span class="s1">)]</span>
|
||
|
<a name="l246"><span class="ln">246 </span></a><span class="s0">pub fn </span><span class="s2">event_dispatch</span><span class="s1">(</span>
|
||
|
<a name="l247"><span class="ln">247 </span></a> <span class="s2">world</span><span class="s1">: &</span><span class="s0">mut </span><span class="s2">SubWorld</span><span class="s3">,</span>
|
||
|
<a name="l248"><span class="ln">248 </span></a> <span class="s1">#[</span><span class="s2">resource</span><span class="s1">] </span><span class="s2">event_stack</span><span class="s1">: &</span><span class="s0">mut </span><span class="s2">Vec</span><span class="s1"><</span><span class="s2">OwnedEvent</span><span class="s1"><</span><span class="s2">OwnedEventExtension</span><span class="s1">>></span><span class="s3">,</span>
|
||
|
<a name="l249"><span class="ln">249 </span></a> <span class="s1">#[</span><span class="s2">resource</span><span class="s1">] </span><span class="s2">imgui_context</span><span class="s1">: &</span><span class="s0">mut </span><span class="s2">Arc</span><span class="s1"><</span><span class="s2">Mutex</span><span class="s1"><</span><span class="s2">ImguiContext</span><span class="s1">>></span><span class="s3">,</span>
|
||
|
<a name="l250"><span class="ln">250 </span></a> <span class="s1">#[</span><span class="s2">resource</span><span class="s1">] </span><span class="s2">imgui_platform</span><span class="s1">: &</span><span class="s0">mut </span><span class="s2">Arc</span><span class="s1"><</span><span class="s2">Mutex</span><span class="s1"><</span><span class="s2">ImguiPlatform</span><span class="s1">>></span><span class="s3">,</span>
|
||
|
<a name="l251"><span class="ln">251 </span></a> <span class="s1">#[</span><span class="s2">resource</span><span class="s1">] </span><span class="s2">winit_window</span><span class="s1">: &</span><span class="s0">mut </span><span class="s2">Window</span><span class="s3">,</span>
|
||
|
<a name="l252"><span class="ln">252 </span></a><span class="s1">) {</span>
|
||
|
<a name="l253"><span class="ln">253 </span></a> <span class="s0">use </span><span class="s2">winit_24</span><span class="s1">::</span><span class="s2">event</span><span class="s1">::</span><span class="s2">Event</span><span class="s1">::</span><span class="s2">DeviceEvent</span><span class="s3">;</span>
|
||
|
<a name="l254"><span class="ln">254 </span></a>
|
||
|
<a name="l255"><span class="ln">255 </span></a> <span class="s0">for </span><span class="s2">event </span><span class="s0">in </span><span class="s2">event_stack </span><span class="s1">{</span>
|
||
|
<a name="l256"><span class="ln">256 </span></a>
|
||
|
<a name="l257"><span class="ln">257 </span></a> <span class="s0">match </span><span class="s2">event </span><span class="s1">{</span>
|
||
|
<a name="l258"><span class="ln">258 </span></a> <span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">DeviceEvent </span><span class="s1">{</span>
|
||
|
<a name="l259"><span class="ln">259 </span></a> <span class="s2">event</span><span class="s1">: </span><span class="s2">winit_24</span><span class="s1">::</span><span class="s2">event</span><span class="s1">::</span><span class="s2">DeviceEvent</span><span class="s1">::</span><span class="s2">MouseMotion </span><span class="s1">{ </span><span class="s2">delta </span><span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l260"><span class="ln">260 </span></a> <span class="s1">..</span>
|
||
|
<a name="l261"><span class="ln">261 </span></a> <span class="s1">} => {</span>
|
||
|
<a name="l262"><span class="ln">262 </span></a> <span class="s0">let mut </span><span class="s2">query </span><span class="s1">= <(&</span><span class="s0">mut </span><span class="s2">CameraController</span><span class="s1">)>::</span><span class="s2">query</span><span class="s1">()</span><span class="s3">;</span>
|
||
|
<a name="l263"><span class="ln">263 </span></a> <span class="s0">for </span><span class="s1">(</span><span class="s2">camera_controller</span><span class="s1">) </span><span class="s0">in </span><span class="s2">query</span><span class="s1">.</span><span class="s2">iter_mut</span><span class="s1">(</span><span class="s2">world</span><span class="s1">) {</span>
|
||
|
<a name="l264"><span class="ln">264 </span></a> <span class="s2">camera_controller</span><span class="s1">.</span><span class="s2">process_mouse</span><span class="s1">(</span><span class="s2">delta</span><span class="s1">.</span><span class="s7">0</span><span class="s3">, </span><span class="s2">delta</span><span class="s1">.</span><span class="s7">1</span><span class="s1">)</span><span class="s3">;</span>
|
||
|
<a name="l265"><span class="ln">265 </span></a> <span class="s1">}</span>
|
||
|
<a name="l266"><span class="ln">266 </span></a>
|
||
|
<a name="l267"><span class="ln">267 </span></a> <span class="s1">}</span><span class="s3">,</span>
|
||
|
<a name="l268"><span class="ln">268 </span></a> <span class="s2">OwnedEvent</span><span class="s1">::</span><span class="s2">DeviceEvent </span><span class="s1">{</span>
|
||
|
<a name="l269"><span class="ln">269 </span></a> <span class="s2">event</span><span class="s1">: </span><span class="s2">winit_24</span><span class="s1">::</span><span class="s2">event</span><span class="s1">::</span><span class="s2">DeviceEvent</span><span class="s1">::</span><span class="s2">Key</span><span class="s1">(</span><span class="s2">keyboard_input</span><span class="s1">)</span><span class="s3">,</span>
|
||
|
<a name="l270"><span class="ln">270 </span></a> <span class="s1">..</span>
|
||
|
<a name="l271"><span class="ln">271 </span></a> <span class="s1">} => {</span>
|
||
|
<a name="l272"><span class="ln">272 </span></a> <span class="s0">let mut </span><span class="s2">query </span><span class="s1">= <(&</span><span class="s0">mut </span><span class="s2">CameraController</span><span class="s1">)>::</span><span class="s2">query</span><span class="s1">()</span><span class="s3">;</span>
|
||
|
<a name="l273"><span class="ln">273 </span></a> <span class="s0">for </span><span class="s1">(</span><span class="s2">camera_controller</span><span class="s1">) </span><span class="s0">in </span><span class="s2">query</span><span class="s1">.</span><span class="s2">iter_mut</span><span class="s1">(</span><span class="s2">world</span><span class="s1">) {</span>
|
||
|
<a name="l274"><span class="ln">274 </span></a> <span class="s2">camera_controller</span><span class="s1">.</span><span class="s2">process_keyboard</span><span class="s1">(</span>
|
||
|
<a name="l275"><span class="ln">275 </span></a> <span class="s2">keyboard_input</span><span class="s1">.</span><span class="s2">virtual_keycode</span><span class="s1">.</span><span class="s2">unwrap</span><span class="s1">()</span><span class="s3">,</span>
|
||
|
<a name="l276"><span class="ln">276 </span></a> <span class="s2">keyboard_input</span><span class="s1">.</span><span class="s2">state</span><span class="s3">,</span>
|
||
|
<a name="l277"><span class="ln">277 </span></a> <span class="s1">)</span><span class="s3">;</span>
|
||
|
<a name="l278"><span class="ln">278 </span></a> <span class="s1">}</span>
|
||
|
<a name="l279"><span class="ln">279 </span></a>
|
||
|
<a name="l280"><span class="ln">280 </span></a> <span class="s0">match </span><span class="s2">keyboard_input</span><span class="s1">.</span><span class="s2">virtual_keycode</span><span class="s1">.</span><span class="s2">unwrap</span><span class="s1">() {</span>
|
||
|
<a name="l281"><span class="ln">281 </span></a> <span class="s2">VirtualKeyCode</span><span class="s1">::</span><span class="s2">R </span><span class="s1">=> {</span>
|
||
|
<a name="l282"><span class="ln">282 </span></a> <span class="s0">if </span><span class="s2">keyboard_input</span><span class="s1">.</span><span class="s2">state </span><span class="s1">== </span><span class="s2">ElementState</span><span class="s1">::</span><span class="s2">Pressed </span><span class="s1">{</span>
|
||
|
<a name="l283"><span class="ln">283 </span></a>
|
||
|
<a name="l284"><span class="ln">284 </span></a>
|
||
|
<a name="l285"><span class="ln">285 </span></a> <span class="s8">//winit_window.set_cursor_grab(true);</span>
|
||
|
<a name="l286"><span class="ln">286 </span></a> <span class="s1">}</span>
|
||
|
<a name="l287"><span class="ln">287 </span></a> <span class="s1">}</span>
|
||
|
<a name="l288"><span class="ln">288 </span></a> <span class="s2">VirtualKeyCode</span><span class="s1">::</span><span class="s2">Escape </span><span class="s1">=> {</span>
|
||
|
<a name="l289"><span class="ln">289 </span></a> <span class="s0">if </span><span class="s2">keyboard_input</span><span class="s1">.</span><span class="s2">state </span><span class="s1">== </span><span class="s2">ElementState</span><span class="s1">::</span><span class="s2">Pressed </span><span class="s1">{</span>
|
||
|
<a name="l290"><span class="ln">290 </span></a> <span class="s8">//winit_window.set_cursor_grab(false);</span>
|
||
|
<a name="l291"><span class="ln">291 </span></a> <span class="s1">}</span>
|
||
|
<a name="l292"><span class="ln">292 </span></a> <span class="s1">}</span>
|
||
|
<a name="l293"><span class="ln">293 </span></a> <span class="s2">_ </span><span class="s1">=> ()</span>
|
||
|
<a name="l294"><span class="ln">294 </span></a> <span class="s1">}</span>
|
||
|
<a name="l295"><span class="ln">295 </span></a> <span class="s1">}</span>
|
||
|
<a name="l296"><span class="ln">296 </span></a> <span class="s2">_ </span><span class="s1">=> {}</span>
|
||
|
<a name="l297"><span class="ln">297 </span></a> <span class="s1">}</span>
|
||
|
<a name="l298"><span class="ln">298 </span></a>
|
||
|
<a name="l299"><span class="ln">299 </span></a> <span class="s0">let mut </span><span class="s2">imgui_context </span><span class="s1">= &</span><span class="s0">mut </span><span class="s2">imgui_context</span><span class="s1">.</span><span class="s2">lock</span><span class="s1">().</span><span class="s2">unwrap</span><span class="s1">().</span><span class="s2">context</span><span class="s3">;</span>
|
||
|
<a name="l300"><span class="ln">300 </span></a> <span class="s0">let mut </span><span class="s2">imgui_platform </span><span class="s1">= &</span><span class="s0">mut </span><span class="s2">imgui_platform</span><span class="s1">.</span><span class="s2">lock</span><span class="s1">().</span><span class="s2">unwrap</span><span class="s1">().</span><span class="s2">platform</span><span class="s3">;</span>
|
||
|
<a name="l301"><span class="ln">301 </span></a>
|
||
|
<a name="l302"><span class="ln">302 </span></a> <span class="s2">imgui_platform</span><span class="s1">.</span><span class="s2">handle_event</span><span class="s1">(</span><span class="s2">imgui_context</span><span class="s1">.</span><span class="s2">io_mut</span><span class="s1">()</span><span class="s3">, </span><span class="s1">&</span><span class="s2">winit_window</span><span class="s3">, </span><span class="s1">&</span><span class="s2">event</span><span class="s1">)</span><span class="s3">;</span>
|
||
|
<a name="l303"><span class="ln">303 </span></a> <span class="s1">}</span>
|
||
|
<a name="l304"><span class="ln">304 </span></a><span class="s1">}</span>
|
||
|
<a name="l305"><span class="ln">305 </span></a></pre>
|
||
|
</body>
|
||
|
</html>
|