Merge branch 'master' into viewport

# Conflicts:
#	examples/opengl2_example/imgui_impl_glfw_gl2.cpp
#	examples/opengl3_example/imgui_impl_glfw_gl3.cpp
#	examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp
#	examples/sdl_opengl3_example/imgui_impl_sdl_gl3.h
#	examples/vulkan_example/imgui_impl_glfw_vulkan.cpp
docking
omar 6 years ago
commit 03c8a78f04

@ -45,6 +45,10 @@ Other Changes:
- Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787) - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless. - TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- Examples: GLFW: Made it possible to Shutdown/Init the backend again (by reseting the time storage properly). (#1827) [@ice1000]
----------------------------------------------------------------------- -----------------------------------------------------------------------

@ -31,10 +31,10 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
!- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet. !- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro) - scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
- drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded renderering. - drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded rendering.
- drawlist: end-user probably can't call Clear() directly because we expect a texture to be pushed in the stack. - drawlist: end-user probably can't call Clear() directly because we expect a texture to be pushed in the stack.
- drawlist: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command). - drawlist: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command).
- drawlist: primtiives/helpers to manipulate vertices post submission, so e.g. a quad/rect can be resized to fit later submitted content, _without_ using the ChannelSplit api - drawlist: primitives/helpers to manipulate vertices post submission, so e.g. a quad/rect can be resized to fit later submitted content, _without_ using the ChannelSplit api
- drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally - drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally
- drawlist: non-AA strokes have gaps between points (#593, #288), especially RenderCheckmark(). - drawlist: non-AA strokes have gaps between points (#593, #288), especially RenderCheckmark().
- drawlist: would be good to be able to deep copy of ImDrawData (we have a deep copy of ImDrawList now). - drawlist: would be good to be able to deep copy of ImDrawData (we have a deep copy of ImDrawList now).
@ -50,7 +50,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc. (#395) - widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc. (#395)
- widgets: clean up widgets internal toward exposing everything and stabilizing imgui_internals.h. - widgets: clean up widgets internal toward exposing everything and stabilizing imgui_internals.h.
- widgets: add visauls for Disabled/ReadOnly mode and expose publicly (#211) - widgets: add visuals for Disabled/ReadOnly mode and expose publicly (#211)
- widgets: add always-allow-overlap mode. - widgets: add always-allow-overlap mode.
- widgets: alignment options in style (e.g. center Selectable, Right-Align within Button, etc.) #1260 - widgets: alignment options in style (e.g. center Selectable, Right-Align within Button, etc.) #1260
- widgets: activate by identifier (trigger button, focus given id) - widgets: activate by identifier (trigger button, focus given id)
@ -67,13 +67,14 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- input text: add ImGuiInputTextFlags_EnterToApply? (off #218) - input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
- input text: easier ways to update buffer (from source char*) while owned. preserve some sort of cursor position for multi-line text. - input text: easier ways to update buffer (from source char*) while owned. preserve some sort of cursor position for multi-line text.
- input text: add discard flag (e.g. ImGuiInputTextFlags_DiscardActiveBuffer) or make it easier to clear active focus for text replacement during edition (#725) - input text: add discard flag (e.g. ImGuiInputTextFlags_DiscardActiveBuffer) or make it easier to clear active focus for text replacement during edition (#725)
- input text: display bug when clicking a drag/slider after an input text in a different window has all-selected text (order dependant). actually a very old bug but no one appears to have noticed it. - input text: display bug when clicking a drag/slider after an input text in a different window has all-selected text (order dependent). actually a very old bug but no one appears to have noticed it.
- input text multi-line: don't directly call AddText() which does an unnecessary vertex reserve for character count prior to clipping. and/or more line-based clipping to AddText(). and/or reorganize TextUnformatted/RenderText for more efficiency for large text (e.g TextUnformatted could clip and log separately, etc). - input text multi-line: don't directly call AddText() which does an unnecessary vertex reserve for character count prior to clipping. and/or more line-based clipping to AddText(). and/or reorganize TextUnformatted/RenderText for more efficiency for large text (e.g TextUnformatted could clip and log separately, etc).
- input text multi-line: support for cut/paste without selection (cut/paste the current line) - input text multi-line: support for cut/paste without selection (cut/paste the current line)
- input text multi-line: line numbers? status bar? (follow up on #200) - input text multi-line: line numbers? status bar? (follow up on #200)
- input text multi-line: behave better when user changes input buffer while editing is active (even though it is illegal behavior). namely, the change of buffer can create a scrollbar glitch (#725) - input text multi-line: behave better when user changes input buffer while editing is active (even though it is illegal behavior). namely, the change of buffer can create a scrollbar glitch (#725)
- input text multi-line: better horizontal scrolling support (#383, #1224) - input text multi-line: better horizontal scrolling support (#383, #1224)
- input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position. - input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
- input text: what's the easiest way to implement a nice IP/Mac address input editor?
- input number: optional range min/max for Input*() functions - input number: optional range min/max for Input*() functions
- input number: holding [-]/[+] buttons could increase the step speed non-linearly (or user-controlled) - input number: holding [-]/[+] buttons could increase the step speed non-linearly (or user-controlled)
- input number: use mouse wheel to step up/down - input number: use mouse wheel to step up/down
@ -86,12 +87,12 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- layout: more generic alignment state (left/right/centered) for single items? - layout: more generic alignment state (left/right/centered) for single items?
- layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding. - layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding.
- layout: BeginGroup() needs a border option. (~#1496) - layout: BeginGroup() needs a border option. (~#1496)
- layout: vertical alignement of mixed height items (e.g. buttons) within a same line (#1284) - layout: vertical alignment of mixed height items (e.g. buttons) within a same line (#1284)
- columns: sizing policy (e.g. for each column: fixed size, %, fill, distribute default size among fills) (#513, #125) - columns: sizing policy (e.g. for each column: fixed size, %, fill, distribute default size among fills) (#513, #125)
- columns: add a conditional parameter to SetColumnOffset() (#513, #125) - columns: add a conditional parameter to SetColumnOffset() (#513, #125)
- columns: headers. reorderable. (#513, #125) - columns: headers. reorderable. (#513, #125)
- columns: optional sorting modifiers (up/down), sort list so sorting can be done multi-critera. notify user when sort order changed. - columns: optional sorting modifiers (up/down), sort list so sorting can be done multi-criteria. notify user when sort order changed.
- columns: option to alternate background colors on odd/even scanlines. - columns: option to alternate background colors on odd/even scanlines.
- columns: allow columns to recurse. - columns: allow columns to recurse.
- columns: allow a same columns set to be interrupted by e.g. CollapsingHeader and resume with columns in sync when moving them. - columns: allow a same columns set to be interrupted by e.g. CollapsingHeader and resume with columns in sync when moving them.
@ -104,7 +105,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- coloredit: it is still somehow awkward to copy colors around (unless going through Hex mode). - coloredit: it is still somehow awkward to copy colors around (unless going through Hex mode).
- plot: full featured plot/graph api w/ scrolling, zooming etc. all bell & whistle. why not! - plot: full featured plot/graph api w/ scrolling, zooming etc. all bell & whistle. why not!
- plot: PlotLines() should use the polygon-stroke facilities, less verticles (currently issues with averaging normals) - plot: PlotLines() should use the polygon-stroke facilities, less vertices (currently issues with averaging normals)
- plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots) - plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots)
- plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value) - plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value)
- plot: option/feature: draw the zero line - plot: option/feature: draw the zero line
@ -161,7 +162,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- popups: border options. richer api like BeginChild() perhaps? (#197) - popups: border options. richer api like BeginChild() perhaps? (#197)
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred direction" and may teleport when moving mouse. - tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred direction" and may teleport when moving mouse.
- tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic. - tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic.
- tooltip: allow tooltips with timers? or general timer policy? (instaneous vs timed) - tooltip: allow tooltips with timers? or general timer policy? (instantaneous vs timed)
- menus: calling BeginMenu() twice with a same name doesn't append as Begin() does for regular windows (#1207) - menus: calling BeginMenu() twice with a same name doesn't append as Begin() does for regular windows (#1207)
- menus: menu bars inside modals windows are acting weird. - menus: menu bars inside modals windows are acting weird.
@ -229,7 +230,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
!- font: better CalcTextSizeA() API, at least for simple use cases. current one is horrible (perhaps have simple vs extended versions). !- font: better CalcTextSizeA() API, at least for simple use cases. current one is horrible (perhaps have simple vs extended versions).
- font: a CalcTextHeight() helper could run faster than CalcTextSize().y - font: a CalcTextHeight() helper could run faster than CalcTextSize().y
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX - font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
- font: finish CustomRectRegister() to allow mapping unicode codepoint to custom texture data - font: finish CustomRectRegister() to allow mapping Unicode codepoint to custom texture data
- font: PushFontSize API (#1018) - font: PushFontSize API (#1018)
- font/atlas: incremental updates - font/atlas: incremental updates
- font/atlas: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier. - font/atlas: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier.
@ -286,8 +287,10 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682) - misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
- misc: use more size_t in public api? - misc: use more size_t in public api?
- misc: ImVector: erase_unsorted() helper - misc: ImVector: erase_unsorted() helper
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions). - misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336) - web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336) - web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42) - web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)

@ -8,11 +8,9 @@
#import "imgui_impl_ios.h" #import "imgui_impl_ios.h"
#import "debug_hud.h" #import "debug_hud.h"
#define BUFFER_OFFSET(i) ((char *)NULL + (i)) #define BUFFER_OFFSET(i) ((char *)NULL + (i))
#define SERVERNAME_KEY @"ServerName"
#define SERVERNAME_KEY @"ServerName" #define SERVERNAME_ALERT_TAG 10
#define SERVERNAME_ALERT_TAG (10)
// Uniform index. // Uniform index.
enum enum
@ -20,85 +18,80 @@ enum
UNIFORM_MODELVIEWPROJECTION_MATRIX, UNIFORM_MODELVIEWPROJECTION_MATRIX,
UNIFORM_NORMAL_MATRIX, UNIFORM_NORMAL_MATRIX,
UNIFORM_DIFFUSE_COLOR, UNIFORM_DIFFUSE_COLOR,
UNIFORM_COUNT_
NUM_UNIFORMS
}; };
GLint uniforms[NUM_UNIFORMS]; static GLint uniforms[UNIFORM_COUNT_];
// Attribute index. // Attribute index.
enum enum
{ {
ATTRIB_VERTEX, ATTRIB_VERTEX,
ATTRIB_NORMAL, ATTRIB_NORMAL,
NUM_ATTRIBUTES ATTRIB_COUNT_
}; };
GLfloat gCubeVertexData[216] = static const GLfloat gCubeVertexData[216] =
{ {
// Data layout for each line below is: // Data layout for each line below is:
// positionX, positionY, positionZ, normalX, normalY, normalZ, // pos x/y/z, normal x/y/z,
0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,
0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,
0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,
0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,
-0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,
-0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,
0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,
-0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,
-0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,
0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,
0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,
0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,
0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f
}; };
@interface GameViewController () <UIAlertViewDelegate> @interface GameViewController () <UIAlertViewDelegate>
{ {
GLuint _program; GLuint _program;
GLKMatrix4 _modelViewProjectionMatrix;
GLKMatrix4 _modelViewProjectionMatrix; GLKMatrix3 _normalMatrix;
GLKMatrix3 _normalMatrix; float _rotation;
float _rotation; GLuint _vertexArray;
GLuint _vertexBuffer;
GLuint _vertexArray; DebugHUD _hud;
GLuint _vertexBuffer;
DebugHUD _hud;
} }
@property (strong, nonatomic) EAGLContext *context; @property (strong, nonatomic) EAGLContext* context;
@property (strong, nonatomic) GLKBaseEffect *effect; @property (strong, nonatomic) GLKBaseEffect* effect;
@property (strong, nonatomic) ImGuiHelper *imgui; @property (strong, nonatomic) ImGuiHelper* imgui;
@property (weak, nonatomic) IBOutlet UIButton *btnServername; @property (weak, nonatomic) IBOutlet UIButton* btnServername;
@property (strong, nonatomic) NSString* serverName;
@property (strong, nonatomic) NSString *serverName;
- (IBAction)onServernameTapped:(id)sender; - (IBAction)onServernameTapped:(id)sender;
@ -106,7 +99,7 @@ GLfloat gCubeVertexData[216] =
- (void)tearDownGL; - (void)tearDownGL;
- (BOOL)loadShaders; - (BOOL)loadShaders;
- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type file:(NSString *)file; - (BOOL)compileShader:(GLuint*)shader type:(GLenum)type file:(NSString*)file;
- (BOOL)linkProgram:(GLuint)prog; - (BOOL)linkProgram:(GLuint)prog;
- (BOOL)validateProgram:(GLuint)prog; - (BOOL)validateProgram:(GLuint)prog;
@end @end
@ -119,9 +112,8 @@ GLfloat gCubeVertexData[216] =
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (!self.context) { if (!self.context)
NSLog(@"Failed to create ES context"); NSLog(@"Failed to create ES context");
}
GLKView *view = (GLKView *)self.view; GLKView *view = (GLKView *)self.view;
view.context = self.context; view.context = self.context;
@ -140,30 +132,29 @@ GLfloat gCubeVertexData[216] =
[self.imgui connectServer: self.serverName ]; [self.imgui connectServer: self.serverName ];
} }
DebugHUD_InitDefaults( &_hud ); DebugHUD_InitDefaults(&_hud);
} }
- (void)dealloc - (void)dealloc
{ {
[self tearDownGL]; [self tearDownGL];
if ([EAGLContext currentContext] == self.context) { if ([EAGLContext currentContext] == self.context)
[EAGLContext setCurrentContext:nil]; [EAGLContext setCurrentContext:nil];
}
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
{ {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
if ([self isViewLoaded] && ([[self view] window] == nil)) { if ([self isViewLoaded] && ([[self view] window] == nil))
{
self.view = nil; self.view = nil;
[self tearDownGL]; [self tearDownGL];
if ([EAGLContext currentContext] == self.context) { if ([EAGLContext currentContext] == self.context)
[EAGLContext setCurrentContext:nil]; [EAGLContext setCurrentContext:nil];
}
self.context = nil; self.context = nil;
} }
@ -171,7 +162,8 @@ GLfloat gCubeVertexData[216] =
} }
- (BOOL)prefersStatusBarHidden { - (BOOL)prefersStatusBarHidden
{
return YES; return YES;
} }
@ -185,7 +177,7 @@ GLfloat gCubeVertexData[216] =
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ {
if ((buttonIndex==0)&&(alertView.tag==SERVERNAME_ALERT_TAG)) if ((buttonIndex==0) && (alertView.tag == SERVERNAME_ALERT_TAG))
{ {
// This is really janky. I usually just hardcode the servername since I'm building it anyway. // This is really janky. I usually just hardcode the servername since I'm building it anyway.
// If you want to properly handle updating the server, you'll want to tear down and recreate // If you want to properly handle updating the server, you'll want to tear down and recreate
@ -193,7 +185,8 @@ GLfloat gCubeVertexData[216] =
BOOL serverNameWasSet = self.serverName.length > 0; BOOL serverNameWasSet = self.serverName.length > 0;
NSString *serverName = [[alertView textFieldAtIndex:0] text]; NSString *serverName = [[alertView textFieldAtIndex:0] text];
if ([serverName length] > 0) { if ([serverName length] > 0)
{
self.serverName = serverName; self.serverName = serverName;
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:serverName forKey:SERVERNAME_KEY ]; [userDefaults setObject:serverName forKey:SERVERNAME_KEY ];
@ -202,7 +195,8 @@ GLfloat gCubeVertexData[216] =
[self.btnServername setTitle:self.serverName forState:UIControlStateNormal]; [self.btnServername setTitle:self.serverName forState:UIControlStateNormal];
// If we hadn't previously connected, try now // If we hadn't previously connected, try now
if (!serverNameWasSet) { if (!serverNameWasSet)
{
[self.imgui connectServer:self.serverName]; [self.imgui connectServer:self.serverName];
} }
else else
@ -241,8 +235,6 @@ GLfloat gCubeVertexData[216] =
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(12)); glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(12));
glBindVertexArrayOES(0); glBindVertexArrayOES(0);
} }
- (void)tearDownGL - (void)tearDownGL
@ -254,7 +246,8 @@ GLfloat gCubeVertexData[216] =
self.effect = nil; self.effect = nil;
if (_program) { if (_program)
{
glDeleteProgram(_program); glDeleteProgram(_program);
_program = 0; _program = 0;
} }
@ -285,9 +278,7 @@ GLfloat gCubeVertexData[216] =
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix);
_normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL); _normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL);
_modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix); _modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix);
_rotation += self.timeSinceLastUpdate * (_hud.rotation_speed * (M_PI / 180.0)); _rotation += self.timeSinceLastUpdate * (_hud.rotation_speed * (M_PI / 180.0));
} }
@ -359,7 +350,8 @@ GLfloat gCubeVertexData[216] =
glBindAttribLocation(_program, GLKVertexAttribNormal, "normal"); glBindAttribLocation(_program, GLKVertexAttribNormal, "normal");
// Link program. // Link program.
if (![self linkProgram:_program]) { if (![self linkProgram:_program])
{
NSLog(@"Failed to link program: %d", _program); NSLog(@"Failed to link program: %d", _program);
if (vertShader) { if (vertShader) {
@ -384,11 +376,13 @@ GLfloat gCubeVertexData[216] =
uniforms[UNIFORM_DIFFUSE_COLOR] = glGetUniformLocation(_program, "diffuseColor"); uniforms[UNIFORM_DIFFUSE_COLOR] = glGetUniformLocation(_program, "diffuseColor");
// Release vertex and fragment shaders. // Release vertex and fragment shaders.
if (vertShader) { if (vertShader)
{
glDetachShader(_program, vertShader); glDetachShader(_program, vertShader);
glDeleteShader(vertShader); glDeleteShader(vertShader);
} }
if (fragShader) { if (fragShader)
{
glDetachShader(_program, fragShader); glDetachShader(_program, fragShader);
glDeleteShader(fragShader); glDeleteShader(fragShader);
} }
@ -402,7 +396,8 @@ GLfloat gCubeVertexData[216] =
const GLchar *source; const GLchar *source;
source = (GLchar *)[[NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil] UTF8String]; source = (GLchar *)[[NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil] UTF8String];
if (!source) { if (!source)
{
NSLog(@"Failed to load vertex shader"); NSLog(@"Failed to load vertex shader");
return NO; return NO;
} }
@ -423,7 +418,8 @@ GLfloat gCubeVertexData[216] =
#endif #endif
glGetShaderiv(*shader, GL_COMPILE_STATUS, &status); glGetShaderiv(*shader, GL_COMPILE_STATUS, &status);
if (status == 0) { if (status == 0)
{
glDeleteShader(*shader); glDeleteShader(*shader);
return NO; return NO;
} }
@ -439,7 +435,8 @@ GLfloat gCubeVertexData[216] =
#if defined(DEBUG) #if defined(DEBUG)
GLint logLength; GLint logLength;
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength); glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength);
if (logLength > 0) { if (logLength > 0)
{
GLchar *log = (GLchar *)malloc(logLength); GLchar *log = (GLchar *)malloc(logLength);
glGetProgramInfoLog(prog, logLength, &logLength, log); glGetProgramInfoLog(prog, logLength, &logLength, log);
NSLog(@"Program link log:\n%s", log); NSLog(@"Program link log:\n%s", log);
@ -448,10 +445,8 @@ GLfloat gCubeVertexData[216] =
#endif #endif
glGetProgramiv(prog, GL_LINK_STATUS, &status); glGetProgramiv(prog, GL_LINK_STATUS, &status);
if (status == 0) { if (status == 0)
return NO; return NO;
}
return YES; return YES;
} }
@ -469,10 +464,8 @@ GLfloat gCubeVertexData[216] =
} }
glGetProgramiv(prog, GL_VALIDATE_STATUS, &status); glGetProgramiv(prog, GL_VALIDATE_STATUS, &status);
if (status == 0) { if (status == 0)
return NO; return NO;
}
return YES; return YES;
} }

@ -6,12 +6,12 @@
typedef struct DebugHUD typedef struct DebugHUD
{ {
bool show_demo_window; bool show_demo_window;
bool show_another_window; bool show_another_window;
float rotation_speed; float rotation_speed;
float cubeColor1[4]; float cubeColor1[4];
float cubeColor2[4]; float cubeColor2[4];
float clearColor[4]; float clearColor[4];
} DebugHUD; } DebugHUD;
#if __cplusplus #if __cplusplus

@ -277,8 +277,7 @@ void ImGui_KeyboardCallback(uSynergyCookie cookie, uint16_t key,
// If this key maps to a character input, apply it // If this key maps to a character input, apply it
int charForKeycode = (modifiers & USYNERGY_MODIFIER_SHIFT) ? g_keycodeCharShifted[scanCode] : g_keycodeCharUnshifted[scanCode]; int charForKeycode = (modifiers & USYNERGY_MODIFIER_SHIFT) ? g_keycodeCharShifted[scanCode] : g_keycodeCharUnshifted[scanCode];
io.AddInputCharacter((unsigned short)charForKeycode); io.AddInputCharacter((unsigned short)charForKeycode);
} }
} }
void ImGui_JoystickCallback(uSynergyCookie cookie, uint8_t joyNum, uint16_t buttons, int8_t leftStickX, int8_t leftStickY, int8_t rightStickX, int8_t rightStickY) void ImGui_JoystickCallback(uSynergyCookie cookie, uint8_t joyNum, uint16_t buttons, int8_t leftStickX, int8_t leftStickY, int8_t rightStickX, int8_t rightStickY)
@ -461,14 +460,15 @@ void ImGui_ClipboardCallback(uSynergyCookie cookie, enum uSynergyClipboardFormat
- (void)setupImGuiHooks - (void)setupImGuiHooks
{ {
ImGuiIO &io = ImGui::GetIO(); ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
[self setupKeymaps]; [self setupKeymaps];
// Account for retina display for glScissor // Account for retina display for glScissor
g_displayScale = [[UIScreen mainScreen] scale]; g_displayScale = [[UIScreen mainScreen] scale];
ImGuiStyle &style = ImGui::GetStyle(); ImGuiStyle& style = ImGui::GetStyle();
style.TouchExtraPadding = ImVec2( 4.0, 4.0 ); style.TouchExtraPadding = ImVec2( 4.0, 4.0 );
io.RenderDrawListsFn = ImGui_ImplIOS_RenderDrawLists; io.RenderDrawListsFn = ImGui_ImplIOS_RenderDrawLists;
@ -532,9 +532,8 @@ void ImGui_ClipboardCallback(uSynergyCookie cookie, enum uSynergyClipboardFormat
// Create a background thread for synergy // Create a background thread for synergy
_synergyQueue = dispatch_queue_create( "imgui-usynergy", NULL ); _synergyQueue = dispatch_queue_create( "imgui-usynergy", NULL );
dispatch_async( _synergyQueue, ^{ dispatch_async( _synergyQueue, ^{
while (1) { while (1)
uSynergyUpdate( &_synergyCtx ); uSynergyUpdate(&_synergyCtx);
}
}); });
} }
@ -569,24 +568,20 @@ void ImGui_ClipboardCallback(uSynergyCookie cookie, enum uSynergyClipboardFormat
- (void)newFrame - (void)newFrame
{ {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImGuiStyle &style = ImGui::GetStyle(); ImGuiStyle& style = ImGui::GetStyle();
if (!g_FontTexture) if (!g_FontTexture)
{
ImGui_ImplIOS_CreateDeviceObjects(); ImGui_ImplIOS_CreateDeviceObjects();
}
io.DisplaySize = ImVec2( _view.bounds.size.width, _view.bounds.size.height ); io.DisplaySize = ImVec2(_view.bounds.size.width, _view.bounds.size.height);
io.MouseDrawCursor = g_synergyPtrActive; io.MouseDrawCursor = g_synergyPtrActive;
if (g_synergyPtrActive) if (g_synergyPtrActive)
{ {
style.TouchExtraPadding = ImVec2( 0.0, 0.0 ); style.TouchExtraPadding = ImVec2(0.0, 0.0);
io.MousePos = ImVec2( g_mousePosX, g_mousePosY ); io.MousePos = ImVec2(g_mousePosX, g_mousePosY);
for (int i=0; i < 3; i++) for (int i=0; i < 3; i++)
{
io.MouseDown[i] = g_MousePressed[i]; io.MouseDown[i] = g_MousePressed[i];
}
// This is an arbitrary scaling factor that works for me. Not sure what units these mousewheel values from synergy are supposed to be in. // This is an arbitrary scaling factor that works for me. Not sure what units these mousewheel values from synergy are supposed to be in.
io.MouseWheel = g_mouseWheelY / 500.0; io.MouseWheel = g_mouseWheelY / 500.0;
@ -595,8 +590,8 @@ void ImGui_ClipboardCallback(uSynergyCookie cookie, enum uSynergyClipboardFormat
else else
{ {
// Synergy not active, use touch events // Synergy not active, use touch events
style.TouchExtraPadding = ImVec2( 4.0, 4.0 ); style.TouchExtraPadding = ImVec2(4.0, 4.0);
io.MousePos = ImVec2(_touchPos.x, _touchPos.y ); io.MousePos = ImVec2(_touchPos.x, _touchPos.y);
if ((_mouseDown) || (_mouseTapped)) if ((_mouseDown) || (_mouseTapped))
{ {
io.MouseDown[0] = true; io.MouseDown[0] = true;

@ -50,7 +50,7 @@ enum GlfwClientApi
}; };
static GLFWwindow* g_Window = NULL; static GLFWwindow* g_Window = NULL;
static GlfwClientApi g_ClientApi = GlfwClientApi_Unknown; static GlfwClientApi g_ClientApi = GlfwClientApi_Unknown;
static double g_Time = 0.0f; static double g_Time = 0.0;
static bool g_MouseJustPressed[5] = { false, false, false, false, false }; static bool g_MouseJustPressed[5] = { false, false, false, false, false };
static GLFWcursor* g_MouseCursors[ImGuiMouseCursor_Count_] = { 0 }; static GLFWcursor* g_MouseCursors[ImGuiMouseCursor_Count_] = { 0 };
static bool g_WantUpdateMonitors = true; static bool g_WantUpdateMonitors = true;
@ -116,6 +116,7 @@ void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window)
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api) static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
{ {
g_Window = window; g_Window = window;
g_Time = 0.0;
// Setup back-end capabilities flags // Setup back-end capabilities flags
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();

@ -11,6 +11,10 @@
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
// https://github.com/ocornut/imgui // https://github.com/ocornut/imgui
// About GLSL version:
// The 'glsl_version' initialization parameter defaults to "#version 150" if NULL.
// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
struct GLFWwindow; struct GLFWwindow;
IMGUI_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); IMGUI_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);

@ -10,6 +10,7 @@
// (minor and older changes stripped away, please see git history for details) // (minor and older changes stripped away, please see git history for details)
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. // 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2018-XX-XX: OpenGL: Offset projection matrix and clipping rectangle by draw_data->DisplayPos (which will be non-zero for multi-viewport applications). // 2018-XX-XX: OpenGL: Offset projection matrix and clipping rectangle by draw_data->DisplayPos (which will be non-zero for multi-viewport applications).
// 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state.
// 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a NULL pointer. // 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a NULL pointer.
// 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150". // 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150".
// 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context. // 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
@ -44,7 +45,7 @@ static void ImGui_ImplOpenGL3_ShutdownPlatformInterface();
// Functions // Functions
bool ImGui_ImplOpenGL3_Init(const char* glsl_version) bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
{ {
// Store GL version string so we can refer to it later in case we recreate shaders. // Store GLSL version string so we can refer to it later in case we recreate shaders. Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
if (glsl_version == NULL) if (glsl_version == NULL)
glsl_version = "#version 150"; glsl_version = "#version 150";
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersion)); IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersion));
@ -91,7 +92,6 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler); GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer); GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
GLint last_element_array_buffer; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer);
GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array); GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode); GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport); GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
@ -194,7 +194,6 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
glActiveTexture(last_active_texture); glActiveTexture(last_active_texture);
glBindVertexArray(last_vertex_array); glBindVertexArray(last_vertex_array);
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer);
glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha); glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha); glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha);
if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND); if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);

@ -6,7 +6,11 @@
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. // [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled). // [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
IMGUI_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); // About GLSL version:
// The 'glsl_version' initialization parameter defaults to "#version 150" if NULL.
// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
IMGUI_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = "#version 150");
IMGUI_API void ImGui_ImplOpenGL3_Shutdown(); IMGUI_API void ImGui_ImplOpenGL3_Shutdown();
IMGUI_API void ImGui_ImplOpenGL3_NewFrame(); IMGUI_API void ImGui_ImplOpenGL3_NewFrame();
IMGUI_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); IMGUI_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);

@ -711,7 +711,9 @@
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked #pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked
#pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false #pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
#pragma GCC diagnostic ignored "-Wclass-memaccess" // warning: memset/memcpy clearing/writing an object of type xxxx with no trivial copy-assignment; use assignment or value-initialization instead #if __GNUC__ >= 8
#pragma GCC diagnostic ignored "-Wclass-memaccess" // warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
#endif
#endif #endif
// Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall // Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall
@ -5946,14 +5948,15 @@ bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags ext
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding); PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize); PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding); PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
return BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags); bool ret = BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);
PopStyleVar(3);
PopStyleColor();
return ret;
} }
void ImGui::EndChildFrame() void ImGui::EndChildFrame()
{ {
EndChild(); EndChild();
PopStyleVar(3);
PopStyleColor();
} }
// Save and compare stack sizes on Begin()/End() to detect usage errors // Save and compare stack sizes on Begin()/End() to detect usage errors
@ -8624,8 +8627,12 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
bool pressed = false; bool pressed = false;
bool hovered = ItemHoverable(bb, id); bool hovered = ItemHoverable(bb, id);
// Drag source doesn't report as hovered
if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id)
hovered = false;
// Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button // Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button
if ((flags & ImGuiButtonFlags_PressedOnDragDropHold) && g.DragDropActive && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers)) if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
{ {
hovered = true; hovered = true;
@ -12008,13 +12015,13 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
} }
// Horizontally align ourselves with the framed text // Horizontally align ourselves with the framed text
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings; ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
if (!Begin(name, NULL, window_flags)) PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
bool ret = Begin(name, NULL, window_flags);
PopStyleVar();
if (!ret)
{ {
EndPopup(); EndPopup();
PopStyleVar();
IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
return false; return false;
} }
@ -12024,7 +12031,6 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
void ImGui::EndCombo() void ImGui::EndCombo()
{ {
EndPopup(); EndPopup();
PopStyleVar();
} }
// Old API, prefer using BeginCombo() nowadays if you can. // Old API, prefer using BeginCombo() nowadays if you can.
@ -12379,11 +12385,11 @@ bool ImGui::BeginMainMenuBar()
PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0,0)); PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0,0));
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar; ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar;
bool is_open = Begin("##MainMenuBar", NULL, window_flags) && BeginMenuBar(); bool is_open = Begin("##MainMenuBar", NULL, window_flags) && BeginMenuBar();
PopStyleVar(2);
g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f); g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
if (!is_open) if (!is_open)
{ {
End(); End();
PopStyleVar(2);
return false; return false;
} }
return true; return true;
@ -12399,7 +12405,6 @@ void ImGui::EndMainMenuBar()
FocusFrontMostActiveWindow(g.NavWindow); FocusFrontMostActiveWindow(g.NavWindow);
End(); End();
PopStyleVar(2);
} }
bool ImGui::BeginMenuBar() bool ImGui::BeginMenuBar()
@ -12758,7 +12763,8 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border
// Drag and Drop Source // Drag and Drop Source
if (g.ActiveId == id && BeginDragDropSource()) // NB: The ActiveId test is merely an optional micro-optimization // NB: The ActiveId test is merely an optional micro-optimization, BeginDragDropSource() does the same test.
if (g.ActiveId == id && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropSource())
{ {
if (flags & ImGuiColorEditFlags_NoAlpha) if (flags & ImGuiColorEditFlags_NoAlpha)
SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F, &col, sizeof(float) * 3, ImGuiCond_Once); SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F, &col, sizeof(float) * 3, ImGuiCond_Once);
@ -12768,7 +12774,6 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
SameLine(); SameLine();
TextUnformatted("Color"); TextUnformatted("Color");
EndDragDropSource(); EndDragDropSource();
hovered = false;
} }
// Tooltip // Tooltip
@ -13049,7 +13054,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
EndGroup(); EndGroup();
// Drag and Drop Target // Drag and Drop Target
if ((window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect) && BeginDragDropTarget()) // NB: The flag test is merely an optional micro-optimization, BeginDragDropTarget() does the same test. // NB: The flag test is merely an optional micro-optimization, BeginDragDropTarget() does the same test.
if ((window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect) && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropTarget())
{ {
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F)) if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
{ {
@ -14114,6 +14120,10 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
if (g.ActiveId == source_id) // Allow the underlying widget to display/return hovered during the mouse release frame, else we would get a flicker. if (g.ActiveId == source_id) // Allow the underlying widget to display/return hovered during the mouse release frame, else we would get a flicker.
g.ActiveIdAllowOverlap = is_hovered; g.ActiveIdAllowOverlap = is_hovered;
} }
else
{
g.ActiveIdAllowOverlap = false;
}
if (g.ActiveId != source_id) if (g.ActiveId != source_id)
return false; return false;
source_parent_id = window->IDStack.back(); source_parent_id = window->IDStack.back();
@ -14145,7 +14155,11 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
// FIXME-DRAG // FIXME-DRAG
//SetNextWindowPos(g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding); //SetNextWindowPos(g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding);
//PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This is better but e.g ColorButton with checkboard has issue with transparent colors :( //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This is better but e.g ColorButton with checkboard has issue with transparent colors :(
SetNextWindowPos(g.IO.MousePos);
// The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor)
// In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.
ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);
SetNextWindowPos(tooltip_pos);
PushStyleColor(ImGuiCol_PopupBg, GetStyleColorVec4(ImGuiCol_PopupBg) * ImVec4(1.0f, 1.0f, 1.0f, 0.6f)); PushStyleColor(ImGuiCol_PopupBg, GetStyleColorVec4(ImGuiCol_PopupBg) * ImVec4(1.0f, 1.0f, 1.0f, 0.6f));
BeginTooltip(); BeginTooltip();
} }
@ -14659,8 +14673,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
const char* input_source_names[] = { "None", "Mouse", "Nav", "NavKeyboard", "NavGamepad" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT); const char* input_source_names[] = { "None", "Mouse", "Nav", "NavKeyboard", "NavGamepad" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT);
ImGui::Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL"); ImGui::Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL");
ImGui::Text("HoveredRootWindow: '%s'", g.HoveredRootWindow ? g.HoveredRootWindow->Name : "NULL"); ImGui::Text("HoveredRootWindow: '%s'", g.HoveredRootWindow ? g.HoveredRootWindow->Name : "NULL");
ImGui::Text("HoveredId: 0x%08X/0x%08X (%.2f sec)", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not ImGui::Text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
ImGui::Text("ActiveId: 0x%08X/0x%08X (%.2f sec), ActiveIdSource: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, input_source_names[g.ActiveIdSource]); ImGui::Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);
ImGui::Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL"); ImGui::Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
ImGui::Text("MovingWindow: '%s'", g.MovingWindow ? g.MovingWindow->Name : "NULL"); ImGui::Text("MovingWindow: '%s'", g.MovingWindow ? g.MovingWindow->Name : "NULL");
ImGui::Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL"); ImGui::Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL");

@ -962,19 +962,20 @@ enum ImGuiColorEditFlags_
ImGuiColorEditFlags_NoTooltip = 1 << 6, // // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. ImGuiColorEditFlags_NoTooltip = 1 << 6, // // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.
ImGuiColorEditFlags_NoLabel = 1 << 7, // // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). ImGuiColorEditFlags_NoLabel = 1 << 7, // // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).
ImGuiColorEditFlags_NoSidePreview = 1 << 8, // // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead. ImGuiColorEditFlags_NoSidePreview = 1 << 8, // // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead.
ImGuiColorEditFlags_NoDragDrop = 1 << 9, // // ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.
// User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user choose and/or call SetColorEditOptions() during startup. // User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user choose and/or call SetColorEditOptions() during startup.
ImGuiColorEditFlags_AlphaBar = 1 << 9, // // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. ImGuiColorEditFlags_AlphaBar = 1 << 16, // // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.
ImGuiColorEditFlags_AlphaPreview = 1 << 10, // // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. ImGuiColorEditFlags_AlphaPreview = 1 << 17, // // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.
ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 11, // // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 18, // // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.
ImGuiColorEditFlags_HDR = 1 << 12, // // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). ImGuiColorEditFlags_HDR = 1 << 19, // // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).
ImGuiColorEditFlags_RGB = 1 << 13, // [Inputs] // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX. ImGuiColorEditFlags_RGB = 1 << 20, // [Inputs] // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX.
ImGuiColorEditFlags_HSV = 1 << 14, // [Inputs] // " ImGuiColorEditFlags_HSV = 1 << 21, // [Inputs] // "
ImGuiColorEditFlags_HEX = 1 << 15, // [Inputs] // " ImGuiColorEditFlags_HEX = 1 << 22, // [Inputs] // "
ImGuiColorEditFlags_Uint8 = 1 << 16, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. ImGuiColorEditFlags_Uint8 = 1 << 23, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255.
ImGuiColorEditFlags_Float = 1 << 17, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. ImGuiColorEditFlags_Float = 1 << 24, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.
ImGuiColorEditFlags_PickerHueBar = 1 << 18, // [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value. ImGuiColorEditFlags_PickerHueBar = 1 << 25, // [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value.
ImGuiColorEditFlags_PickerHueWheel = 1 << 19, // [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value. ImGuiColorEditFlags_PickerHueWheel = 1 << 26, // [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value.
// [Internal] Masks // [Internal] Masks
ImGuiColorEditFlags__InputsMask = ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_HSV|ImGuiColorEditFlags_HEX, ImGuiColorEditFlags__InputsMask = ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_HSV|ImGuiColorEditFlags_HEX,
@ -1215,7 +1216,7 @@ namespace ImGui
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Helper: Lightweight 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). // Helper: Lightweight 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).
// *Important* Our implementation does NOT call C++ constructors/destructors. This is intentional, we do not require it but you have to be mindful of that. Do not use this class as a straight std::vector replacement in your code! // *Important* Our implementation does NOT call C++ constructors/destructors. This is intentional, we do not require it but you have to be mindful of that. Do _not_ use this class as a std::vector replacement in your code!
template<typename T> template<typename T>
class ImVector class ImVector
{ {
@ -1267,11 +1268,13 @@ public:
Capacity = new_capacity; Capacity = new_capacity;
} }
// NB: &v cannot be pointing inside the ImVector Data itself! e.g. v.push_back(v[10]) is forbidden. // NB: It is forbidden to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden.
inline void push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; } inline void push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; }
inline void pop_back() { IM_ASSERT(Size > 0); Size--; } inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
inline void push_front(const value_type& v) { if (Size == 0) push_back(v); else insert(Data, v); } inline void push_front(const value_type& v) { if (Size == 0) push_back(v); else insert(Data, v); }
inline iterator erase(const_iterator it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; } inline iterator erase(const_iterator it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; }
inline iterator erase(const_iterator it, const_iterator it_last){ IM_ASSERT(it >= Data && it < Data+Size && it_last > it && it_last <= Data+Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(value_type)); Size -= (int)count; return Data + off; }
inline iterator erase_unsorted(const_iterator it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(value_type)); Size--; return Data + off; }
inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; } inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
inline bool contains(const value_type& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; } inline bool contains(const value_type& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
}; };

@ -862,13 +862,15 @@ void ImGui::ShowDemoWindow(bool* p_open)
static bool alpha_preview = true; static bool alpha_preview = true;
static bool alpha_half_preview = false; static bool alpha_half_preview = false;
static bool drag_and_drop = true;
static bool options_menu = true; static bool options_menu = true;
static bool hdr = false; static bool hdr = false;
ImGui::Checkbox("With Alpha Preview", &alpha_preview); ImGui::Checkbox("With Alpha Preview", &alpha_preview);
ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview); ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview);
ImGui::Checkbox("With Drag and Drop", &drag_and_drop);
ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options."); ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options.");
ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets."); ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions); int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (drag_and_drop ? 0 : ImGuiColorEditFlags_NoDragDrop) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions);
ImGui::Text("Color widget:"); ImGui::Text("Color widget:");
ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nCTRL+click on individual component to input value.\n"); ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nCTRL+click on individual component to input value.\n");

@ -54,7 +54,9 @@
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
#pragma GCC diagnostic ignored "-Wclass-memaccess" // warning: memset/memcpy clearing/writing an object of type xxxx with no trivial copy-assignment; use assignment or value-initialization instead #if __GNUC__ >= 8
#pragma GCC diagnostic ignored "-Wclass-memaccess" // warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
#endif
#endif #endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------

Loading…
Cancel
Save