- removed 18805 CR characters - removed 774 trailing whitespaces - replaced 1922 tabs with spaces - fixed 31 svn:eol-style propertiesundefined
| @@ -188,7 +188,7 @@ setup_command: | |||||
| T_OBJPOSITION v3 { if (uc.m_last_cmd == "ADDLIGHT") | T_OBJPOSITION v3 { if (uc.m_last_cmd == "ADDLIGHT") | ||||
| uc.m_sstp.m_lights.Last()->SetPosition(vec3($2[0], $2[1], $2[2])); } | uc.m_sstp.m_lights.Last()->SetPosition(vec3($2[0], $2[1], $2[2])); } | ||||
| | T_OBJLOOKAT v3 { if (uc.m_last_cmd == "ADDLIGHT") | | T_OBJLOOKAT v3 { if (uc.m_last_cmd == "ADDLIGHT") | ||||
| { | |||||
| { | |||||
| } } | } } | ||||
| | T_OBJCOLOR v4{ if (uc.m_last_cmd == "ADDLIGHT") | | T_OBJCOLOR v4{ if (uc.m_last_cmd == "ADDLIGHT") | ||||
| uc.m_sstp.m_lights.Last()->SetColor(vec4($2[0], $2[1], $2[2], $2[3])); } | uc.m_sstp.m_lights.Last()->SetColor(vec4($2[0], $2[1], $2[2], $2[3])); } | ||||
| @@ -104,7 +104,7 @@ protected: | |||||
| DRAWGROUP_HUD, | DRAWGROUP_HUD, | ||||
| DRAWGROUP_IMGUI, | DRAWGROUP_IMGUI, | ||||
| DRAWGROUP_CAPTURE, | DRAWGROUP_CAPTURE, | ||||
| DRAWGROUP_END //Must be the last element | DRAWGROUP_END //Must be the last element | ||||
| } | } | ||||
| m_drawgroup; | m_drawgroup; | ||||
| @@ -79,7 +79,7 @@ static void ImGui_ImplDX11_RenderDrawLists(ImDrawList** const cmd_lists, int cmd | |||||
| const float R = ImGui::GetIO().DisplaySize.x; | const float R = ImGui::GetIO().DisplaySize.x; | ||||
| const float B = ImGui::GetIO().DisplaySize.y; | const float B = ImGui::GetIO().DisplaySize.y; | ||||
| const float T = 0.0f; | const float T = 0.0f; | ||||
| const float mvp[4][4] = | |||||
| const float mvp[4][4] = | |||||
| { | { | ||||
| { 2.0f/(R-L), 0.0f, 0.0f, 0.0f}, | { 2.0f/(R-L), 0.0f, 0.0f, 0.0f}, | ||||
| { 0.0f, 2.0f/(T-B), 0.0f, 0.0f,}, | { 0.0f, 2.0f/(T-B), 0.0f, 0.0f,}, | ||||
| @@ -134,7 +134,7 @@ static void ImGui_ImplDX11_RenderDrawLists(ImDrawList** const cmd_lists, int cmd | |||||
| { | { | ||||
| const D3D11_RECT r = { (LONG)pcmd->clip_rect.x, (LONG)pcmd->clip_rect.y, (LONG)pcmd->clip_rect.z, (LONG)pcmd->clip_rect.w }; | const D3D11_RECT r = { (LONG)pcmd->clip_rect.x, (LONG)pcmd->clip_rect.y, (LONG)pcmd->clip_rect.z, (LONG)pcmd->clip_rect.w }; | ||||
| g_pd3dDeviceContext->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->texture_id); | g_pd3dDeviceContext->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->texture_id); | ||||
| g_pd3dDeviceContext->RSSetScissorRects(1, &r); | |||||
| g_pd3dDeviceContext->RSSetScissorRects(1, &r); | |||||
| g_pd3dDeviceContext->Draw(pcmd->vtx_count, vtx_offset); | g_pd3dDeviceContext->Draw(pcmd->vtx_count, vtx_offset); | ||||
| } | } | ||||
| vtx_offset += pcmd->vtx_count; | vtx_offset += pcmd->vtx_count; | ||||
| @@ -156,20 +156,20 @@ LRESULT ImGui_ImplDX11_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lPar | |||||
| io.MouseDown[0] = true; | io.MouseDown[0] = true; | ||||
| return true; | return true; | ||||
| case WM_LBUTTONUP: | case WM_LBUTTONUP: | ||||
| io.MouseDown[0] = false; | |||||
| io.MouseDown[0] = false; | |||||
| return true; | return true; | ||||
| case WM_RBUTTONDOWN: | case WM_RBUTTONDOWN: | ||||
| io.MouseDown[1] = true; | |||||
| io.MouseDown[1] = true; | |||||
| return true; | return true; | ||||
| case WM_RBUTTONUP: | case WM_RBUTTONUP: | ||||
| io.MouseDown[1] = false; | |||||
| io.MouseDown[1] = false; | |||||
| return true; | return true; | ||||
| case WM_MOUSEWHEEL: | case WM_MOUSEWHEEL: | ||||
| io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; | io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; | ||||
| return true; | return true; | ||||
| case WM_MOUSEMOVE: | case WM_MOUSEMOVE: | ||||
| io.MousePos.x = (signed short)(lParam); | io.MousePos.x = (signed short)(lParam); | ||||
| io.MousePos.y = (signed short)(lParam >> 16); | |||||
| io.MousePos.y = (signed short)(lParam >> 16); | |||||
| return true; | return true; | ||||
| case WM_KEYDOWN: | case WM_KEYDOWN: | ||||
| if (wParam < 256) | if (wParam < 256) | ||||
| @@ -257,7 +257,7 @@ bool ImGui_ImplDX11_CreateDeviceObjects() | |||||
| // Create the vertex shader | // Create the vertex shader | ||||
| { | { | ||||
| static const char* vertexShader = | |||||
| static const char* vertexShader = | |||||
| "cbuffer vertexBuffer : register(c0) \ | "cbuffer vertexBuffer : register(c0) \ | ||||
| {\ | {\ | ||||
| float4x4 ProjectionMatrix; \ | float4x4 ProjectionMatrix; \ | ||||
| @@ -315,7 +315,7 @@ bool ImGui_ImplDX11_CreateDeviceObjects() | |||||
| // Create the pixel shader | // Create the pixel shader | ||||
| { | { | ||||
| static const char* pixelShader = | |||||
| static const char* pixelShader = | |||||
| "struct PS_INPUT\ | "struct PS_INPUT\ | ||||
| {\ | {\ | ||||
| float4 pos : SV_POSITION;\ | float4 pos : SV_POSITION;\ | ||||
| @@ -396,7 +396,7 @@ bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContex | |||||
| g_pd3dDevice = device; | g_pd3dDevice = device; | ||||
| g_pd3dDeviceContext = device_context; | g_pd3dDeviceContext = device_context; | ||||
| if (!QueryPerformanceFrequency((LARGE_INTEGER *)&g_TicksPerSecond)) | |||||
| if (!QueryPerformanceFrequency((LARGE_INTEGER *)&g_TicksPerSecond)) | |||||
| return false; | return false; | ||||
| if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time)) | if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time)) | ||||
| return false; | return false; | ||||
| @@ -449,7 +449,7 @@ void ImGui_ImplDX11_NewFrame() | |||||
| // Setup time step | // Setup time step | ||||
| INT64 current_time; | INT64 current_time; | ||||
| QueryPerformanceCounter((LARGE_INTEGER *)¤t_time); | |||||
| QueryPerformanceCounter((LARGE_INTEGER *)¤t_time); | |||||
| io.DeltaTime = (float)(current_time - g_Time) / g_TicksPerSecond; | io.DeltaTime = (float)(current_time - g_Time) / g_TicksPerSecond; | ||||
| g_Time = current_time; | g_Time = current_time; | ||||
| @@ -19,7 +19,7 @@ void CreateRenderTarget() | |||||
| g_pSwapChain->GetDesc(&sd); | g_pSwapChain->GetDesc(&sd); | ||||
| // Create the render target | // Create the render target | ||||
| ID3D11Texture2D* pBackBuffer; | |||||
| ID3D11Texture2D* pBackBuffer; | |||||
| D3D11_RENDER_TARGET_VIEW_DESC render_target_view_desc; | D3D11_RENDER_TARGET_VIEW_DESC render_target_view_desc; | ||||
| ZeroMemory(&render_target_view_desc, sizeof(render_target_view_desc)); | ZeroMemory(&render_target_view_desc, sizeof(render_target_view_desc)); | ||||
| render_target_view_desc.Format = sd.BufferDesc.Format; | render_target_view_desc.Format = sd.BufferDesc.Format; | ||||
| @@ -120,20 +120,20 @@ LRESULT ImGui_ImplDX9_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lPara | |||||
| io.MouseDown[0] = true; | io.MouseDown[0] = true; | ||||
| return true; | return true; | ||||
| case WM_LBUTTONUP: | case WM_LBUTTONUP: | ||||
| io.MouseDown[0] = false; | |||||
| io.MouseDown[0] = false; | |||||
| return true; | return true; | ||||
| case WM_RBUTTONDOWN: | case WM_RBUTTONDOWN: | ||||
| io.MouseDown[1] = true; | |||||
| io.MouseDown[1] = true; | |||||
| return true; | return true; | ||||
| case WM_RBUTTONUP: | case WM_RBUTTONUP: | ||||
| io.MouseDown[1] = false; | |||||
| io.MouseDown[1] = false; | |||||
| return true; | return true; | ||||
| case WM_MOUSEWHEEL: | case WM_MOUSEWHEEL: | ||||
| io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; | io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; | ||||
| return true; | return true; | ||||
| case WM_MOUSEMOVE: | case WM_MOUSEMOVE: | ||||
| io.MousePos.x = (signed short)(lParam); | io.MousePos.x = (signed short)(lParam); | ||||
| io.MousePos.y = (signed short)(lParam >> 16); | |||||
| io.MousePos.y = (signed short)(lParam >> 16); | |||||
| return true; | return true; | ||||
| case WM_KEYDOWN: | case WM_KEYDOWN: | ||||
| if (wParam < 256) | if (wParam < 256) | ||||
| @@ -157,7 +157,7 @@ bool ImGui_ImplDX9_Init(void* hwnd, IDirect3DDevice9* device) | |||||
| g_hWnd = (HWND)hwnd; | g_hWnd = (HWND)hwnd; | ||||
| g_pd3dDevice = device; | g_pd3dDevice = device; | ||||
| if (!QueryPerformanceFrequency((LARGE_INTEGER *)&g_TicksPerSecond)) | |||||
| if (!QueryPerformanceFrequency((LARGE_INTEGER *)&g_TicksPerSecond)) | |||||
| return false; | return false; | ||||
| if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time)) | if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time)) | ||||
| return false; | return false; | ||||
| @@ -212,10 +212,10 @@ static void ImGui_ImplDX9_CreateFontsTexture() | |||||
| return; | return; | ||||
| } | } | ||||
| D3DLOCKED_RECT tex_locked_rect; | D3DLOCKED_RECT tex_locked_rect; | ||||
| if (pTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK) | |||||
| { | |||||
| IM_ASSERT(0); | |||||
| return; | |||||
| if (pTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK) | |||||
| { | |||||
| IM_ASSERT(0); | |||||
| return; | |||||
| } | } | ||||
| for (int y = 0; y < height; y++) | for (int y = 0; y < height; y++) | ||||
| memcpy((unsigned char *)tex_locked_rect.pBits + tex_locked_rect.Pitch * y, pixels + (width * bytes_per_pixel) * y, (width * bytes_per_pixel)); | memcpy((unsigned char *)tex_locked_rect.pBits + tex_locked_rect.Pitch * y, pixels + (width * bytes_per_pixel) * y, (width * bytes_per_pixel)); | ||||
| @@ -267,7 +267,7 @@ void ImGui_ImplDX9_NewFrame() | |||||
| // Setup time step | // Setup time step | ||||
| INT64 current_time; | INT64 current_time; | ||||
| QueryPerformanceCounter((LARGE_INTEGER *)¤t_time); | |||||
| QueryPerformanceCounter((LARGE_INTEGER *)¤t_time); | |||||
| io.DeltaTime = (float)(current_time - g_Time) / g_TicksPerSecond; | io.DeltaTime = (float)(current_time - g_Time) / g_TicksPerSecond; | ||||
| g_Time = current_time; | g_Time = current_time; | ||||
| @@ -7,7 +7,7 @@ extern "C" { | |||||
| /* | /* | ||||
| ** Copyright (c) 2007-2012 The Khronos Group Inc. | ** Copyright (c) 2007-2012 The Khronos Group Inc. | ||||
| ** | |||||
| ** | |||||
| ** Permission is hereby granted, free of charge, to any person obtaining a | ** Permission is hereby granted, free of charge, to any person obtaining a | ||||
| ** copy of this software and/or associated documentation files (the | ** copy of this software and/or associated documentation files (the | ||||
| ** "Materials"), to deal in the Materials without restriction, including | ** "Materials"), to deal in the Materials without restriction, including | ||||
| @@ -15,10 +15,10 @@ extern "C" { | |||||
| ** distribute, sublicense, and/or sell copies of the Materials, and to | ** distribute, sublicense, and/or sell copies of the Materials, and to | ||||
| ** permit persons to whom the Materials are furnished to do so, subject to | ** permit persons to whom the Materials are furnished to do so, subject to | ||||
| ** the following conditions: | ** the following conditions: | ||||
| ** | |||||
| ** | |||||
| ** The above copyright notice and this permission notice shall be included | ** The above copyright notice and this permission notice shall be included | ||||
| ** in all copies or substantial portions of the Materials. | ** in all copies or substantial portions of the Materials. | ||||
| ** | |||||
| ** | |||||
| ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||
| ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
| ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||||
| @@ -48,10 +48,10 @@ static void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawList** const cmd_lists, int | |||||
| const float height = ImGui::GetIO().DisplaySize.y; | const float height = ImGui::GetIO().DisplaySize.y; | ||||
| const float ortho_projection[4][4] = | const float ortho_projection[4][4] = | ||||
| { | { | ||||
| { 2.0f/width, 0.0f, 0.0f, 0.0f }, | |||||
| { 0.0f, 2.0f/-height, 0.0f, 0.0f }, | |||||
| { 0.0f, 0.0f, -1.0f, 0.0f }, | |||||
| { -1.0f, 1.0f, 0.0f, 1.0f }, | |||||
| { 2.0f/width, 0.0f, 0.0f, 0.0f }, | |||||
| { 0.0f, 2.0f/-height, 0.0f, 0.0f }, | |||||
| { 0.0f, 0.0f, -1.0f, 0.0f }, | |||||
| { -1.0f, 1.0f, 0.0f, 1.0f }, | |||||
| }; | }; | ||||
| glUseProgram(g_ShaderHandle); | glUseProgram(g_ShaderHandle); | ||||
| glUniform1i(g_AttribLocationTex, 0); | glUniform1i(g_AttribLocationTex, 0); | ||||
| @@ -183,9 +183,9 @@ bool ImGui_ImplGlfwGL3_CreateDeviceObjects() | |||||
| "out vec4 Frag_Color;\n" | "out vec4 Frag_Color;\n" | ||||
| "void main()\n" | "void main()\n" | ||||
| "{\n" | "{\n" | ||||
| " Frag_UV = UV;\n" | |||||
| " Frag_Color = Color;\n" | |||||
| " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" | |||||
| " Frag_UV = UV;\n" | |||||
| " Frag_Color = Color;\n" | |||||
| " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" | |||||
| "}\n"; | "}\n"; | ||||
| const GLchar* fragment_shader = | const GLchar* fragment_shader = | ||||
| @@ -196,7 +196,7 @@ bool ImGui_ImplGlfwGL3_CreateDeviceObjects() | |||||
| "out vec4 Out_Color;\n" | "out vec4 Out_Color;\n" | ||||
| "void main()\n" | "void main()\n" | ||||
| "{\n" | "{\n" | ||||
| " Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n" | |||||
| " Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n" | |||||
| "}\n"; | "}\n"; | ||||
| g_ShaderHandle = glCreateProgram(); | g_ShaderHandle = glCreateProgram(); | ||||
| @@ -331,15 +331,15 @@ void ImGui_ImplGlfwGL3_NewFrame() | |||||
| // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) | // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) | ||||
| if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED)) | if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED)) | ||||
| { | { | ||||
| double mouse_x, mouse_y; | |||||
| glfwGetCursorPos(g_Window, &mouse_x, &mouse_y); | |||||
| mouse_x *= (float)display_w / w; // Convert mouse coordinates to pixels | |||||
| mouse_y *= (float)display_h / h; | |||||
| io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) | |||||
| double mouse_x, mouse_y; | |||||
| glfwGetCursorPos(g_Window, &mouse_x, &mouse_y); | |||||
| mouse_x *= (float)display_w / w; // Convert mouse coordinates to pixels | |||||
| mouse_y *= (float)display_h / h; | |||||
| io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| io.MousePos = ImVec2(-1,-1); | |||||
| io.MousePos = ImVec2(-1,-1); | |||||
| } | } | ||||
| for (int i = 0; i < 3; i++) | for (int i = 0; i < 3; i++) | ||||
| @@ -71,7 +71,7 @@ int main(int, char**) | |||||
| ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver); | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver); | ||||
| ImGui::ShowTestWindow(&show_test_window); | ImGui::ShowTestWindow(&show_test_window); | ||||
| } | } | ||||
| // Rendering | // Rendering | ||||
| glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); | glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); | ||||
| glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); | ||||
| @@ -235,17 +235,17 @@ void ImGui_ImplGlfw_NewFrame() | |||||
| // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) | // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) | ||||
| if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED)) | if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED)) | ||||
| { | { | ||||
| double mouse_x, mouse_y; | |||||
| glfwGetCursorPos(g_Window, &mouse_x, &mouse_y); | |||||
| mouse_x *= (float)display_w / w; // Convert mouse coordinates to pixels | |||||
| mouse_y *= (float)display_h / h; | |||||
| io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) | |||||
| double mouse_x, mouse_y; | |||||
| glfwGetCursorPos(g_Window, &mouse_x, &mouse_y); | |||||
| mouse_x *= (float)display_w / w; // Convert mouse coordinates to pixels | |||||
| mouse_y *= (float)display_h / h; | |||||
| io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| io.MousePos = ImVec2(-1,-1); | |||||
| io.MousePos = ImVec2(-1,-1); | |||||
| } | } | ||||
| for (int i = 0; i < 3; i++) | for (int i = 0; i < 3; i++) | ||||
| { | { | ||||
| io.MouseDown[i] = g_MousePressed[i] || glfwGetMouseButton(g_Window, i) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. | io.MouseDown[i] = g_MousePressed[i] || glfwGetMouseButton(g_Window, i) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. | ||||
| @@ -47,7 +47,7 @@ typedef int ImGuiMouseCursor; // enum ImGuiMouseCursor_ | |||||
| typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_ | typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_ | ||||
| typedef int ImGuiSetCond; // enum ImGuiSetCondition_ | typedef int ImGuiSetCond; // enum ImGuiSetCondition_ | ||||
| typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_ | typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_ | ||||
| struct ImGuiTextEditCallbackData; // for advanced uses of InputText() | |||||
| struct ImGuiTextEditCallbackData; // for advanced uses of InputText() | |||||
| typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data); | typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data); | ||||
| struct ImVec2 | struct ImVec2 | ||||
| @@ -79,7 +79,7 @@ namespace ImGui | |||||
| IMGUI_API void MemFree(void* ptr); | IMGUI_API void MemFree(void* ptr); | ||||
| } | } | ||||
| // std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug). | |||||
| // std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug). | |||||
| // Use '#define ImVector std::vector' if you want to use the STL type or your own type. | // Use '#define ImVector std::vector' if you want to use the STL type or your own type. | ||||
| // Our implementation does NOT call c++ constructors! because the data types we use don't need them (but that could be added as well). Only provide the minimum functionalities we need. | // Our implementation does NOT call c++ constructors! because the data types we use don't need them (but that could be added as well). Only provide the minimum functionalities we need. | ||||
| #ifndef ImVector | #ifndef ImVector | ||||
| @@ -120,14 +120,14 @@ public: | |||||
| inline void swap(ImVector<T>& rhs) { const size_t rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; const size_t rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } | inline void swap(ImVector<T>& rhs) { const size_t rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; const size_t rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } | ||||
| inline void resize(size_t new_size) { if (new_size > Capacity) reserve(new_size); Size = new_size; } | inline void resize(size_t new_size) { if (new_size > Capacity) reserve(new_size); Size = new_size; } | ||||
| inline void reserve(size_t new_capacity) | |||||
| { | |||||
| inline void reserve(size_t new_capacity) | |||||
| { | |||||
| if (new_capacity <= Capacity) return; | if (new_capacity <= Capacity) return; | ||||
| T* new_data = (value_type*)ImGui::MemAlloc(new_capacity * sizeof(value_type)); | T* new_data = (value_type*)ImGui::MemAlloc(new_capacity * sizeof(value_type)); | ||||
| memcpy(new_data, Data, Size * sizeof(value_type)); | memcpy(new_data, Data, Size * sizeof(value_type)); | ||||
| ImGui::MemFree(Data); | ImGui::MemFree(Data); | ||||
| Data = new_data; | Data = new_data; | ||||
| Capacity = new_capacity; | |||||
| Capacity = new_capacity; | |||||
| } | } | ||||
| inline void push_back(const value_type& v) { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; } | inline void push_back(const value_type& v) { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; } | ||||
| @@ -268,7 +268,7 @@ namespace ImGui | |||||
| IMGUI_API void TextWrapped(const char* fmt, ...); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos(); | IMGUI_API void TextWrapped(const char* fmt, ...); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos(); | ||||
| IMGUI_API void TextWrappedV(const char* fmt, va_list args); | IMGUI_API void TextWrappedV(const char* fmt, va_list args); | ||||
| IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text. | IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text. | ||||
| IMGUI_API void LabelText(const char* label, const char* fmt, ...); // display text+label aligned the same way as value+label widgets | |||||
| IMGUI_API void LabelText(const char* label, const char* fmt, ...); // display text+label aligned the same way as value+label widgets | |||||
| IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args); | IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args); | ||||
| IMGUI_API void Bullet(); | IMGUI_API void Bullet(); | ||||
| IMGUI_API void BulletText(const char* fmt, ...); | IMGUI_API void BulletText(const char* fmt, ...); | ||||
| @@ -355,7 +355,7 @@ namespace ImGui | |||||
| IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse? | IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse? | ||||
| IMGUI_API bool IsItemHoveredRectOnly(); // was the last item hovered by mouse? even if another item is active while we are hovering this. | IMGUI_API bool IsItemHoveredRectOnly(); // was the last item hovered by mouse? even if another item is active while we are hovering this. | ||||
| IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) | IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) | ||||
| IMGUI_API bool IsAnyItemActive(); // | |||||
| IMGUI_API bool IsAnyItemActive(); // | |||||
| IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item | IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item | ||||
| IMGUI_API ImVec2 GetItemRectMax(); // " | IMGUI_API ImVec2 GetItemRectMax(); // " | ||||
| IMGUI_API ImVec2 GetItemRectSize(); // " | IMGUI_API ImVec2 GetItemRectSize(); // " | ||||
| @@ -611,9 +611,9 @@ struct ImGuiIO | |||||
| // User Functions | // User Functions | ||||
| //------------------------------------------------------------------ | //------------------------------------------------------------------ | ||||
| // REQUIRED: rendering function. | |||||
| // REQUIRED: rendering function. | |||||
| // See example code if you are unsure of how to implement this. | // See example code if you are unsure of how to implement this. | ||||
| void (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count); | |||||
| void (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count); | |||||
| // Optional: access OS clipboard | // Optional: access OS clipboard | ||||
| // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) | // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) | ||||
| @@ -636,7 +636,7 @@ struct ImGuiIO | |||||
| ImVec2 MousePos; // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) | ImVec2 MousePos; // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) | ||||
| bool MouseDown[5]; // Mouse buttons. ImGui itself only uses button 0 (left button). Others buttons allows to track if mouse is being used by your application + available to user as a convenience via IsMouse** API. | bool MouseDown[5]; // Mouse buttons. ImGui itself only uses button 0 (left button). Others buttons allows to track if mouse is being used by your application + available to user as a convenience via IsMouse** API. | ||||
| float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text. | |||||
| float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text. | |||||
| bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). | bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). | ||||
| bool KeyCtrl; // Keyboard modifier pressed: Control | bool KeyCtrl; // Keyboard modifier pressed: Control | ||||
| bool KeyShift; // Keyboard modifier pressed: Shift | bool KeyShift; // Keyboard modifier pressed: Shift | ||||
| @@ -749,13 +749,13 @@ struct ImGuiTextBuffer | |||||
| // - You want to store custom debug data easily without adding or editing structures in your code. | // - You want to store custom debug data easily without adding or editing structures in your code. | ||||
| struct ImGuiStorage | struct ImGuiStorage | ||||
| { | { | ||||
| struct Pair | |||||
| { | |||||
| ImGuiID key; | |||||
| union { int val_i; float val_f; void* val_p; }; | |||||
| Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; } | |||||
| Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } | |||||
| Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } | |||||
| struct Pair | |||||
| { | |||||
| ImGuiID key; | |||||
| union { int val_i; float val_f; void* val_p; }; | |||||
| Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; } | |||||
| Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } | |||||
| Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } | |||||
| }; | }; | ||||
| ImVector<Pair> Data; | ImVector<Pair> Data; | ||||
| @@ -770,7 +770,7 @@ struct ImGuiStorage | |||||
| IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL | IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL | ||||
| IMGUI_API void SetVoidPtr(ImGuiID key, void* val); | IMGUI_API void SetVoidPtr(ImGuiID key, void* val); | ||||
| // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. | |||||
| // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. | |||||
| // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. | // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. | ||||
| // - A typical use case where this is convenient: | // - A typical use case where this is convenient: | ||||
| // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; | // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; | ||||
| @@ -876,7 +876,7 @@ struct ImDrawList | |||||
| // [Internal to ImGui] | // [Internal to ImGui] | ||||
| ImVector<ImVec4> clip_rect_stack; // [Internal] | ImVector<ImVec4> clip_rect_stack; // [Internal] | ||||
| ImVector<ImTextureID> texture_id_stack; // [Internal] | |||||
| ImVector<ImTextureID> texture_id_stack; // [Internal] | |||||
| ImDrawVert* vtx_write; // [Internal] point within vtx_buffer after each add command (to avoid using the ImVector<> operators too much) | ImDrawVert* vtx_write; // [Internal] point within vtx_buffer after each add command (to avoid using the ImVector<> operators too much) | ||||
| ImDrawList() { Clear(); } | ImDrawList() { Clear(); } | ||||
| @@ -888,7 +888,7 @@ struct ImDrawList | |||||
| IMGUI_API void PushTextureID(const ImTextureID& texture_id); | IMGUI_API void PushTextureID(const ImTextureID& texture_id); | ||||
| IMGUI_API void PopTextureID(); | IMGUI_API void PopTextureID(); | ||||
| // Primitives | |||||
| // Primitives | |||||
| IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float half_thickness = 0.50f); | IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float half_thickness = 0.50f); | ||||
| IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F); | IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F); | ||||
| IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F); | IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F); | ||||
| @@ -386,7 +386,7 @@ static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int widt | |||||
| } | } | ||||
| } | } | ||||
| tail = tail->next; | tail = tail->next; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| fr.prev_link = best; | fr.prev_link = best; | ||||
| @@ -13,7 +13,7 @@ | |||||
| // texts, as its performance does not scale and it has limited undo). | // texts, as its performance does not scale and it has limited undo). | ||||
| // | // | ||||
| // Non-trivial behaviors are modelled after Windows text controls. | // Non-trivial behaviors are modelled after Windows text controls. | ||||
| // | |||||
| // | |||||
| // | // | ||||
| // LICENSE | // LICENSE | ||||
| // | // | ||||
| @@ -192,20 +192,20 @@ | |||||
| // call this with the mouse x,y on a mouse down; it will update the cursor | // call this with the mouse x,y on a mouse down; it will update the cursor | ||||
| // and reset the selection start/end to the cursor point. the x,y must | // and reset the selection start/end to the cursor point. the x,y must | ||||
| // be relative to the text widget, with (0,0) being the top left. | // be relative to the text widget, with (0,0) being the top left. | ||||
| // | |||||
| // | |||||
| // drag: | // drag: | ||||
| // call this with the mouse x,y on a mouse drag/up; it will update the | // call this with the mouse x,y on a mouse drag/up; it will update the | ||||
| // cursor and the selection end point | // cursor and the selection end point | ||||
| // | |||||
| // | |||||
| // cut: | // cut: | ||||
| // call this to delete the current selection; returns true if there was | // call this to delete the current selection; returns true if there was | ||||
| // one. you should FIRST copy the current selection to the system paste buffer. | // one. you should FIRST copy the current selection to the system paste buffer. | ||||
| // (To copy, just copy the current selection out of the string yourself.) | // (To copy, just copy the current selection out of the string yourself.) | ||||
| // | |||||
| // | |||||
| // paste: | // paste: | ||||
| // call this to paste text at the current cursor point or over the current | // call this to paste text at the current cursor point or over the current | ||||
| // selection if there is one. | // selection if there is one. | ||||
| // | |||||
| // | |||||
| // key: | // key: | ||||
| // call this for keyboard inputs sent to the textfield. you can use it | // call this for keyboard inputs sent to the textfield. you can use it | ||||
| // for "key down" events or for "translated" key events. if you need to | // for "key down" events or for "translated" key events. if you need to | ||||
| @@ -214,7 +214,7 @@ | |||||
| // various definitions like STB_TEXTEDIT_K_LEFT have the is-key-event bit | // various definitions like STB_TEXTEDIT_K_LEFT have the is-key-event bit | ||||
| // set, and make STB_TEXTEDIT_KEYTOCHAR check that the is-key-event bit is | // set, and make STB_TEXTEDIT_KEYTOCHAR check that the is-key-event bit is | ||||
| // clear. | // clear. | ||||
| // | |||||
| // | |||||
| // When rendering, you can read the cursor position and selection state from | // When rendering, you can read the cursor position and selection state from | ||||
| // the STB_TexteditState. | // the STB_TexteditState. | ||||
| // | // | ||||
| @@ -699,7 +699,7 @@ retry: | |||||
| state->insert_mode = !state->insert_mode; | state->insert_mode = !state->insert_mode; | ||||
| break; | break; | ||||
| #endif | #endif | ||||
| case STB_TEXTEDIT_K_UNDO: | case STB_TEXTEDIT_K_UNDO: | ||||
| stb_text_undo(str, state); | stb_text_undo(str, state); | ||||
| state->has_preferred_x = 0; | state->has_preferred_x = 0; | ||||
| @@ -714,7 +714,7 @@ retry: | |||||
| // if currently there's a selection, move cursor to start of selection | // if currently there's a selection, move cursor to start of selection | ||||
| if (STB_TEXT_HAS_SELECTION(state)) | if (STB_TEXT_HAS_SELECTION(state)) | ||||
| stb_textedit_move_to_first(state); | stb_textedit_move_to_first(state); | ||||
| else | |||||
| else | |||||
| if (state->cursor > 0) | if (state->cursor > 0) | ||||
| --state->cursor; | --state->cursor; | ||||
| state->has_preferred_x = 0; | state->has_preferred_x = 0; | ||||
| @@ -751,7 +751,7 @@ retry: | |||||
| break; | break; | ||||
| case STB_TEXTEDIT_K_WORDRIGHT: | case STB_TEXTEDIT_K_WORDRIGHT: | ||||
| if (STB_TEXT_HAS_SELECTION(state)) | |||||
| if (STB_TEXT_HAS_SELECTION(state)) | |||||
| stb_textedit_move_to_last(str, state); | stb_textedit_move_to_last(str, state); | ||||
| else { | else { | ||||
| state->cursor = stb_textedit_move_to_word_next(str, state); | state->cursor = stb_textedit_move_to_word_next(str, state); | ||||
| @@ -839,7 +839,7 @@ retry: | |||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case STB_TEXTEDIT_K_UP: | case STB_TEXTEDIT_K_UP: | ||||
| case STB_TEXTEDIT_K_UP | STB_TEXTEDIT_K_SHIFT: { | case STB_TEXTEDIT_K_UP | STB_TEXTEDIT_K_SHIFT: { | ||||
| StbFindState find; | StbFindState find; | ||||
| @@ -916,7 +916,7 @@ retry: | |||||
| } | } | ||||
| state->has_preferred_x = 0; | state->has_preferred_x = 0; | ||||
| break; | break; | ||||
| case STB_TEXTEDIT_K_TEXTSTART: | case STB_TEXTEDIT_K_TEXTSTART: | ||||
| state->cursor = state->select_start = state->select_end = 0; | state->cursor = state->select_start = state->select_end = 0; | ||||
| state->has_preferred_x = 0; | state->has_preferred_x = 0; | ||||
| @@ -927,7 +927,7 @@ retry: | |||||
| state->select_start = state->select_end = 0; | state->select_start = state->select_end = 0; | ||||
| state->has_preferred_x = 0; | state->has_preferred_x = 0; | ||||
| break; | break; | ||||
| case STB_TEXTEDIT_K_TEXTSTART | STB_TEXTEDIT_K_SHIFT: | case STB_TEXTEDIT_K_TEXTSTART | STB_TEXTEDIT_K_SHIFT: | ||||
| stb_textedit_prep_selection_at_cursor(state); | stb_textedit_prep_selection_at_cursor(state); | ||||
| state->cursor = state->select_end = 0; | state->cursor = state->select_end = 0; | ||||
| @@ -28,7 +28,7 @@ | |||||
| // "Zer" on mollyrocket (with fix) | // "Zer" on mollyrocket (with fix) | ||||
| // Cass Everitt | // Cass Everitt | ||||
| // stoiko (Haemimont Games) | // stoiko (Haemimont Games) | ||||
| // Brian Hook | |||||
| // Brian Hook | |||||
| // Walter van Niftrik | // Walter van Niftrik | ||||
| // David Gow | // David Gow | ||||
| // David Given | // David Given | ||||
| @@ -209,7 +209,7 @@ | |||||
| // Curve tesselation 120 LOC \__ 550 LOC Bitmap creation | // Curve tesselation 120 LOC \__ 550 LOC Bitmap creation | ||||
| // Bitmap management 100 LOC / | // Bitmap management 100 LOC / | ||||
| // Baked bitmap interface 70 LOC / | // Baked bitmap interface 70 LOC / | ||||
| // Font name matching & access 150 LOC ---- 150 | |||||
| // Font name matching & access 150 LOC ---- 150 | |||||
| // C runtime library abstraction 60 LOC ---- 60 | // C runtime library abstraction 60 LOC ---- 60 | ||||
| @@ -293,7 +293,7 @@ int main(int argc, char **argv) | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| #endif | |||||
| #endif | |||||
| // | // | ||||
| // Output: | // Output: | ||||
| // | // | ||||
| @@ -307,9 +307,9 @@ int main(int argc, char **argv) | |||||
| // :@@. M@M | // :@@. M@M | ||||
| // @@@o@@@@ | // @@@o@@@@ | ||||
| // :M@@V:@@. | // :M@@V:@@. | ||||
| // | |||||
| // | |||||
| ////////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////////// | ||||
| // | |||||
| // | |||||
| // Complete program: print "Hello World!" banner, with bugs | // Complete program: print "Hello World!" banner, with bugs | ||||
| // | // | ||||
| #if 0 | #if 0 | ||||
| @@ -555,7 +555,7 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, stbtt_fo | |||||
| STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); | STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); | ||||
| // Those functions are called by stbtt_PackFontRanges(). If you want to | // Those functions are called by stbtt_PackFontRanges(). If you want to | ||||
| // pack multiple fonts or custom data into a same texture, you may copy | // pack multiple fonts or custom data into a same texture, you may copy | ||||
| // the contents of stbtt_PackFontRanges() and create a custom version | |||||
| // the contents of stbtt_PackFontRanges() and create a custom version | |||||
| // using those functions. | // using those functions. | ||||
| STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample); | STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample); | ||||
| @@ -1296,7 +1296,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s | |||||
| if (i != 0) | if (i != 0) | ||||
| num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy); | num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy); | ||||
| // now start the new one | |||||
| // now start the new one | |||||
| start_off = !(flags & 1); | start_off = !(flags & 1); | ||||
| if (start_off) { | if (start_off) { | ||||
| // if we start off with an off-curve point, then when we need to find a point on the curve | // if we start off with an off-curve point, then when we need to find a point on the curve | ||||
| @@ -1349,7 +1349,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s | |||||
| int comp_num_verts = 0, i; | int comp_num_verts = 0, i; | ||||
| stbtt_vertex *comp_verts = 0, *tmp = 0; | stbtt_vertex *comp_verts = 0, *tmp = 0; | ||||
| float mtx[6] = {1,0,0,1,0,0}, m, n; | float mtx[6] = {1,0,0,1,0,0}, m, n; | ||||
| flags = ttSHORT(comp); comp+=2; | flags = ttSHORT(comp); comp+=2; | ||||
| gidx = ttSHORT(comp); comp+=2; | gidx = ttSHORT(comp); comp+=2; | ||||
| @@ -1379,7 +1379,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s | |||||
| mtx[2] = ttSHORT(comp)/16384.0f; comp+=2; | mtx[2] = ttSHORT(comp)/16384.0f; comp+=2; | ||||
| mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; | mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; | ||||
| } | } | ||||
| // Find transformation scales. | // Find transformation scales. | ||||
| m = (float) STBTT_sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]); | m = (float) STBTT_sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]); | ||||
| n = (float) STBTT_sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]); | n = (float) STBTT_sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]); | ||||
| @@ -1626,7 +1626,7 @@ static void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__ac | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| e = e->next; | e = e->next; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1916,7 +1916,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info | |||||
| { | { | ||||
| int ix0,iy0,ix1,iy1; | int ix0,iy0,ix1,iy1; | ||||
| stbtt__bitmap gbm; | stbtt__bitmap gbm; | ||||
| stbtt_vertex *vertices; | |||||
| stbtt_vertex *vertices; | |||||
| int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); | int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); | ||||
| if (scale_x == 0) scale_x = scale_y; | if (scale_x == 0) scale_x = scale_y; | ||||
| @@ -1936,7 +1936,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info | |||||
| if (height) *height = gbm.h; | if (height) *height = gbm.h; | ||||
| if (xoff ) *xoff = ix0; | if (xoff ) *xoff = ix0; | ||||
| if (yoff ) *yoff = iy0; | if (yoff ) *yoff = iy0; | ||||
| if (gbm.w && gbm.h) { | if (gbm.w && gbm.h) { | ||||
| gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata); | gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata); | ||||
| if (gbm.pixels) { | if (gbm.pixels) { | ||||
| @@ -1947,7 +1947,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info | |||||
| } | } | ||||
| STBTT_free(vertices, info->userdata); | STBTT_free(vertices, info->userdata); | ||||
| return gbm.pixels; | return gbm.pixels; | ||||
| } | |||||
| } | |||||
| STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff) | STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff) | ||||
| { | { | ||||
| @@ -1959,7 +1959,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigne | |||||
| int ix0,iy0; | int ix0,iy0; | ||||
| stbtt_vertex *vertices; | stbtt_vertex *vertices; | ||||
| int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); | int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); | ||||
| stbtt__bitmap gbm; | |||||
| stbtt__bitmap gbm; | |||||
| stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,0,0); | stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,0,0); | ||||
| gbm.pixels = output; | gbm.pixels = output; | ||||
| @@ -1981,7 +1981,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char * | |||||
| STBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff) | STBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff) | ||||
| { | { | ||||
| return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff); | return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff); | ||||
| } | |||||
| } | |||||
| STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint) | STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint) | ||||
| { | { | ||||
| @@ -1991,7 +1991,7 @@ STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, uns | |||||
| STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff) | STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff) | ||||
| { | { | ||||
| return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f,0.0f, codepoint, width,height,xoff,yoff); | return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f,0.0f, codepoint, width,height,xoff,yoff); | ||||
| } | |||||
| } | |||||
| STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint) | STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint) | ||||
| { | { | ||||
| @@ -2120,7 +2120,7 @@ static void stbrp_init_target(stbrp_context *con, int pw, int ph, stbrp_node *no | |||||
| con->y = 0; | con->y = 0; | ||||
| con->bottom_y = 0; | con->bottom_y = 0; | ||||
| STBTT__NOTUSED(nodes); | STBTT__NOTUSED(nodes); | ||||
| STBTT__NOTUSED(num_nodes); | |||||
| STBTT__NOTUSED(num_nodes); | |||||
| } | } | ||||
| static void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int num_rects) | static void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int num_rects) | ||||
| @@ -2332,8 +2332,8 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, stbtt_fon | |||||
| float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh); | float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh); | ||||
| for (j=0; j < ranges[i].num_chars_in_range; ++j) { | for (j=0; j < ranges[i].num_chars_in_range; ++j) { | ||||
| int x0,y0,x1,y1; | int x0,y0,x1,y1; | ||||
| int glyph = stbtt_FindGlyphIndex(info,ranges[i].first_unicode_char_in_range + j); | |||||
| if (glyph) { | |||||
| int glyph = stbtt_FindGlyphIndex(info,ranges[i].first_unicode_char_in_range + j); | |||||
| if (glyph) { | |||||
| stbtt_GetGlyphBitmapBoxSubpixel(info,glyph, | stbtt_GetGlyphBitmapBoxSubpixel(info,glyph, | ||||
| scale * spc->h_oversample, | scale * spc->h_oversample, | ||||
| scale * spc->v_oversample, | scale * spc->v_oversample, | ||||
| @@ -2341,10 +2341,10 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, stbtt_fon | |||||
| &x0,&y0,&x1,&y1); | &x0,&y0,&x1,&y1); | ||||
| rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1); | rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1); | ||||
| rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1); | rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1); | ||||
| } else { | |||||
| } else { | |||||
| rects[k].w = rects[k].h = 1; | rects[k].w = rects[k].h = 1; | ||||
| } | } | ||||
| ++k; | |||||
| ++k; | |||||
| } | } | ||||
| } | } | ||||
| @@ -2440,7 +2440,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontd | |||||
| n = 0; | n = 0; | ||||
| for (i=0; i < num_ranges; ++i) | for (i=0; i < num_ranges; ++i) | ||||
| n += ranges[i].num_chars_in_range; | n += ranges[i].num_chars_in_range; | ||||
| rects = (stbrp_rect *) STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context); | rects = (stbrp_rect *) STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context); | ||||
| if (rects == NULL) | if (rects == NULL) | ||||
| return 0; | return 0; | ||||
| @@ -2450,7 +2450,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontd | |||||
| n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects); | n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects); | ||||
| stbrp_pack_rects(context, rects, n); | stbrp_pack_rects(context, rects, n); | ||||
| return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects); | return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects); | ||||
| return return_value; | return return_value; | ||||
| @@ -2501,7 +2501,7 @@ STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, i | |||||
| // | // | ||||
| // check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string | // check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string | ||||
| static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) | |||||
| static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) | |||||
| { | { | ||||
| stbtt_int32 i=0; | stbtt_int32 i=0; | ||||
| @@ -2540,7 +2540,7 @@ static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 | |||||
| return i; | return i; | ||||
| } | } | ||||
| STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2) | |||||
| STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2) | |||||
| { | { | ||||
| return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((const stbtt_uint8*) s1, len1, (const stbtt_uint8*) s2, len2); | return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((const stbtt_uint8*) s1, len1, (const stbtt_uint8*) s2, len2); | ||||
| } | } | ||||
| @@ -279,7 +279,7 @@ struct vec_t<T,2> | |||||
| { | { | ||||
| struct { T x, y; }; /* axis */ | struct { T x, y; }; /* axis */ | ||||
| struct { T r, g; }; /* red, green */ | struct { T r, g; }; /* red, green */ | ||||
| struct { T s, t; }; | |||||
| struct { T s, t; }; | |||||
| #if !_DOXYGEN_SKIP_ME | #if !_DOXYGEN_SKIP_ME | ||||
| vec_t<T, 2, 9000> const xx, rr, ss/**/, ww; | vec_t<T, 2, 9000> const xx, rr, ss/**/, ww; | ||||
| @@ -83,7 +83,7 @@ void BaseThreadManager::StopThreads(int nb) | |||||
| ThreadJob stop_job(ThreadJobType::THREAD_STOP); | ThreadJob stop_job(ThreadJobType::THREAD_STOP); | ||||
| for (int i = 0; i < nb; i++) | for (int i = 0; i < nb; i++) | ||||
| m_jobqueue.push(&stop_job); | m_jobqueue.push(&stop_job); | ||||
| //... Wait for them to quit. | //... Wait for them to quit. | ||||
| for (int i = 0; i < nb; i++) | for (int i = 0; i < nb; i++) | ||||
| m_donequeue.pop(); | m_donequeue.pop(); | ||||
| @@ -49,7 +49,7 @@ public: | |||||
| /* Old style: path to PNG file */ | /* Old style: path to PNG file */ | ||||
| TileSet(char const *path, ivec2 size, ivec2 count); | TileSet(char const *path, ivec2 size, ivec2 count); | ||||
| TileSet(char const *path, Image* image, ivec2 size, ivec2 count); | TileSet(char const *path, Image* image, ivec2 size, ivec2 count); | ||||
| virtual ~TileSet(); | virtual ~TileSet(); | ||||
| protected: | protected: | ||||