Trim trailing spaces

This commit is contained in:
ocornut
2016-03-26 15:43:45 +01:00
parent 2b7eeba143
commit 7661b1e778
11 changed files with 56 additions and 56 deletions

View File

@ -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<ImDrawVertAllegro> 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<int> 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);
}

View File

@ -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);