From 7f804d3d6451707a98a94b8bb7f66e9acdbcc799 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 30 Nov 2014 16:56:35 +0000 Subject: [PATCH] Tab->Spaces :( visual studio can't even be trusted for that, oh thanks. --- examples/directx11_example/main.cpp | 44 ++++++++++++++--------------- imgui.cpp | 22 +++++++-------- imgui.h | 22 +++++++-------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index cf8ac106..1923f644 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -14,24 +14,24 @@ extern const char* vertexShader; // Implemented at the bottom extern const char* pixelShader; -static HWND hWnd; -static ID3D11Device* g_pd3dDevice = NULL; -static ID3D11DeviceContext* g_pd3dDeviceImmediateContext = NULL; -static IDXGISwapChain* g_pSwapChain = NULL; -static ID3D11Buffer* g_pVB = NULL; -static ID3D11RenderTargetView* g_mainRenderTargetView; +static HWND hWnd; +static ID3D11Device* g_pd3dDevice = NULL; +static ID3D11DeviceContext* g_pd3dDeviceImmediateContext = NULL; +static IDXGISwapChain* g_pSwapChain = NULL; +static ID3D11Buffer* g_pVB = NULL; +static ID3D11RenderTargetView* g_mainRenderTargetView; -static ID3D10Blob * g_pVertexShaderBlob = NULL; -static ID3D11VertexShader* g_pVertexShader = NULL; -static ID3D11InputLayout* g_pInputLayout = NULL; -static ID3D11Buffer* g_pVertexConstantBuffer = NULL; +static ID3D10Blob * g_pVertexShaderBlob = NULL; +static ID3D11VertexShader* g_pVertexShader = NULL; +static ID3D11InputLayout* g_pInputLayout = NULL; +static ID3D11Buffer* g_pVertexConstantBuffer = NULL; -static ID3D10Blob * g_pPixelShaderBlob = NULL; -static ID3D11PixelShader* g_pPixelShader = NULL; +static ID3D10Blob * g_pPixelShaderBlob = NULL; +static ID3D11PixelShader* g_pPixelShader = NULL; static ID3D11ShaderResourceView*g_pFontTextureView = NULL; -static ID3D11SamplerState* g_pFontSampler = NULL; -static ID3D11BlendState* g_blendState = NULL; +static ID3D11SamplerState* g_pFontSampler = NULL; +static ID3D11BlendState* g_blendState = NULL; struct CUSTOMVERTEX { @@ -92,10 +92,10 @@ static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_c const float T = 0.5f; const float mvp[4][4] = { - { 2.0f/(R-L), 0.0f, 0.0f, 0.0f}, - { 0.0f, 2.0f/(T-B), 0.0f, 0.0f,}, - { 0.0f, 0.0f, 0.5f, 0.0f }, // -1.0f - { (R+L)/(L-R), (T+B)/(B-T), 0.5f, 1.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, 0.0f, 0.5f, 0.0f }, + { (R+L)/(L-R), (T+B)/(B-T), 0.5f, 1.0f }, }; memcpy(&pConstantBuffer->mvp, mvp, sizeof(mvp)); g_pd3dDeviceImmediateContext->Unmap(g_pVertexConstantBuffer, 0); @@ -143,7 +143,7 @@ static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_c { const ImDrawCmd* pcmd = &cmd_list->commands[cmd_i]; 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_pd3dDeviceImmediateContext->RSSetScissorRects(1, &r); + g_pd3dDeviceImmediateContext->RSSetScissorRects(1, &r); g_pd3dDeviceImmediateContext->Draw(pcmd->vtx_count, vtx_offset); vtx_offset += pcmd->vtx_count; } @@ -203,15 +203,15 @@ HRESULT InitD3D(HWND hWnd) else RSDesc.MultisampleEnable = FALSE; - ID3D11RasterizerState* pRState = NULL; + ID3D11RasterizerState* pRState = NULL; g_pd3dDevice->CreateRasterizerState(&RSDesc, &pRState); g_pd3dDeviceImmediateContext->RSSetState(pRState); - pRState->Release(); + pRState->Release(); } // Create the render target { - ID3D11Texture2D* pBackBuffer; + ID3D11Texture2D* pBackBuffer; D3D11_RENDER_TARGET_VIEW_DESC render_target_view_desc; ZeroMemory(&render_target_view_desc, sizeof(render_target_view_desc)); render_target_view_desc.Format = sd.BufferDesc.Format; diff --git a/imgui.cpp b/imgui.cpp index 059c36cf..08787b2c 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4143,7 +4143,7 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* ob static bool is_white(unsigned int c) { return c==0 || c==' ' || c=='\t' || c=='\r' || c=='\n'; } static bool is_separator(unsigned int c) { return c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; } -#define STB_TEXTEDIT_IS_SPACE(CH) ( is_white((unsigned int)CH) || is_separator((unsigned int)CH) ) +#define STB_TEXTEDIT_IS_SPACE(CH) ( is_white((unsigned int)CH) || is_separator((unsigned int)CH) ) static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n) { ImWchar* dst = obj->Text+pos; const ImWchar* src = obj->Text+pos+n; while (ImWchar c = *src++) *dst++ = c; *dst = '\0'; } static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING* obj, int pos, const ImWchar* new_text, int new_text_len) { @@ -4389,7 +4389,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT const bool is_ctrl_down = io.KeyCtrl; const bool is_shift_down = io.KeyShift; - const bool tab_focus_requested = window->FocusItemRegister(g.ActiveId == id, (flags & ImGuiInputTextFlags_CallbackCompletion) == 0); // Using completion callback disable keyboard tabbing + const bool tab_focus_requested = window->FocusItemRegister(g.ActiveId == id, (flags & ImGuiInputTextFlags_CallbackCompletion) == 0); // Using completion callback disable keyboard tabbing //const bool align_center = (bool)(flags & ImGuiInputTextFlags_AlignCenter); // FIXME: Unsupported const bool hovered = (g.HoveredWindow == window) && (g.HoveredId == 0) && IsMouseHoveringBox(frame_bb); @@ -6727,10 +6727,10 @@ void ImGui::ShowTestWindow(bool* open) // Testing IMGUI_ONCE_UPON_A_FRAME macro //for (int i = 0; i < 5; i++) //{ - // IMGUI_ONCE_UPON_A_FRAME - // { - // ImGui::Text("This will be displayed only once."); - // } + // IMGUI_ONCE_UPON_A_FRAME + // { + // ImGui::Text("This will be displayed only once."); + // } //} ImGui::Separator(); @@ -7118,9 +7118,9 @@ static void ShowExampleAppAutoResize(bool* open) struct ExampleAppConsole { ImVector Items; - bool NewItems; + bool NewItems; - void Clear() + void Clear() { for (size_t i = 0; i < Items.size(); i++) ImGui::MemFree(Items[i]); @@ -7128,7 +7128,7 @@ struct ExampleAppConsole NewItems = true; } - void AddLog(const char* fmt, ...) + void AddLog(const char* fmt, ...) { char buf[512]; va_list args; @@ -7139,7 +7139,7 @@ struct ExampleAppConsole NewItems = true; } - void TextEditCallback(ImGuiTextEditCallbackData* data) + void TextEditCallback(ImGuiTextEditCallbackData* data) { //AddLog("cursor: %d, selection: %d-%d", data->CursorPos, data->SelectionStart, data->SelectionEnd); switch (data->EventKey) @@ -7290,7 +7290,7 @@ static void ShowExampleAppConsole(bool* open) if (input_trimmed_end > input) { console.AddLog("# %s\n", input); - console.AddLog("Unknown command: '%.*s'\n", input_trimmed_end-input, input); // NB: we don't actually handle any command in this sample code + console.AddLog("Unknown command: '%.*s'\n", input_trimmed_end-input, input); // NB: we don't actually handle any command in this sample code } strcpy(input, ""); } diff --git a/imgui.h b/imgui.h index f1592161..6a61bcc0 100644 --- a/imgui.h +++ b/imgui.h @@ -537,7 +537,7 @@ struct ImGuiOnceUponAFrame { ImGuiOnceUponAFrame() { RefFrame = -1; } mutable int RefFrame; - operator bool() const { const int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; } + operator bool() const { const int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; } }; // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" @@ -608,15 +608,15 @@ struct ImGuiStorage // Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used. struct ImGuiTextEditCallbackData { - ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only - char* Buf; // Current text // Read-write (pointed data only) - size_t BufSize; // // Read-only - bool BufDirty; // Set if you modify Buf directly // Write - ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only - int CursorPos; // // Read-write - int SelectionStart; // // Read-write (== to SelectionEnd when no selection) - int SelectionEnd; // // Read-write - void* UserData; // What user passed to InputText() + ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only + char* Buf; // Current text // Read-write (pointed data only) + size_t BufSize; // // Read-only + bool BufDirty; // Set if you modify Buf directly // Write + ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only + int CursorPos; // // Read-write + int SelectionStart; // // Read-write (== to SelectionEnd when no selection) + int SelectionEnd; // // Read-write + void* UserData; // What user passed to InputText() // NB: calling those function loses selection. void DeleteChars(int pos, int bytes_count); @@ -722,7 +722,7 @@ struct ImFont IMGUI_API ImFont(); IMGUI_API ~ImFont() { Clear(); } - IMGUI_API bool LoadFromMemory(const void* data, size_t data_size); + IMGUI_API bool LoadFromMemory(const void* data, size_t data_size); IMGUI_API bool LoadFromFile(const char* filename); IMGUI_API void Clear(); IMGUI_API void BuildLookupTable();