Skip to content

Commit

Permalink
Merge pull request #103 from jvcleave/imgui-latest
Browse files Browse the repository at this point in the history
Imgui latest
  • Loading branch information
jvcleave authored Feb 11, 2020
2 parents 7396405 + d498433 commit 70e3c62
Show file tree
Hide file tree
Showing 16 changed files with 13,302 additions and 7,332 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ Makefile
config.make
openFrameworks-Info.plist
Project.xcconfig
/libs/imgui-1.75
8 changes: 4 additions & 4 deletions example-demo/src/MyTheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void MyTheme::setup()
style->Colors[ImGuiCol_Text] = ImVec4(getRandomColor(), 1.00f);
style->Colors[ImGuiCol_TextDisabled] = ImVec4(getRandomColor(), 0.58f);
style->Colors[ImGuiCol_WindowBg] = ImVec4(getRandomColor(), 0.70f);
style->Colors[ImGuiCol_ChildWindowBg] = ImVec4(getRandomColor(), 0.58f);
style->Colors[ImGuiCol_ChildBg] = ImVec4(getRandomColor(), 0.58f);
style->Colors[ImGuiCol_Border] = ImVec4(getRandomColor(), 0.00f);
style->Colors[ImGuiCol_BorderShadow] = ImVec4(getRandomColor(), 0.00f);
style->Colors[ImGuiCol_FrameBg] = ImVec4(getRandomColor(), 1.00f);
Expand All @@ -52,9 +52,9 @@ void MyTheme::setup()
style->Colors[ImGuiCol_Header] = ImVec4(getRandomColor(), 0.76f);
style->Colors[ImGuiCol_HeaderHovered] = ImVec4(getRandomColor(), 0.86f);
style->Colors[ImGuiCol_HeaderActive] = ImVec4(getRandomColor(), 1.00f);
style->Colors[ImGuiCol_Column] = ImVec4(getRandomColor(), 0.32f);
style->Colors[ImGuiCol_ColumnHovered] = ImVec4(getRandomColor(), 0.78f);
style->Colors[ImGuiCol_ColumnActive] = ImVec4(getRandomColor(), 1.00f);
style->Colors[ImGuiCol_Separator] = ImVec4(getRandomColor(), 0.32f);
style->Colors[ImGuiCol_SeparatorHovered] = ImVec4(getRandomColor(), 0.78f);
style->Colors[ImGuiCol_SeparatorActive] = ImVec4(getRandomColor(), 1.00f);
style->Colors[ImGuiCol_ResizeGrip] = ImVec4(getRandomColor(), 0.04f);
style->Colors[ImGuiCol_ResizeGripHovered] = ImVec4(getRandomColor(), 0.78f);
style->Colors[ImGuiCol_ResizeGripActive] = ImVec4(getRandomColor(), 1.00f);
Expand Down
4 changes: 2 additions & 2 deletions example-demo/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ofApp::draw(){
if (show_another_window)
{
//note: ofVec2f and ImVec2f are interchangeable
ImGui::SetNextWindowSize(ofVec2f(200,100), ImGuiSetCond_FirstUseEver);
ImGui::SetNextWindowSize(ofVec2f(200,100), ImGuiCond_FirstUseEver);
ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello");
ImGui::End();
Expand All @@ -111,7 +111,7 @@ void ofApp::draw(){
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowDemoWindow()
if (show_test_window)
{
ImGui::SetNextWindowPos(ofVec2f(650, 20), ImGuiSetCond_FirstUseEver);
ImGui::SetNextWindowPos(ofVec2f(650, 20), ImGuiCond_FirstUseEver);
ImGui::ShowDemoWindow(&show_test_window);
}

Expand Down
21 changes: 21 additions & 0 deletions libs/imgui/src/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014-2020 Omar Cornut

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6,262 changes: 3,790 additions & 2,472 deletions libs/imgui/src/imgui.cpp
100755 → 100644

Large diffs are not rendered by default.

1,679 changes: 993 additions & 686 deletions libs/imgui/src/imgui.h
100755 → 100644

Large diffs are not rendered by default.

5,087 changes: 3,185 additions & 1,902 deletions libs/imgui/src/imgui_demo.cpp
100755 → 100644

Large diffs are not rendered by default.

1,313 changes: 812 additions & 501 deletions libs/imgui/src/imgui_draw.cpp
100755 → 100644

Large diffs are not rendered by default.

1,454 changes: 1,040 additions & 414 deletions libs/imgui/src/imgui_internal.h
100755 → 100644

Large diffs are not rendered by default.

4,473 changes: 3,229 additions & 1,244 deletions libs/imgui/src/imgui_widgets.cpp
100755 → 100644

Large diffs are not rendered by default.

26 changes: 21 additions & 5 deletions libs/imgui/src/imstb_rectpack.h
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// stb_rect_pack.h - v0.11 - public domain - rectangle packing
// [DEAR IMGUI]
// This is a slightly modified version of stb_rect_pack.h 1.00.
// Those changes would need to be pushed into nothings/stb:
// - Added STBRP__CDECL
// Grep for [DEAR IMGUI] to find the changes.

// stb_rect_pack.h - v1.00 - public domain - rectangle packing
// Sean Barrett 2014
//
// Useful for e.g. packing rectangular textures into an atlas.
Expand Down Expand Up @@ -31,9 +37,12 @@
//
// Bugfixes / warning fixes
// Jeremy Jaussaud
// Fabian Giesen
//
// Version history:
//
// 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles
// 0.99 (2019-02-07) warning fixes
// 0.11 (2017-03-03) return packing success/fail result
// 0.10 (2016-10-25) remove cast-away-const to avoid warnings
// 0.09 (2016-08-27) fix compiler warnings
Expand Down Expand Up @@ -204,6 +213,7 @@ struct stbrp_context
#define STBRP_ASSERT assert
#endif

// [DEAR IMGUI] Added STBRP__CDECL
#ifdef _MSC_VER
#define STBRP__NOTUSED(v) (void)(v)
#define STBRP__CDECL __cdecl
Expand Down Expand Up @@ -349,6 +359,13 @@ static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int widt
width -= width % c->align;
STBRP_ASSERT(width % c->align == 0);

// if it can't possibly fit, bail immediately
if (width > c->width || height > c->height) {
fr.prev_link = NULL;
fr.x = fr.y = 0;
return fr;
}

node = c->active_head;
prev = &c->active_head;
while (node->x + width <= c->width) {
Expand Down Expand Up @@ -412,7 +429,7 @@ static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int widt
}
STBRP_ASSERT(node->next->x > xpos && node->x <= xpos);
y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);
if (y + height < c->height) {
if (y + height <= c->height) {
if (y <= best_y) {
if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) {
best_x = xpos;
Expand Down Expand Up @@ -512,6 +529,7 @@ static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, i
return res;
}

// [DEAR IMGUI] Added STBRP__CDECL
static int STBRP__CDECL rect_height_compare(const void *a, const void *b)
{
const stbrp_rect *p = (const stbrp_rect *) a;
Expand All @@ -523,6 +541,7 @@ static int STBRP__CDECL rect_height_compare(const void *a, const void *b)
return (p->w > q->w) ? -1 : (p->w < q->w);
}

// [DEAR IMGUI] Added STBRP__CDECL
static int STBRP__CDECL rect_original_order(const void *a, const void *b)
{
const stbrp_rect *p = (const stbrp_rect *) a;
Expand All @@ -543,9 +562,6 @@ STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int nu
// we use the 'was_packed' field internally to allow sorting/unsorting
for (i=0; i < num_rects; ++i) {
rects[i].was_packed = i;
#ifndef STBRP_LARGE_RECTS
STBRP_ASSERT(rects[i].w <= 0xffff && rects[i].h <= 0xffff);
#endif
}

// sort according to heuristic
Expand Down
26 changes: 17 additions & 9 deletions libs/imgui/src/imstb_textedit.h
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// [ImGui] this is a slightly modified version of stb_textedit.h 1.12. Those changes would need to be pushed into nothings/stb
// [ImGui] - 2018-06: fixed undo/redo after pasting large amount of text (over 32 kb). Redo will still fail when undo buffers are exhausted, but text won't be corrupted (see nothings/stb issue #620)
// [ImGui] - 2018-06: fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)
// [ImGui] - fixed some minor warnings
// [DEAR IMGUI]
// This is a slightly modified version of stb_textedit.h 1.13.
// Those changes would need to be pushed into nothings/stb:
// - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)
// Grep for [DEAR IMGUI] to find the changes.

// stb_textedit.h - v1.12 - public domain - Sean Barrett
// stb_textedit.h - v1.13 - public domain - Sean Barrett
// Development of this library was sponsored by RAD Game Tools
//
// This C header file implements the guts of a multi-line text-editing
Expand Down Expand Up @@ -34,6 +35,7 @@
//
// VERSION HISTORY
//
// 1.13 (2019-02-07) fix bug in undo size management
// 1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash
// 1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield
// 1.10 (2016-10-25) supress warnings about casting away const with -Wcast-qual
Expand Down Expand Up @@ -563,7 +565,6 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s

// now scan to find xpos
find->x = r.x0;
i = 0;
for (i=0; first+i < n; ++i)
find->x += STB_TEXTEDIT_GETWIDTH(str, first, i);
}
Expand Down Expand Up @@ -693,7 +694,7 @@ static void stb_textedit_prep_selection_at_cursor(STB_TexteditState *state)
static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
{
if (STB_TEXT_HAS_SELECTION(state)) {
stb_textedit_delete_selection(str,state); // implicity clamps
stb_textedit_delete_selection(str,state); // implicitly clamps
state->has_preferred_x = 0;
return 1;
}
Expand Down Expand Up @@ -745,7 +746,7 @@ static void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state,
state->has_preferred_x = 0;
}
} else {
stb_textedit_delete_selection(str,state); // implicity clamps
stb_textedit_delete_selection(str,state); // implicitly clamps
if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {
stb_text_makeundo_insert(state, state->cursor, 1);
++state->cursor;
Expand Down Expand Up @@ -1133,7 +1134,14 @@ static void stb_textedit_discard_redo(StbUndoState *state)
state->undo_rec[i].char_storage += n;
}
// now move all the redo records towards the end of the buffer; the first one is at 'redo_point'
STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point+1, state->undo_rec + state->redo_point, (size_t) ((STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point)*sizeof(state->undo_rec[0])));
// {DEAR IMGUI]
size_t move_size = (size_t)((STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point - 1) * sizeof(state->undo_rec[0]));
const char* buf_begin = (char*)state->undo_rec; (void)buf_begin;
const char* buf_end = (char*)state->undo_rec + sizeof(state->undo_rec); (void)buf_end;
IM_ASSERT(((char*)(state->undo_rec + state->redo_point)) >= buf_begin);
IM_ASSERT(((char*)(state->undo_rec + state->redo_point + 1) + move_size) <= buf_end);
STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point+1, state->undo_rec + state->redo_point, move_size);

// now move redo_point to point to the new one
++state->redo_point;
}
Expand Down
Loading

0 comments on commit 70e3c62

Please sign in to comment.