mindustry logic execution, map- and schematic- parsing and rendering
| ofs | hex dump | ascii | |
|---|---|---|---|
| 0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 20 00 00 00 20 08 06 00 00 00 73 7a 7a | .PNG........IHDR.............szz | |
| 0020 | f4 00 00 01 85 69 43 43 50 49 43 43 20 70 72 6f 66 69 6c 65 00 00 28 91 7d 91 3d 48 c3 40 1c c5 | .....iCCPICC.profile..(.}.=H.@.. | |
| 0040 | 5f 53 6b a5 54 1c ac 22 e2 90 a1 3a 59 10 15 71 d4 2a 14 a1 42 a8 15 5a 75 30 b9 f4 43 68 d2 90 | _Sk.T.."...:Y..q.*..B..Zu0..Ch.. | |
| 0060 | a4 b8 38 0a ae 05 07 3f 16 ab 0e 2e ce ba 3a b8 0a 82 e0 07 88 8b ab 93 a2 8b 94 f8 bf a4 d0 22 | ..8....?......:................" | |
| 0080 | d6 83 e3 7e bc bb f7 b8 7b 07 08 b5 12 d3 ac 8e 31 40 d3 6d 33 95 88 8b 99 ec 8a 18 7c 45 27 02 | ...~....{[email protected].......|E'. | |
| 00a0 | e8 47 08 7d 32 b3 8c 59 49 4a a2 ed f8 ba 87 8f af 77 31 9e d5 fe dc 9f a3 5b cd 59 0c f0 89 c4 | .G.}2..YIJ.......w1......[.Y.... | |
| 00c0 | 33 cc 30 6d e2 75 e2 a9 4d db e0 bc 4f 1c 61 45 59 25 3e 27 1e 35 e9 82 c4 8f 5c 57 3c 7e e3 5c | 3.0m.u..M...O.aEY%>'.5....\W<~.\ | |
| 00e0 | 70 59 e0 99 11 33 9d 9a 23 8e 10 8b 85 16 56 5a 98 15 4d 8d 78 92 38 aa 6a 3a e5 0b 19 8f 55 ce | pY...3..#.....VZ..M.x.8.j:....U. | |
| 0100 | 5b 9c b5 52 85 35 ee c9 5f 18 ce e9 cb 4b 5c a7 39 84 04 16 b0 08 09 22 14 54 b0 81 12 6c c4 68 | [..R.5.._....K\.9......".T...l.h | |
| 0120 | //! Signals that control when/if the editor redraws use std::future::Future; use parking_lot::{RwLock, RwLockReadGuard}; use tokio::sync::Notify; use crate::runtime_local; runtime_local! { /// A `Notify` instance that can be used to (asynchronously) request /// the editor to render a new frame. static REDRAW_NOTIFY: Notify = Notify::const_new(); /// A `RwLock` that prevents the next frame from being /// drawn until an exclusive (write) lock can be acquired. /// This allows asynchronous tasks to acquire `non-exclusive` /// locks (read) to prevent the next frame from being drawn /// until a certain computation has finished. static RENDER_LOCK: RwLock<()> = RwLock::new(()); } pub type RenderLockGuard = RwLockReadGuard<'static, ()>; /// Requests that the editor is redrawn. The redraws are debounced (currently to /// 30FPS) so this can be called many times without causing a ton of frames to /// be rendered. pub fn request_redraw() { REDRAW_NOTIFY.notify_one(); } /// Returns a future that will yield once a redraw has been asynchronously /// requested using [`request_redraw`]. pub fn redraw_requested() -> impl Future<Output = ()> { REDRAW_NOTIFY.notified() } /// Wait until all locks acquired with [`lock_frame`] have been released. /// This function is called before rendering and is intended to allow the frame /// to wait for async computations that should be included in the current frame. pub fn start_frame() { drop(RENDER_LOCK.write()); // exhaust any leftover redraw notifications let notify = REDRAW_NOTIFY.notified(); tokio::pin!(notify); notify.enable(); } /// Acquires the render lock which will prevent the next frame from being drawn /// until the returned guard is dropped. pub fn lock_frame() -> RenderLockGuard { RENDER_LOCK.read() } /// A zero sized type that requests a redraw via [request_redraw] when the type [Drop]s. pub struct RequestRedrawOnDrop; impl Drop for RequestRedrawOnDrop { fn drop(&mut self) { request_redraw(); } } 60 | a3 0e 18 2d 07 08 3a 20 26 c9 97 6c c3 09 e5 00 a2 1c 40 ae 23 62 92 7c 89 6a 4f 10 4c 03 94 38 | ...-..:.&..l......@.#b.|.jO.L..8 |
| 0280 | 02 b9 3d 81 0b d0 3c 0d 10 6a 59 61 38 00 57 e3 91 56 8e c0 1a 02 f4 74 04 ce 34 40 0b 47 20 3b | ..=...<[email protected].; | |
| 02a0 | 06 06 e8 5e 0e a0 f7 c0 06 a4 20 42 76 04 d1 d9 90 16 8e 60 60 60 60 00 00 25 c8 50 dd 0d 1e 70 | ...^.......Bv......````..%.P...p | |
| 02c0 | e9 00 00 00 00 49 45 4e 44 ae 42 60 82 | .....IEND.B`. |