From 7661b1e778a68eaffc1ced1f4de0773b140bc0a9 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 26 Mar 2016 15:43:45 +0100 Subject: [PATCH] Trim trailing spaces --- examples/allegro5_example/imgui_impl_a5.cpp | 36 +++++++++---------- examples/allegro5_example/main.cpp | 8 ++--- examples/directx10_example/main.cpp | 2 +- .../directx11_example/imgui_impl_dx11.cpp | 4 +-- examples/directx11_example/main.cpp | 2 +- examples/directx9_example/imgui_impl_dx9.cpp | 22 ++++++------ .../imgui_impl_marmalade.cpp | 26 +++++++------- examples/opengl_example/imgui_impl_glfw.cpp | 2 +- examples/sdl_opengl3_example/main.cpp | 2 +- .../sdl_opengl_example/imgui_impl_sdl.cpp | 6 ++-- examples/sdl_opengl_example/main.cpp | 2 +- 11 files changed, 56 insertions(+), 56 deletions(-) diff --git a/examples/allegro5_example/imgui_impl_a5.cpp b/examples/allegro5_example/imgui_impl_a5.cpp index a4cce9fd..9af4ee0e 100644 --- a/examples/allegro5_example/imgui_impl_a5.cpp +++ b/examples/allegro5_example/imgui_impl_a5.cpp @@ -40,14 +40,14 @@ void ImGui_ImplA5_RenderDrawLists(ImDrawData* draw_data) al_get_blender(&op, &src, &dst); al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); - for (int n = 0; n < draw_data->CmdListsCount; n++) + for (int n = 0; n < draw_data->CmdListsCount; n++) { const ImDrawList* cmd_list = draw_data->CmdLists[n]; // FIXME-OPT: Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats static ImVector vertices; vertices.resize(cmd_list->VtxBuffer.size()); - for (int i = 0; i < cmd_list->VtxBuffer.size(); ++i) + for (int i = 0; i < cmd_list->VtxBuffer.size(); ++i) { const ImDrawVert &dv = cmd_list->VtxBuffer[i]; ImDrawVertAllegro v; @@ -62,18 +62,18 @@ void ImGui_ImplA5_RenderDrawLists(ImDrawData* draw_data) // You can also use '#define ImDrawIdx unsigned int' in imconfig.h and request ImGui to output 32-bit indices static ImVector indices; indices.resize(cmd_list->IdxBuffer.size()); - for (int i = 0; i < cmd_list->IdxBuffer.size(); ++i) + for (int i = 0; i < cmd_list->IdxBuffer.size(); ++i) indices[i] = (int)cmd_list->IdxBuffer.Data[i]; int idx_offset = 0; - for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++) + for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++) { const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; - if (pcmd->UserCallback) + if (pcmd->UserCallback) { pcmd->UserCallback(cmd_list, pcmd); } - else + else { ALLEGRO_BITMAP* texture = (ALLEGRO_BITMAP*)pcmd->TextureId; al_set_clipping_rectangle(pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z-pcmd->ClipRect.x, pcmd->ClipRect.w-pcmd->ClipRect.y); @@ -104,11 +104,11 @@ bool Imgui_ImplA5_CreateDeviceObjects() ALLEGRO_BITMAP* img = al_create_bitmap(width, height); al_set_new_bitmap_flags(flags); al_set_new_bitmap_format(fmt); - if (!img) + if (!img) return false; ALLEGRO_LOCKED_REGION *locked_img = al_lock_bitmap(img, al_get_bitmap_format(img), ALLEGRO_LOCK_WRITEONLY); - if (!locked_img) + if (!locked_img) { al_destroy_bitmap(img); return false; @@ -119,7 +119,7 @@ bool Imgui_ImplA5_CreateDeviceObjects() // Convert software texture to hardware texture. ALLEGRO_BITMAP* cloned_img = al_clone_bitmap(img); al_destroy_bitmap(img); - if (!cloned_img) + if (!cloned_img) return false; // Store our identifier @@ -137,7 +137,7 @@ bool Imgui_ImplA5_CreateDeviceObjects() void ImGui_ImplA5_InvalidateDeviceObjects() { - if (g_Texture) + if (g_Texture) { al_destroy_bitmap(g_Texture); ImGui::GetIO().Fonts->TexID = NULL; @@ -153,11 +153,11 @@ void ImGui_ImplA5_InvalidateDeviceObjects() bool ImGui_ImplA5_Init(ALLEGRO_DISPLAY* display) { g_Display = display; - - // Create custom vertex declaration. + + // Create custom vertex declaration. // Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats. // We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion. - ALLEGRO_VERTEX_ELEMENT elems[] = + ALLEGRO_VERTEX_ELEMENT elems[] = { { ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, OFFSETOF(ImDrawVertAllegro, pos) }, { ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, OFFSETOF(ImDrawVertAllegro, uv) }, @@ -205,13 +205,13 @@ bool ImGui_ImplA5_ProcessEvent(ALLEGRO_EVENT *ev) { ImGuiIO &io = ImGui::GetIO(); - switch (ev->type) + switch (ev->type) { case ALLEGRO_EVENT_MOUSE_AXES: io.MouseWheel += ev->mouse.dz; return true; case ALLEGRO_EVENT_KEY_CHAR: - if (ev->keyboard.display == g_Display) + if (ev->keyboard.display == g_Display) if (ev->keyboard.unichar > 0 && ev->keyboard.unichar < 0x10000) io.AddInputCharacter((unsigned short)ev->keyboard.unichar); return true; @@ -227,7 +227,7 @@ bool ImGui_ImplA5_ProcessEvent(ALLEGRO_EVENT *ev) void ImGui_ImplA5_NewFrame() { - if (!g_Texture) + if (!g_Texture) Imgui_ImplA5_CreateDeviceObjects(); ImGuiIO &io = ImGui::GetIO(); @@ -251,12 +251,12 @@ void ImGui_ImplA5_NewFrame() io.KeyAlt = al_key_down(&keys, ALLEGRO_KEY_ALT) || al_key_down(&keys, ALLEGRO_KEY_ALTGR); ALLEGRO_MOUSE_STATE mouse; - if (keys.display == g_Display) + if (keys.display == g_Display) { al_get_mouse_state(&mouse); io.MousePos = ImVec2((float)mouse.x, (float)mouse.y); } - else + else { io.MousePos = ImVec2(-1, -1); } diff --git a/examples/allegro5_example/main.cpp b/examples/allegro5_example/main.cpp index ee89c7cb..a8cd156b 100644 --- a/examples/allegro5_example/main.cpp +++ b/examples/allegro5_example/main.cpp @@ -9,7 +9,7 @@ int main(int, char**) { - // Setup Allegro + // Setup Allegro al_init(); al_install_keyboard(); al_install_mouse(); @@ -41,7 +41,7 @@ int main(int, char**) // Main loop bool running = true; - while (running) + while (running) { ALLEGRO_EVENT ev; while (al_get_next_event(queue, &ev)) @@ -70,7 +70,7 @@ int main(int, char**) } // 2. Show another simple window, this time using an explicit Begin/End pair - if (show_another_window) + if (show_another_window) { ImGui::SetNextWindowSize(ImVec2(200, 100), ImGuiSetCond_FirstUseEver); ImGui::Begin("Another Window", &show_another_window); @@ -79,7 +79,7 @@ int main(int, char**) } // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow() - if (show_test_window) + if (show_test_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver); ImGui::ShowTestWindow(&show_test_window); diff --git a/examples/directx10_example/main.cpp b/examples/directx10_example/main.cpp index 7d51327d..f47f9d5d 100644 --- a/examples/directx10_example/main.cpp +++ b/examples/directx10_example/main.cpp @@ -21,7 +21,7 @@ void CreateRenderTarget() g_pSwapChain->GetDesc(&sd); // Create the render target - ID3D10Texture2D* pBackBuffer; + ID3D10Texture2D* pBackBuffer; D3D10_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/examples/directx11_example/imgui_impl_dx11.cpp b/examples/directx11_example/imgui_impl_dx11.cpp index 2ac50c3c..8dd528d4 100644 --- a/examples/directx11_example/imgui_impl_dx11.cpp +++ b/examples/directx11_example/imgui_impl_dx11.cpp @@ -163,7 +163,7 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data) { const D3D11_RECT r = { (LONG)pcmd->ClipRect.x, (LONG)pcmd->ClipRect.y, (LONG)pcmd->ClipRect.z, (LONG)pcmd->ClipRect.w }; g_pd3dDeviceContext->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->TextureId); - g_pd3dDeviceContext->RSSetScissorRects(1, &r); + g_pd3dDeviceContext->RSSetScissorRects(1, &r); g_pd3dDeviceContext->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset); } idx_offset += pcmd->ElemCount; @@ -292,7 +292,7 @@ bool ImGui_ImplDX11_CreateDeviceObjects() // Create the vertex shader { - static const char* vertexShader = + static const char* vertexShader = "cbuffer vertexBuffer : register(b0) \ {\ float4x4 ProjectionMatrix; \ diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index 2b2e2ccf..d90f49c8 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -21,7 +21,7 @@ void CreateRenderTarget() g_pSwapChain->GetDesc(&sd); // 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/examples/directx9_example/imgui_impl_dx9.cpp b/examples/directx9_example/imgui_impl_dx9.cpp index eb6f68b4..21e8b5e3 100644 --- a/examples/directx9_example/imgui_impl_dx9.cpp +++ b/examples/directx9_example/imgui_impl_dx9.cpp @@ -97,8 +97,8 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data) g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); g_pd3dDevice->SetRenderState( D3DRS_SCISSORTESTENABLE, true ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); - g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); @@ -148,26 +148,26 @@ IMGUI_API LRESULT ImGui_ImplDX9_WndProcHandler(HWND, UINT msg, WPARAM wParam, LP io.MouseDown[0] = true; return true; case WM_LBUTTONUP: - io.MouseDown[0] = false; + io.MouseDown[0] = false; return true; case WM_RBUTTONDOWN: - io.MouseDown[1] = true; + io.MouseDown[1] = true; return true; case WM_RBUTTONUP: - io.MouseDown[1] = false; + io.MouseDown[1] = false; return true; case WM_MBUTTONDOWN: - io.MouseDown[2] = true; + io.MouseDown[2] = true; return true; case WM_MBUTTONUP: - io.MouseDown[2] = false; + io.MouseDown[2] = false; return true; case WM_MOUSEWHEEL: io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; return true; case WM_MOUSEMOVE: io.MousePos.x = (signed short)(lParam); - io.MousePos.y = (signed short)(lParam >> 16); + io.MousePos.y = (signed short)(lParam >> 16); return true; case WM_KEYDOWN: if (wParam < 256) @@ -191,7 +191,7 @@ bool ImGui_ImplDX9_Init(void* hwnd, IDirect3DDevice9* device) g_hWnd = (HWND)hwnd; g_pd3dDevice = device; - if (!QueryPerformanceFrequency((LARGE_INTEGER *)&g_TicksPerSecond)) + if (!QueryPerformanceFrequency((LARGE_INTEGER *)&g_TicksPerSecond)) return false; if (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time)) return false; @@ -244,7 +244,7 @@ static bool ImGui_ImplDX9_CreateFontsTexture() if (D3DXCreateTexture(g_pd3dDevice, width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8B8G8R8, D3DPOOL_DEFAULT, &g_FontTexture) < 0) return false; D3DLOCKED_RECT tex_locked_rect; - if (g_FontTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK) + if (g_FontTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK) return false; 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)); @@ -301,7 +301,7 @@ void ImGui_ImplDX9_NewFrame() // Setup time step INT64 current_time; - QueryPerformanceCounter((LARGE_INTEGER *)¤t_time); + QueryPerformanceCounter((LARGE_INTEGER *)¤t_time); io.DeltaTime = (float)(current_time - g_Time) / g_TicksPerSecond; g_Time = current_time; diff --git a/examples/marmalade_example/imgui_impl_marmalade.cpp b/examples/marmalade_example/imgui_impl_marmalade.cpp index e1d68a78..f7cff9b1 100644 --- a/examples/marmalade_example/imgui_impl_marmalade.cpp +++ b/examples/marmalade_example/imgui_impl_marmalade.cpp @@ -13,7 +13,7 @@ #include "imgui_impl_marmalade.h" #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ void ImGui_Marmalade_RenderDrawLists(ImDrawData* draw_data) CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2, nVert); CIwColour* pColStream = IW_GX_ALLOC(CIwColour, nVert); - for( int i=0; i < nVert; i++ ) + for( int i=0; i < nVert; i++ ) { // TODO: optimize multiplication on gpu using vertex shader pVertStream[i].x = cmd_list->VtxBuffer[i].pos.x * g_scale.x; @@ -92,12 +92,12 @@ void ImGui_Marmalade_RenderDrawLists(ImDrawData* draw_data) static const char* ImGui_Marmalade_GetClipboardText() { - if (s3eClipboardAvailable()) + if (s3eClipboardAvailable()) { int size = s3eClipboardGetText(NULL, 0); - if (size > 0) + if (size > 0) { - if (g_ClipboardText) + if (g_ClipboardText) { delete[] g_ClipboardText; g_ClipboardText = NULL; @@ -124,7 +124,7 @@ int32 ImGui_Marmalade_PointerButtonEventCallback(void* SystemData, void* pUserDa // S3E_POINTER_BUTTON_SELECT s3ePointerEvent* pEvent = (s3ePointerEvent*)SystemData; - if (pEvent->m_Pressed == 1) + if (pEvent->m_Pressed == 1) { if (pEvent->m_Button == S3E_POINTER_BUTTON_LEFTMOUSE) g_MousePressed[0] = true; @@ -149,7 +149,7 @@ int32 ImGui_Marmalade_KeyCallback(void* SystemData, void* userData) io.KeysDown[e->m_Key] = true; if (e->m_Pressed == 0) io.KeysDown[e->m_Key] = false; - + io.KeyCtrl = s3eKeyboardGetState(s3eKeyLeftControl) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightControl) == S3E_KEY_STATE_DOWN; io.KeyShift = s3eKeyboardGetState(s3eKeyLeftShift) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightShift) == S3E_KEY_STATE_DOWN; io.KeyAlt = s3eKeyboardGetState(s3eKeyLeftAlt) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightAlt) == S3E_KEY_STATE_DOWN; @@ -196,7 +196,7 @@ bool ImGui_Marmalade_CreateDeviceObjects() void ImGui_Marmalade_InvalidateDeviceObjects() { - if (g_ClipboardText) + if (g_ClipboardText) { delete[] g_ClipboardText; g_ClipboardText = NULL; @@ -278,8 +278,8 @@ void ImGui_Marmalade_NewFrame() mouse_x = s3ePointerGetX(); mouse_y = s3ePointerGetY(); io.MousePos = ImVec2((float)mouse_x/g_scale.x, (float)mouse_y/g_scale.y); // Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.) - - for (int i = 0; i < 3; i++) + + for (int i = 0; i < 3; i++) { io.MouseDown[i] = g_MousePressed[i] || s3ePointerGetState((s3ePointerButton)i) != S3E_POINTER_STATE_UP; // 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. g_MousePressed[i] = false; @@ -296,15 +296,15 @@ void ImGui_Marmalade_NewFrame() // Show/hide OSD keyboard if (io.WantTextInput) - { + { // Some text input widget is active? - if (!g_osdKeyboardEnabled) + if (!g_osdKeyboardEnabled) { g_osdKeyboardEnabled = true; s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 1); // show OSD keyboard } } - else + else { // No text input widget is active if (g_osdKeyboardEnabled) diff --git a/examples/opengl_example/imgui_impl_glfw.cpp b/examples/opengl_example/imgui_impl_glfw.cpp index 335e4213..ae6f3115 100644 --- a/examples/opengl_example/imgui_impl_glfw.cpp +++ b/examples/opengl_example/imgui_impl_glfw.cpp @@ -265,7 +265,7 @@ void ImGui_ImplGlfw_NewFrame() { io.MousePos = ImVec2(-1,-1); } - + 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. diff --git a/examples/sdl_opengl3_example/main.cpp b/examples/sdl_opengl3_example/main.cpp index 33b4903f..21cc8f2a 100644 --- a/examples/sdl_opengl3_example/main.cpp +++ b/examples/sdl_opengl3_example/main.cpp @@ -98,7 +98,7 @@ int main(int, char**) // Cleanup ImGui_ImplSdlGL3_Shutdown(); - SDL_GL_DeleteContext(glcontext); + SDL_GL_DeleteContext(glcontext); SDL_DestroyWindow(window); SDL_Quit(); diff --git a/examples/sdl_opengl_example/imgui_impl_sdl.cpp b/examples/sdl_opengl_example/imgui_impl_sdl.cpp index 927f8774..ba1746af 100644 --- a/examples/sdl_opengl_example/imgui_impl_sdl.cpp +++ b/examples/sdl_opengl_example/imgui_impl_sdl.cpp @@ -207,11 +207,11 @@ bool ImGui_ImplSdl_Init(SDL_Window* window) io.KeyMap[ImGuiKey_X] = SDLK_x; io.KeyMap[ImGuiKey_Y] = SDLK_y; io.KeyMap[ImGuiKey_Z] = SDLK_z; - + io.RenderDrawListsFn = ImGui_ImplSdl_RenderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer. io.SetClipboardTextFn = ImGui_ImplSdl_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplSdl_GetClipboardText; - + #ifdef _WIN32 SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version); @@ -257,7 +257,7 @@ void ImGui_ImplSdl_NewFrame(SDL_Window *window) io.MousePos = ImVec2((float)mx, (float)my); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) else io.MousePos = ImVec2(-1,-1); - + io.MouseDown[0] = g_MousePressed[0] || (mouseMask & SDL_BUTTON(SDL_BUTTON_LEFT)) != 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[1] = g_MousePressed[1] || (mouseMask & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0; io.MouseDown[2] = g_MousePressed[2] || (mouseMask & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0; diff --git a/examples/sdl_opengl_example/main.cpp b/examples/sdl_opengl_example/main.cpp index fffab05b..e9574e2f 100644 --- a/examples/sdl_opengl_example/main.cpp +++ b/examples/sdl_opengl_example/main.cpp @@ -95,7 +95,7 @@ int main(int, char**) // Cleanup ImGui_ImplSdl_Shutdown(); - SDL_GL_DeleteContext(glcontext); + SDL_GL_DeleteContext(glcontext); SDL_DestroyWindow(window); SDL_Quit();