/// <summary> /// Manualy create assets with shaders and cursor textures for ImGUI. /// </summary> void _CreateAssetResources() { if (_camera == null) { _camera = Camera.main; } _initialConfiguration.SetDefaults(); if (_shaders == null) { _shaders = ScriptableObject.CreateInstance <ShaderResourcesAsset>(); _shaders.shaders = new ShaderResourcesAsset.Shaders(); _shaders.propertyNames = new ShaderResourcesAsset.PropertyNames(); _shaders.shaders.mesh = Shader.Find("DearImGui/Mesh"); _shaders.shaders.procedural = Shader.Find("DearImGui/Procedural"); _shaders.propertyNames.baseVertex = "_BaseVertex"; _shaders.propertyNames.vertices = "_Vertices"; _shaders.propertyNames.tex = "_Tex"; } if (_cursorShapes == null) { _cursorShapes = ScriptableObject.CreateInstance <CursorShapesAsset>(); _cursorShapes.Arrow.texture = Resources.Load <Texture2D>("Cursors/dmz-white/left_ptr"); _cursorShapes.Arrow.hotspot = new Vector2(7, 4); _cursorShapes.TextInput.texture = Resources.Load <Texture2D>("Cursors/dmz-white/xterm"); _cursorShapes.TextInput.hotspot = new Vector2(11, 11); _cursorShapes.ResizeAll.texture = Resources.Load <Texture2D>("Cursors/dmz-white/move"); _cursorShapes.ResizeAll.hotspot = new Vector2(4, 5); _cursorShapes.ResizeEW.texture = Resources.Load <Texture2D>("Cursors/dmz-white/sb_h_double_arrow"); _cursorShapes.ResizeEW.hotspot = new Vector2(11, 11); _cursorShapes.ResizeNS.texture = Resources.Load <Texture2D>("Cursors/dmz-white/sb_v_double_arrow"); _cursorShapes.ResizeNS.hotspot = new Vector2(11, 11); _cursorShapes.ResizeNESW.texture = Resources.Load <Texture2D>("Cursors/dmz-white/fd_double_arrow"); _cursorShapes.ResizeNESW.hotspot = new Vector2(11, 11); _cursorShapes.ResizeNWSE.texture = Resources.Load <Texture2D>("Cursors/dmz-white/bd_double_arrow"); _cursorShapes.ResizeNWSE.hotspot = new Vector2(11, 11); _cursorShapes.Hand.texture = Resources.Load <Texture2D>("Cursors/dmz-white/hand2"); _cursorShapes.Hand.hotspot = new Vector2(9, 5); _cursorShapes.NotAllowed.texture = Resources.Load <Texture2D>("Cursors/dmz-white/crossed_circle"); _cursorShapes.NotAllowed.hotspot = new Vector2(11, 11); } }
public static IImGuiPlatform Create(Type type, CursorShapesAsset cursors, IniSettingsAsset iniSettings) { switch (type) { case Type.InputManager: return(new ImGuiPlatformInputManager(cursors, iniSettings)); #if HAS_INPUTSYSTEM case Type.InputSystem: return(new ImGuiPlatformInputSystem(cursors, iniSettings)); #endif default: Debug.LogError($"[DearImGui] {type} platform not available."); return(null); } }
public ImGuiPlatformInputManager(CursorShapesAsset cursorShapes, IniSettingsAsset iniSettings) { _cursorShapes = cursorShapes; _iniSettings = iniSettings; }
public ImGuiPlatformInputManager(CursorShapesAsset cursorShapes, IniSettingsAsset iniSettings) { _cursorShapes = cursorShapes; _iniSettings = iniSettings; _callbacks.ImeSetInputScreenPos = (x, y) => Input.compositionCursorPos = new Vector2(x, y); }
public ImGuiPlatformInputSystem(CursorShapesAsset cursorShapes, IniSettingsAsset iniSettings) { _cursorShapes = cursorShapes; _iniSettings = iniSettings; _callbacks.ImeSetInputScreenPos = (x, y) => _keyboard.SetIMECursorPosition(new Vector2(x, y)); }