summaryrefslogtreecommitdiff
path: root/dependencies/src/imgui/imgui_impl_sdl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dependencies/src/imgui/imgui_impl_sdl.cpp')
-rw-r--r--dependencies/src/imgui/imgui_impl_sdl.cpp130
1 files changed, 128 insertions, 2 deletions
diff --git a/dependencies/src/imgui/imgui_impl_sdl.cpp b/dependencies/src/imgui/imgui_impl_sdl.cpp
index 34e1abb..9a68de7 100644
--- a/dependencies/src/imgui/imgui_impl_sdl.cpp
+++ b/dependencies/src/imgui/imgui_impl_sdl.cpp
@@ -366,6 +366,130 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
return false;
}
+#if 0
+/* XPM */
+static const char *arrow[] = {
+ /* width height num_colors chars_per_pixel */
+ " 32 32 3 1",
+ /* colors */
+ "X c #000000",
+ ". c #ffffff",
+ " c None",
+ /* pixels */
+ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "X..............................X",
+ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ "0,0"
+};
+#endif
+
+/* XPM */
+static const char *arrow[] = {
+ /* width height num_colors chars_per_pixel */
+ " 32 32 3 1",
+ /* colors */
+ "X c #000000",
+ ". c #ffffff",
+ " c None",
+ /* pixels */
+ " ",
+ " ",
+ " XX ",
+ " X... ",
+ " ...X ",
+ " ...X ",
+ " ...X ",
+ " ... ",
+ " ...X ",
+ " ... ",
+ "X..X ",
+ "X..X ",
+ "...X ",
+ "...X ",
+ "...X ",
+ "X..X ",
+ "X..X ",
+ " ... XX ",
+ " ... X....XX ",
+ " X... X........X ",
+ " ...X XX.......X ",
+ " X... .....X ",
+ " X...X ......X ",
+ " X...X X....... ",
+ " X....XX X.....X... ",
+ " X...... ........X X..X ",
+ " X.... ......X ... ",
+ " XX XXXX ... ",
+ " X..X ",
+ " X..X ",
+ " XX ",
+ " ",
+ "0,0"
+};
+
+static SDL_Cursor *cursor_test(const char *image[])
+{
+ int i, row, col;
+ Uint8 data[4*32];
+ Uint8 mask[4*32];
+ int hot_x, hot_y;
+
+ i = -1;
+ for (row=0; row<32; ++row) {
+ for (col=0; col<32; ++col) {
+ if (col % 8) {
+ data[i] <<= 1;
+ mask[i] <<= 1;
+ } else {
+ ++i;
+ data[i] = mask[i] = 0;
+ }
+ switch (image[4+row][col]) {
+ case 'X':
+ data[i] |= 0x01;
+ mask[i] |= 0x01;
+ break;
+ case '.':
+ mask[i] |= 0x01;
+ break;
+ case ' ':
+ break;
+ }
+ }
+ }
+ sscanf(image[4+row], "%d,%d", &hot_x, &hot_y);
+ return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);
+}
+
static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer, void* sdl_gl_context)
{
ImGuiIO& io = ImGui::GetIO();
@@ -408,13 +532,15 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer, void
// Load mouse cursors
bd->MouseCursors[ImGuiMouseCursor_Arrow] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
bd->MouseCursors[ImGuiMouseCursor_TextInput] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
- bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
+ bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = cursor_test(arrow);
bd->MouseCursors[ImGuiMouseCursor_ResizeNS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
bd->MouseCursors[ImGuiMouseCursor_ResizeEW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
bd->MouseCursors[ImGuiMouseCursor_Hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
- bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
+ bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
+ // bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
+ // bd->MouseCursors[ImGuiMouseCursor_Test] = SDL_CreateCursor();
// Set platform dependent data in viewport
// Our mouse update function expect PlatformHandle to be filled for the main viewport