/* Crafter®.Graphics Copyright (C) 2026 Catcrafts® Catcrafts.net This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ module; #ifdef CRAFTER_GRAPHICS_RENDERER_VULKAN #include "vulkan/vulkan.h" #endif export module Crafter.Graphics:Types; import std; import Crafter.Math; export namespace Crafter { struct MouseMoveEvent { Vector lastMousePos; Vector currentMousePos; Vector mouseDelta; }; struct ScaleData2D { Vector position; Vector size; }; struct ClipRect { std::int32_t left; std::int32_t right; std::int32_t top; std::int32_t bottom; }; struct FrameTime { std::chrono::time_point now; std::chrono::duration delta; }; enum class CrafterKeys { // Alphabetic keys A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, // Numeric keys _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, // Function keys F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, // Control keys Escape, Tab, Enter, Space, Backspace, Delete, Insert, Home, End, PageUp, PageDown, CapsLock, NumLock, ScrollLock, // Modifier keys LeftShift, RightShift, LeftCtrl, RightCtrl, LeftAlt, RightAlt, LeftSuper, RightSuper, // Arrow keys Up, Down, Left, Right, // Keypad keys keypad_0, keypad_1, keypad_2, keypad_3, keypad_4, keypad_5, keypad_6, keypad_7, keypad_8, keypad_9, keypad_enter, keypad_plus, keypad_minus, keypad_multiply, keypad_divide, keypad_decimal, // Punctuation and special keys grave, minus, equal, bracket_left, bracket_right, backslash, semicolon, quote, comma, period, slash, print_screen, pause, menu, // Additional keys volume_up, volume_down, volume_mute, media_play, media_stop, media_prev, media_next, browser_back, browser_forward, browser_refresh, browser_stop, browser_search, browser_home, launch_mail, launch_calculator, launch_media_player, CrafterKeysMax }; template constexpr T AlignUp(T value, T2 alignment) { return (value + alignment - 1) & ~(alignment - 1); } template constexpr T GetTanHalfFov(T fov) { return std::tan(fov * std::numbers::pi / 360.0); } #ifdef CRAFTER_GRAPHICS_RENDERER_VULKAN struct DescriptorBinding { VkDescriptorType type; std::uint32_t slot; }; #endif }