Compare commits
177 Commits
Author | SHA1 | Date | |
---|---|---|---|
1c4008aa97 | |||
9e0f24dcb6 | |||
ac0fcbca46 | |||
92edb7a4e3 | |||
ec148988f0 | |||
2598d26c73 | |||
f9634feb66 | |||
220e6a55b7 | |||
1b61b6b208 | |||
db790dab4c | |||
b127027cbd | |||
e476b7e727 | |||
af50ebe7b6 | |||
4dea0327e7 | |||
a082692b0a | |||
06e917f135 | |||
042f88e5f0 | |||
3612885dea | |||
0810d57819 | |||
e28b1078f5 | |||
abaa274592 | |||
102d5e6de6 | |||
7011d87bf8 | |||
7d9d9bc34e | |||
7268c65d73 | |||
3fdfac3377 | |||
ea9f5d7600 | |||
8d639ec60d | |||
ea1906004b | |||
5122c76441 | |||
68448c5faa | |||
975b5a7310 | |||
2dc5ec95d7 | |||
9f393c38e9 | |||
24ff259816 | |||
4de6e1f7e4 | |||
0fd6e9bc0d | |||
e6c78f9470 | |||
5942c08143 | |||
f23d29b481 | |||
4910629f6a | |||
73fa5c29f4 | |||
bb2de30e3e | |||
ac39c4b2a8 | |||
341ebd961b | |||
8972ebae73 | |||
4e33aeed82 | |||
caaa746424 | |||
d4cd121ae1 | |||
fda9dc8e18 | |||
421dc19798 | |||
9c0805010f | |||
d5793102db | |||
34203d5008 | |||
e3eb4111cc | |||
35124cdd07 | |||
0065fe16a2 | |||
9d8a0374d3 | |||
0905202f44 | |||
9e9c8a8991 | |||
bc6ac8b2ae | |||
00e29832d4 | |||
498c0dcb4c | |||
fd2a90ee60 | |||
d69b2a1c1d | |||
6011ddf1e5 | |||
cc64bd9e3c | |||
87e2fea09d | |||
b1fc988c6b | |||
b217251a63 | |||
671e516377 | |||
65b46f62ef | |||
7e1678ff00 | |||
faf2c34149 | |||
79ae6d3bf6 | |||
e13e5982ff | |||
f88bf9cea3 | |||
067edd09f9 | |||
a7ac9e8346 | |||
d5400d9517 | |||
4d5dcdb57a | |||
f05aede098 | |||
80db2383d8 | |||
2a67aeaa3d | |||
81562b2b5a | |||
15a93d6fe3 | |||
6d78045ff8 | |||
b5b972d0ef | |||
faa7dad537 | |||
544db70852 | |||
fc737d2333 | |||
f9e8b5c652 | |||
6211f40f3d | |||
28c1a9857e | |||
63df9d6311 | |||
84183f5bb6 | |||
dd0d5debef | |||
0b045d8de5 | |||
7adac4ab3e | |||
0c88fad6c2 | |||
357534e588 | |||
3a522b2400 | |||
ff83d0e369 | |||
528b50a89f | |||
4b8ce24e46 | |||
4ebd442a24 | |||
e07f5d4c78 | |||
ec76009bc4 | |||
af38a5c41a | |||
fded746d03 | |||
048add5ef2 | |||
d016ef1825 | |||
93321d3280 | |||
7e59eb026b | |||
0c207b7bc9 | |||
d3be9185b3 | |||
73e13a0762 | |||
abe7b190dc | |||
badde9a970 | |||
b629f90393 | |||
5e73e969fb | |||
23288547ec | |||
59fb3274a7 | |||
9007dff5eb | |||
fff014dfed | |||
b829671df1 | |||
de13261f1b | |||
4dfb9ef751 | |||
dc021f1c23 | |||
17f36038e0 | |||
7033b2043b | |||
c7016c25e8 | |||
0708f91617 | |||
6201cad2b4 | |||
17efd7b3b0 | |||
bd6097ac6f | |||
64938178b7 | |||
a33f0d1f7f | |||
3a42eb6620 | |||
b0cdfe0ece | |||
c790723cfa | |||
89e2ddf07f | |||
569e0f07f1 | |||
839e4d34bd | |||
c3f9220c15 | |||
d11d211e5d | |||
93950b8c32 | |||
42bf149ac6 | |||
d64157e803 | |||
0146f4b456 | |||
7b2662d245 | |||
deb7aa29cd | |||
0d7e779b37 | |||
665bd1e140 | |||
a765c83bad | |||
ddb09c6011 | |||
645ab6633c | |||
c4e34aaace | |||
b62cc5c150 | |||
6e67afc500 | |||
62b3d7c51e | |||
ecd9a223e3 | |||
004fe8916a | |||
242d7e0b0b | |||
b16603745c | |||
7adae3299e | |||
42a919f303 | |||
79153cf19f | |||
14ceaaf460 | |||
9d67d18d86 | |||
a1ec7723ef | |||
c1d8dee6c5 | |||
fb0106fad2 | |||
20e89201cb | |||
a402edb66c | |||
e54b61aa0f | |||
fac0c801da |
23
.github/CONTRIBUTING.md
vendored
@ -4,6 +4,9 @@ Hello!
|
|||||||
|
|
||||||
You may use the Issue Tracker to submit bug reports, feature requests or suggestions. You may ask for help or advice as well. However please read this wall of text before doing so. The amount of incomplete or ambiguous requests due to people not following those guidelines is often overwhelming. Please do your best to clarify your request. Thank you!
|
You may use the Issue Tracker to submit bug reports, feature requests or suggestions. You may ask for help or advice as well. However please read this wall of text before doing so. The amount of incomplete or ambiguous requests due to people not following those guidelines is often overwhelming. Please do your best to clarify your request. Thank you!
|
||||||
|
|
||||||
|
**IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS**
|
||||||
|
- Please post on the "Getting Started" Discourse forum: https://discourse.dearimgui.org/c/getting-started
|
||||||
|
|
||||||
**Prerequisites for new users of dear imgui:**
|
**Prerequisites for new users of dear imgui:**
|
||||||
- Please read the FAQ in imgui.cpp.
|
- Please read the FAQ in imgui.cpp.
|
||||||
- Please read misc/fonts/README.txt if your question relates to fonts or text.
|
- Please read misc/fonts/README.txt if your question relates to fonts or text.
|
||||||
@ -14,18 +17,26 @@ You may use the Issue Tracker to submit bug reports, feature requests or suggest
|
|||||||
|
|
||||||
**Guidelines to report an issue or ask a question:**
|
**Guidelines to report an issue or ask a question:**
|
||||||
- Please provide your imgui version number.
|
- Please provide your imgui version number.
|
||||||
- If you are discussing an assert or a crash, please provide a debugger callstack.
|
|
||||||
- Please state if you have made substantial modifications to your copy of imgui.
|
- Please state if you have made substantial modifications to your copy of imgui.
|
||||||
- When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of one of the back-end (imgui_impl_xxx files), or a modified one, or if you built your own.
|
- Try to be explicit with your expectations and what you have tried. What you have in mind or in your code is not obvious to other people.
|
||||||
|
- If you are discussing an assert or a crash, please provide a debugger callstack. Never state "it crashes" without additional information. If you don't know how to use a debugger and retrieve a callstack, learning about it will be useful.
|
||||||
|
- Please make sure that your compilation settings have asserts enabled. Calls to IM_ASSERT() are scattered in the code to help catch common issues. By default IM_ASSERT() calls the standard assert() function. To verify that your asserts are enabled, add the line `IM_ASSERT(false);` in your main() function. Your application should display an error message and abort. If your application report an error, it means that your asserts are disabled. Please make sure they are enabled.
|
||||||
|
- When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of the example back-ends (imgui_impl_XXX files), or a modified one, or if you built your own.
|
||||||
- Please provide a Minimal, Complete and Verifiable Example ([MCVE](https://stackoverflow.com/help/mcve)) to demonstrate your problem. An ideal submission includes a small piece of code that anyone can paste in one of the examples/ application (e.g. in main.cpp or imgui_demo.cpp) to understand and reproduce it. Narrowing your problem to its shortest and purest form is the easiest way to understand it. Please test your shortened code to ensure it actually exhibit the problem. Often while creating the MCVE you will end up solving the problem! Many questions that are missing a standalone verifiable example are missing the actual cause of their issue in the description, which ends up wasting everyone's time.
|
- Please provide a Minimal, Complete and Verifiable Example ([MCVE](https://stackoverflow.com/help/mcve)) to demonstrate your problem. An ideal submission includes a small piece of code that anyone can paste in one of the examples/ application (e.g. in main.cpp or imgui_demo.cpp) to understand and reproduce it. Narrowing your problem to its shortest and purest form is the easiest way to understand it. Please test your shortened code to ensure it actually exhibit the problem. Often while creating the MCVE you will end up solving the problem! Many questions that are missing a standalone verifiable example are missing the actual cause of their issue in the description, which ends up wasting everyone's time.
|
||||||
- Try to attach screenshots to clarify the context. They often convey useful information that are omitted by the description. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
- Try to attach screenshots to clarify the context. They often convey useful information that are omitted by the description. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
||||||
- When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
- When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||||
- Due to frequent abuse of this service from a certain category of users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and less patience for incomplete questions.
|
|
||||||
|
|
||||||
If you have been using dear imgui for a while and/or have been using C/C++ for several years and/or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users of dear imgui will know what information are useful in a given context.
|
**Some unfortunate words of warning**
|
||||||
|
- If you are or were involved in cheating schemes (e.g. DLL injection) for competitive online multi-player games, please don't post here. We won't answer and you will be blocked. We've had too many of you. Please stop.
|
||||||
|
- Due to frequent abuse of this service from aforementioned users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and incomplete questions may be dismissed.
|
||||||
|
|
||||||
|
If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users or members of the community will know what information are useful in a given context.
|
||||||
|
|
||||||
## How to create an Pull Request
|
## How to create an Pull Request
|
||||||
|
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||||
- If you are adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
- When fixing a warning or compilation problem, please post the compiler log and specify the version and OS you are using.
|
||||||
- Try to attach screenshots to clarify the context and demonstrate the feature at a glance. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
- Try to attach screenshots to clarify the context and demonstrate the feature at a glance. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
||||||
|
- Make sure your code follows the coding style already used in imgui (spaces instead of tabs, "local_variable", "FunctionName", "MemberName", etc.). We don't use modern C++ idioms and can compile without C++11.
|
||||||
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR (we can still cherry-pick individual commits).
|
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR (we can still cherry-pick individual commits).
|
||||||
|
|
||||||
|
Thank you for reading!
|
||||||
|
18
.github/issue_template.md
vendored
@ -1,11 +1,13 @@
|
|||||||
You may use the Issue Tracker to ask for help and submit bug reports, feature requests or suggestions.
|
IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS, please post on the "Getting Started" Discourse forum:
|
||||||
|
https://discourse.dearimgui.org/c/getting-started
|
||||||
|
|
||||||
PLEASE CAREFULLY READ THIS DOCUMENT before doing so:
|
Otherwise, you may use this Issue Tracker to ask for help and submit bug reports, feature requests or suggestions. PLEASE CAREFULLY READ THIS DOCUMENT before submitting any issue:
|
||||||
[CONTRIBUTING.md](https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md).
|
https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
||||||
|
(Click "Preview" to turn the URL above into a clickable link)
|
||||||
|
|
||||||
SELECT "PREVIEW CHANGES" TO TURN THE URL ABOVE INTO A CLICKABLE LINK.
|
PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of ShowDemoWindow() including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the CONTRIBUTING.md file linked above.
|
||||||
|
|
||||||
(Delete everything above this section before submitting your issue. Please read the CONTRIBUTING.md file!)
|
(Delete everything above this section before submitting your issue.)
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -13,9 +15,11 @@ SELECT "PREVIEW CHANGES" TO TURN THE URL ABOVE INTO A CLICKABLE LINK.
|
|||||||
|
|
||||||
XXX
|
XXX
|
||||||
|
|
||||||
**Back-end file/Renderer/OS:** _(if the question is related to inputs/rendering/build, otherwise delete this section)_
|
**Back-end file/Renderer/OS:** _(or specify if you are using a custom engine back-end)_
|
||||||
|
|
||||||
XXX
|
Back-ends: imgui_impl_XXX.cpp + imgui_impl_XXX.cpp
|
||||||
|
OS: XXX
|
||||||
|
Compiler: XXX _(if the question is related to building)_
|
||||||
|
|
||||||
**My Issue/Question:** _(please provide context)_
|
**My Issue/Question:** _(please provide context)_
|
||||||
|
|
||||||
|
6
.github/pull_request_template.md
vendored
@ -1,6 +1,8 @@
|
|||||||
- If you are adding a feature, please explain the context of the change: what do you need the feature for?
|
- Please read https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
||||||
|
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||||
|
- When fixing a warning or compilation problem, please post the compiler log and specify the version and OS you are using.
|
||||||
- Try to attach screenshots to clarify the context and demonstrate the feature at a glance.
|
- Try to attach screenshots to clarify the context and demonstrate the feature at a glance.
|
||||||
|
- Make sure your code follows the coding style already used in imgui (4 spaces instead of tabs, "type* name", "local_variable", "FunctionName", "MemberName", etc.). We don't use modern C++ idioms and can compile without C++11.
|
||||||
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR.
|
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR.
|
||||||
- You can read [CONTRIBUTING.md](https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md) for more details.
|
|
||||||
|
|
||||||
(Clear this form before submitting your PR)
|
(Clear this form before submitting your PR)
|
||||||
|
21
.travis.yml
@ -12,20 +12,23 @@ compiler:
|
|||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- if [ $TRAVIS_OS_NAME == linux ]; then
|
- if [ $TRAVIS_OS_NAME == linux ]; then
|
||||||
sudo apt-get update -qq;
|
sudo apt-get update -qq;
|
||||||
sudo apt-get install -y --no-install-recommends libxrandr-dev libxi-dev libxxf86vm-dev libsdl2-dev;
|
sudo apt-get install -y --no-install-recommends libxrandr-dev libxi-dev libxxf86vm-dev libsdl2-dev;
|
||||||
wget https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip;
|
wget https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip;
|
||||||
unzip glfw-3.2.1.zip && cd glfw-3.2.1;
|
unzip glfw-3.2.1.zip && cd glfw-3.2.1;
|
||||||
cmake -DBUILD_SHARED_LIBS=true -DGLFW_BUILD_EXAMPLES=false -DGLFW_BUILD_TESTS=false -DGLFW_BUILD_DOCS=false .;
|
cmake -DBUILD_SHARED_LIBS=true -DGLFW_BUILD_EXAMPLES=false -DGLFW_BUILD_TESTS=false -DGLFW_BUILD_DOCS=false .;
|
||||||
sudo make -j $CPU_NUM install && cd ..;
|
sudo make -j $CPU_NUM install && cd ..;
|
||||||
fi
|
fi
|
||||||
- if [ $TRAVIS_OS_NAME == osx ]; then
|
- if [ $TRAVIS_OS_NAME == osx ]; then
|
||||||
brew update;
|
brew update;
|
||||||
brew install glfw3;
|
brew install glfw3;
|
||||||
brew install sdl2;
|
brew install sdl2;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make -C examples/example_glfw_opengl2
|
- make -C examples/example_glfw_opengl2
|
||||||
- make -C examples/example_glfw_opengl3
|
- make -C examples/example_glfw_opengl3
|
||||||
- make -C examples/example_sdl_opengl3
|
- make -C examples/example_sdl_opengl3
|
||||||
|
- if [ $TRAVIS_OS_NAME == osx ]; then
|
||||||
|
xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos;
|
||||||
|
fi
|
||||||
|
294
CHANGELOG.txt
@ -29,67 +29,153 @@ HOW TO UPDATE?
|
|||||||
- Please report any issue!
|
- Please report any issue!
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
VERSION 1.63 (Released 2018-08-29)
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Style: Renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete).
|
||||||
|
- Changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecision over time.
|
||||||
|
- Removed per-window ImGuiWindowFlags_ResizeFromAnySide Beta flag in favor `io.ConfigResizeWindowsFromEdges=true` to enable the feature globally. (#1495)
|
||||||
|
The feature is not currently enabled by default because it is not satisfying enough, but will eventually be.
|
||||||
|
- InputText: Renamed ImGuiTextEditCallback to ImGuiInputTextCallback, ImGuiTextEditCallbackData to ImGuiInputTextCallbackData for consistency.
|
||||||
|
Kept redirection types (will obsolete).
|
||||||
|
- InputText: Removed ImGuiTextEditCallbackData::ReadOnly since it is a duplication of (ImGuiTextEditCallbackData::Flags & ImGuiInputTextFlags_ReadOnly).
|
||||||
|
- Renamed IsItemDeactivatedAfterChange() to IsItemDeactivatedAfterEdit() for consistency with new IsItemEdited() API.
|
||||||
|
Kept redirection function (will obsolete soonish as IsItemDeactivatedAfterChange() is very recent).
|
||||||
|
- Renamed io.OptCursorBlink to io.ConfigCursorBlink, io.OptMacOSXBehaviors to io.ConfigMacOSXBehaviors for consistency. (#1427, #473)
|
||||||
|
- Removed obsolete redirection functions: CollapsingHeader() variation with 2 bools - marked obsolete in v1.49, May 2016.
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- ArrowButton: Fixed to honor PushButtonRepeat() setting (and internals' ImGuiItemFlags_ButtonRepeat).
|
||||||
|
- ArrowButton: Setup current line text baseline so that ArrowButton() + SameLine() + Text() are aligned properly.
|
||||||
|
- Nav: Added a CTRL+TAB window list and changed the highlight system accordingly. The change is motivated by upcoming Docking features. (#787)
|
||||||
|
- Nav: Made CTRL+TAB skip menus + skip the current navigation window if is has the ImGuiWindow_NoNavFocus set. (#787)
|
||||||
|
While it was previously possible, you won't be able to CTRL-TAB out and immediately back in a window with the ImGuiWindow_NoNavFocus flag.
|
||||||
|
- Window: Allow menu and popups windows from ignoring the style.WindowMinSize values so short menus/popups are not padded. (#1909)
|
||||||
|
- Window: Added global io.ConfigResizeWindowsFromEdges option to enable resizing windows from their edges and from the lower-left corner. (#1495)
|
||||||
|
- Window: Collapse button shows hovering highlight + clicking and dragging on it allows to drag the window as well.
|
||||||
|
- Added IsItemEdited() to query if the last item modified its value (or was pressed). This is equivalent to the bool returned by most widgets.
|
||||||
|
It is useful in some situation e.g. using InputText() with ImGuiInputTextFlags_EnterReturnsTrue. (#2034)
|
||||||
|
- InputText: Added support for buffer size/capacity changes via the ImGuiInputTextFlags_CallbackResize flag. (#2006, #1443, #1008).
|
||||||
|
- InputText: Fixed not tracking the cursor horizontally when modifying the text buffer through a callback.
|
||||||
|
- InputText: Fixed minor off-by-one issue when submitting a buffer size smaller than the initial zero-terminated buffer contents.
|
||||||
|
- InputText: Fixed a few pathological crash cases on single-line InputText widget with multiple millions characters worth of contents.
|
||||||
|
Because the current text drawing function reserve for a worst-case amount of vertices and how we handle horizontal clipping,
|
||||||
|
we currently just avoid displaying those single-line widgets when they are over a threshold of 2 millions characters,
|
||||||
|
until a better solution is found.
|
||||||
|
- Drag and Drop: Fixed an incorrect assert when dropping a source that is submitted after the target (bug introduced with 1.62 changes
|
||||||
|
related to the addition of IsItemDeactivated()). (#1875, #143)
|
||||||
|
- Drag and Drop: Fixed ImGuiDragDropFlags_SourceNoDisableHover to affect hovering state prior to calling IsItemHovered() + fixed description. (#143)
|
||||||
|
- Drag and Drop: Calling BeginTooltip() between a BeginDragSource()/EndDragSource() or BeginDropTarget()/EndDropTarget() uses adjusted tooltip
|
||||||
|
settings matching the one created when calling BeginDragSource() without the ImGuiDragDropFlags_SourceNoPreviewTooltip flag. (#143)
|
||||||
|
- Drag and Drop: Payload stays available and under the mouse if the source stops being submitted, however the tooltip is replaced by "...". (#1725)
|
||||||
|
- Drag and Drop: Added ImGuiDragDropFlags_SourceAutoExpirePayload flag to force payload to expire if the source stops being submitted. (#1725, #143).
|
||||||
|
- IsItemHovered(): Added ImGuiHoveredFlags_AllowWhenDisabled flag to query hovered status on disabled items. (#1940, #211)
|
||||||
|
- Selectable: Added ImGuiSelectableFlags_Disabled flag in the public API. (#211)
|
||||||
|
- ColorEdit4: Fixed a bug when text input or drag and drop leading to unsaturated HSV values would erroneously alter the resulting color. (#2050)
|
||||||
|
- Misc: Added optional misc/stl/imgui_stl.h wrapper to use with STL types (e.g. InputText with std::string). (#2006, #1443, #1008)
|
||||||
|
- Misc: Added IMGUI_VERSION_NUM for easy compile-time testing. (#2025)
|
||||||
|
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
|
||||||
|
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
|
||||||
|
- Made assertion more clear when trying to call Begin() outside of the NewFrame()..EndFrame() scope. (#1987)
|
||||||
|
- Fixed assertion when transitioning from an active ID to another within a group, affecting ColorPicker (broken in 1.62). (#2023, #820, #956, #1875).
|
||||||
|
- Fixed PushID() from keeping alive the new ID Stack top value (if a previously active widget shared the ID it would be erroneously kept alive).
|
||||||
|
- Fixed horizontal mouse wheel not forwarding the request to the parent window if ImGuiWindowFlags_NoScrollWithMouse is set. (#1463, #1380, #1502)
|
||||||
|
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||||
|
- ImDrawList: Improved handling for worst-case vertices reservation policy when large amount of text (e.g. 1+ million character strings)
|
||||||
|
are being submitted in a single call. It would typically have crashed InputTextMultiline(). (#200)
|
||||||
|
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||||
|
- Metrics: Changed io.MetricsActiveWindows to reflect the number of active windows (!= from visible windows), which is useful
|
||||||
|
for lazy/idle render mechanisms as new windows are typically not visible for one frame.
|
||||||
|
- Metrics: Added io.MetricsRenderWindow to reflect the number of visible windows.
|
||||||
|
- Metrics: Added io.MetricsActiveAllocations, moving away from the cross-context global counters than we previously used. (#1565, #1599, #586)
|
||||||
|
- Demo: Added basic Drag and Drop demo. (#143)
|
||||||
|
- Demo: Modified the Console example to use InsertChars() in the input text callback instead of poking directly into the buffer.
|
||||||
|
Although this won't make a difference in the example itself, using InsertChars() will honor the resizing callback properly. (#2006, #1443, #1008).
|
||||||
|
- Demo: Clarified the use of IsItemHovered()/IsItemActive() right after being in the "Active, Focused, Hovered & Focused Tests" section.
|
||||||
|
- Examples: Tweaked the main.cpp of each example.
|
||||||
|
- Examples: Metal: Added Metal rendering backend. (#1929, #1873) [@warrenm]
|
||||||
|
- Examples: OSX: Added early raw OSX platform backend. (#1873) [@pagghiu, @itamago, @ocornut]
|
||||||
|
- Examples: Added mac OSX & iOS + Metal example in example_apple_metal/. (#1929, #1873) [@warrenm]
|
||||||
|
- Examples: Added mac OSX + OpenGL2 example in example_apple_opengl2/. (#1873)
|
||||||
|
- Examples: OpenGL3: Added shaders more versions of GLSL. (#1938, #1941, #1900, #1513, #1466, etc.)
|
||||||
|
- Examples: OpenGL3: Tweaked the imgui_impl_opengl3.cpp to work as-is with Emscripten + WebGL 2.0. (#1941). [@o-micron]
|
||||||
|
- Examples: OpenGL3: Made the example app default to GL 3.0 + GLSL 130 (instead of GL 3.2 + GLSL 150) unless on Mac.
|
||||||
|
- Examples: OpenGL3: Added error output when shaders fail to compile/link.
|
||||||
|
- Examples: OpenGL3: Added support for glew and glad OpenGL loaders out of the box. (#2001, #2002) [@jdumas]
|
||||||
|
- Examples: OpenGL2: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications. (#1996)
|
||||||
|
- Examples: DirectX10, DirectX11: Fixed unreleased resources in Init and Shutdown functions. (#1944)
|
||||||
|
- Examples: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility. (#1989) [@matt77hias]
|
||||||
|
- Examples: Vulkan: Fixed handling of VkSurfaceCapabilitiesKHR::maxImageCount = 0 case. Tweaked present mode selections.
|
||||||
|
- Examples: Win32, Glfw, SDL: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
VERSION 1.62 (Released 2018-06-22)
|
VERSION 1.62 (Released 2018-06-22)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
||||||
- TreeNodeEx(): The helper ImGuiTreeNodeFlags_CollapsingHeader flag now include ImGuiTreeNodeFlags_NoTreePushOnOpen. The flag was already set by CollapsingHeader().
|
- TreeNodeEx(): The helper ImGuiTreeNodeFlags_CollapsingHeader flag now include ImGuiTreeNodeFlags_NoTreePushOnOpen. The flag was already set by CollapsingHeader().
|
||||||
The only difference is if you were using TreeNodeEx() manually with ImGuiTreeNodeFlags_CollapsingHeader and without ImGuiTreeNodeFlags_NoTreePushOnOpen.
|
The only difference is if you were using TreeNodeEx() manually with ImGuiTreeNodeFlags_CollapsingHeader and without ImGuiTreeNodeFlags_NoTreePushOnOpen.
|
||||||
In this case you can remove the ImGuiTreeNodeFlags_NoTreePushOnOpen flag from your call (ImGuiTreeNodeFlags_CollapsingHeader & ~ImGuiTreeNodeFlags_NoTreePushOnOpen). (#1864)
|
In this case you can remove the ImGuiTreeNodeFlags_NoTreePushOnOpen flag from your call (ImGuiTreeNodeFlags_CollapsingHeader & ~ImGuiTreeNodeFlags_NoTreePushOnOpen). (#1864)
|
||||||
This also apply if you were using internal's TreeNodeBehavior() with the ImGuiTreeNodeFlags_CollapsingHeader flag directly.
|
This also apply if you were using internal's TreeNodeBehavior() with the ImGuiTreeNodeFlags_CollapsingHeader flag directly.
|
||||||
- ImFontAtlas: Renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish new smaller variants and discourage using the full set. (#1859)
|
- ImFontAtlas: Renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish new smaller variants and discourage using the full set. (#1859)
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
- Examples back-ends have been refactored to separate the platform code (e.g. Win32, Glfw, SDL2) from the renderer code (e.g. DirectX11, OpenGL3, Vulkan).
|
- Examples back-ends have been refactored to separate the platform code (e.g. Win32, Glfw, SDL2) from the renderer code (e.g. DirectX11, OpenGL3, Vulkan).
|
||||||
The "Platform" bindings are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, etc.
|
The "Platform" bindings are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, etc.
|
||||||
The "Renderer" bindings are in charge of: creating the main font texture, rendering imgui draw data.
|
The "Renderer" bindings are in charge of: creating the main font texture, rendering imgui draw data.
|
||||||
before: imgui_impl_dx11.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx11.cpp
|
before: imgui_impl_dx11.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx11.cpp
|
||||||
before: imgui_impl_dx12.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx12.cpp
|
before: imgui_impl_dx12.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx12.cpp
|
||||||
before: imgui_impl_glfw_gl3.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
before: imgui_impl_glfw_gl3.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
||||||
before: imgui_impl_glfw_vulkan.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
|
before: imgui_impl_glfw_vulkan.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
|
||||||
before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp
|
before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp
|
||||||
before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp etc.
|
before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp etc.
|
||||||
- The idea is what we can now easily combine and maintain back-ends and reduce code redundancy. Individual files are smaller and more reusable.
|
- The idea is what we can now easily combine and maintain back-ends and reduce code redundancy. Individual files are smaller and more reusable.
|
||||||
Integration of imgui into a new/custom engine may also be easier as there is less overlap between "windowing / inputs" and "rendering" code,
|
Integration of imgui into a new/custom engine may also be easier as there is less overlap between "windowing / inputs" and "rendering" code,
|
||||||
so you may study or grab one half of the code and not the other.
|
so you may study or grab one half of the code and not the other.
|
||||||
- This change was motivated by the fact that adding support for the upcoming multi-viewport feature requires more work from the Platform and Renderer
|
- This change was motivated by the fact that adding support for the upcoming multi-viewport feature requires more work from the Platform and Renderer
|
||||||
back-ends, and the amount of redundancy across files was becoming too difficult to maintain. If you use default back-ends, you'll benefit from an
|
back-ends, and the amount of redundancy across files was becoming too difficult to maintain. If you use default back-ends, you'll benefit from an
|
||||||
easy update path to support multi-viewports later (for future ImGui 1.7x).
|
easy update path to support multi-viewports later (for future ImGui 1.7x).
|
||||||
- This is not strictly a breaking change if you keep your old bindings, but when you'll want to fully update your bindings,
|
- This is not strictly a breaking change if you keep your old bindings, but when you'll want to fully update your bindings,
|
||||||
expect to have to reshuffle a few things.
|
expect to have to reshuffle a few things.
|
||||||
- Each example still has its own main.cpp which you may refer you to understand how to initialize and glue everything together.
|
- Each example still has its own main.cpp which you may refer you to understand how to initialize and glue everything together.
|
||||||
- Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well.
|
- Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well.
|
||||||
- Read examples/README.txt for details.
|
- Read examples/README.txt for details.
|
||||||
- Added IsItemDeactivated() to query if the last item was active previously and isn't anymore. Useful for Undo/Redo patterns. (#820, #956, #1875)
|
- Added IsItemDeactivated() to query if the last item was active previously and isn't anymore. Useful for Undo/Redo patterns. (#820, #956, #1875)
|
||||||
- Added IsItemDeactivatedAfterChange() if the last item was active previously, isn't anymore, and during its active state modified a value.
|
- Added IsItemDeactivatedAfterChange() [*EDIT* renamed to IsItemDeactivatedAfterEdit() in 1.63) if the last item was active previously,
|
||||||
Note that you may still get false positive (e.g. drag value and while holding return on the same value). (#820, #956, #1875)
|
is not anymore, and during its active state modified a value. Note that you may still get false positive (e.g. drag value and while
|
||||||
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
|
holding return on the same value). (#820, #956, #1875)
|
||||||
- Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
|
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
|
||||||
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
|
- Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
|
||||||
- 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)
|
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
|
||||||
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
|
- 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.
|
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
|
||||||
- Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
|
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
|
||||||
- InputTextMultiline(): Fixed double navigation highlight when scrollbar is active. (#787)
|
- Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
|
||||||
- InputText(): Fixed Undo corruption after pasting large amount of text (Redo will still fail when undo buffers are exhausted, but text won't be corrupted).
|
- InputTextMultiline(): Fixed double navigation highlight when scrollbar is active. (#787)
|
||||||
- SliderFloat(): When using keyboard/gamepad and a zero precision format string (e.g. "%.0f"), always step in integer units. (#1866)
|
- InputText(): Fixed Undo corruption after pasting large amount of text (Redo will still fail when undo buffers are exhausted, but text won't be corrupted).
|
||||||
- ImFontConfig: Added GlyphMinAdvanceX/GlyphMaxAdvanceX settings useful to make a font appears monospaced, particularly useful for icon fonts. (#1869)
|
- SliderFloat(): When using keyboard/gamepad and a zero precision format string (e.g. "%.0f"), always step in integer units. (#1866)
|
||||||
- ImFontAtlas: Added GetGlyphRangesChineseSimplifiedCommon() helper that returns a list of ~2500 most common Simplified Chinese characters. (#1859) [@JX-Master, @ocornut]
|
- ImFontConfig: Added GlyphMinAdvanceX/GlyphMaxAdvanceX settings useful to make a font appears monospaced, particularly useful for icon fonts. (#1869)
|
||||||
- Examples: GLFW: Made it possible to Shutdown/Init the backend again (by reseting the time storage properly). (#1827) [@ice1000]
|
- ImFontAtlas: Added GetGlyphRangesChineseSimplifiedCommon() helper that returns a list of ~2500 most common Simplified Chinese characters. (#1859) [@JX-Master, @ocornut]
|
||||||
- Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
|
- Examples: OSX: Added imgui_impl_osx.mm binding to be used along with e.g. imgui_impl_opengl2.cpp. (#281, #1870) [@pagghiu, @itamago, @ocornut]
|
||||||
- Examples: SDL+Vulkan: Added SDL+Vulkan example.
|
- Examples: GLFW: Made it possible to Shutdown/Init the backend again (by reseting the time storage properly). (#1827) [@ice1000]
|
||||||
- Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag. Added clipboard support.
|
- Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
|
||||||
- Examples: Allegro5: Unindexing buffers ourselves as Allegro indexed drawing primitives are buggy in the DirectX9 back-end (will be fixed in Allegro 5.2.5+).
|
- Examples: SDL+Vulkan: Added SDL+Vulkan example.
|
||||||
- Examples: DirectX12: Moved the ID3D12GraphicsCommandList* parameter from ImGui_ImplDX12_NewFrame() to ImGui_ImplDX12_RenderDrawData() which makes a lots more sense. (#301)
|
- Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag. Added clipboard support.
|
||||||
- Examples: Vulkan: Reordered parameters ImGui_ImplVulkan_RenderDrawData() to be consistent with other bindings, a good occasion since we refactored the code.
|
- Examples: Allegro5: Unindexing buffers ourselves as Allegro indexed drawing primitives are buggy in the DirectX9 back-end (will be fixed in Allegro 5.2.5+).
|
||||||
- Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
|
- Examples: DirectX12: Moved the ID3D12GraphicsCommandList* parameter from ImGui_ImplDX12_NewFrame() to ImGui_ImplDX12_RenderDrawData() which makes a lots more sense. (#301)
|
||||||
- Examples: The functions in imgui_impl_xxx.cpp are prefixed with IMGUI_IMPL_API (which defaults to IMGUI_API) to facilitate some uses. (#1888)
|
- Examples: Vulkan: Reordered parameters ImGui_ImplVulkan_RenderDrawData() to be consistent with other bindings, a good occasion since we refactored the code.
|
||||||
- Examples: Fixed bindings to use ImGuiMouseCursor_COUNT instead of old name ImGuiMouseCursor_Count_ so they can compile with IMGUI_DISABLE_OBSOLETE_FUNCTIONS. (#1887)
|
- Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
|
||||||
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
|
- Examples: The functions in imgui_impl_xxx.cpp are prefixed with IMGUI_IMPL_API (which defaults to IMGUI_API) to facilitate some uses. (#1888)
|
||||||
- Internals: PushItemFlag() flags are inherited by BeginChild().
|
- Examples: Fixed bindings to use ImGuiMouseCursor_COUNT instead of old name ImGuiMouseCursor_Count_ so they can compile with IMGUI_DISABLE_OBSOLETE_FUNCTIONS. (#1887)
|
||||||
|
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
|
||||||
|
- Internals: PushItemFlag() flags are inherited by BeginChild().
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -98,13 +184,13 @@ Other Changes:
|
|||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
||||||
- DragInt(): The default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally any more.
|
- DragInt(): The default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally any more.
|
||||||
If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
|
If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
|
||||||
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code.
|
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code.
|
||||||
If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. "DragInt.*%f" to you find them.
|
If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. "DragInt.*%f" to you find them.
|
||||||
- InputFloat(): Obsoleted InputFloat() functions taking an optional "int decimal_precision" in favor of an equivalent and more flexible "const char* format",
|
- InputFloat(): Obsoleted InputFloat() functions taking an optional "int decimal_precision" in favor of an equivalent and more flexible "const char* format",
|
||||||
consistent with other functions. Kept redirection functions (will obsolete).
|
consistent with other functions. Kept redirection functions (will obsolete).
|
||||||
- Misc: IM_DELETE() helper function added in 1.60 doesn't set the input pointer to NULL, more consistent with standard expectation and allows passing r-values.
|
- Misc: IM_DELETE() helper function added in 1.60 doesn't set the input pointer to NULL, more consistent with standard expectation and allows passing r-values.
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
@ -163,41 +249,41 @@ Various internal refactoring have also been done, as part of the navigation work
|
|||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
||||||
- Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render().
|
- Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render().
|
||||||
e.g. with example backends, call ImDrawData* draw_data = ImGui::GetDrawData(); ImGui_ImplXXXX_RenderDrawData(draw_data).
|
e.g. with example backends, call ImDrawData* draw_data = ImGui::GetDrawData(); ImGui_ImplXXXX_RenderDrawData(draw_data).
|
||||||
- Reorganized context handling to be more explicit: (#1599)
|
- Reorganized context handling to be more explicit: (#1599)
|
||||||
- YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END.
|
- YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END.
|
||||||
- removed Shutdown() function, as DestroyContext() serve this purpose. If you are using an old backend from the examples/ folder, remove the line that calls Shutdown().
|
- removed Shutdown() function, as DestroyContext() serve this purpose. If you are using an old backend from the examples/ folder, remove the line that calls Shutdown().
|
||||||
- you may pass a ImFontAtlas* pointer to CreateContext() to share a font atlas between contexts. Otherwise CreateContext() will create its own font atlas instance.
|
- you may pass a ImFontAtlas* pointer to CreateContext() to share a font atlas between contexts. Otherwise CreateContext() will create its own font atlas instance.
|
||||||
- removed allocator parameters from CreateContext(), they are now setup with SetAllocatorFunctions(), and shared by all contexts.
|
- removed allocator parameters from CreateContext(), they are now setup with SetAllocatorFunctions(), and shared by all contexts.
|
||||||
- removed the default global context and font atlas instance, which were confusing for users of DLL reloading and users of multiple contexts.
|
- removed the default global context and font atlas instance, which were confusing for users of DLL reloading and users of multiple contexts.
|
||||||
- Renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
- Renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
||||||
- Fonts: Moved sample TTF files from extra_fonts/ to misc/fonts/. If you loaded files directly from the imgui repo you may need to update your paths.
|
- Fonts: Moved sample TTF files from extra_fonts/ to misc/fonts/. If you loaded files directly from the imgui repo you may need to update your paths.
|
||||||
- Fonts: changed ImFont::DisplayOffset.y to defaults to 0 instead of +1. Fixed vertical rounding of Ascent/Descent to match TrueType renderer.
|
- Fonts: changed ImFont::DisplayOffset.y to defaults to 0 instead of +1. Fixed vertical rounding of Ascent/Descent to match TrueType renderer.
|
||||||
If you were adding or subtracting (not assigning) to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
If you were adding or subtracting (not assigning) to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||||
- BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
- BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
||||||
- Obsoleted IsAnyWindowHovered() in favor of IsWindowHovered(ImGuiHoveredFlags_AnyWindow). Kept redirection function (will obsolete).
|
- Obsoleted IsAnyWindowHovered() in favor of IsWindowHovered(ImGuiHoveredFlags_AnyWindow). Kept redirection function (will obsolete).
|
||||||
- Obsoleted IsAnyWindowFocused() in favor of IsWindowFocused(ImGuiFocusedFlags_AnyWindow). Kept redirection function (will obsolete).
|
- Obsoleted IsAnyWindowFocused() in favor of IsWindowFocused(ImGuiFocusedFlags_AnyWindow). Kept redirection function (will obsolete).
|
||||||
- Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, not used by core, and honored by some binding ahead of merging the Nav branch).
|
- Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, not used by core, and honored by some binding ahead of merging the Nav branch).
|
||||||
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
||||||
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
||||||
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it should be easy to replicate on your side (you can find the code in 1.53).
|
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it should be easy to replicate on your side (you can find the code in 1.53).
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
- Doc: Added a Changelog file in the repository to ease comparing versions (it goes back to dear imgui 1.48), until now it was only on GitHub.
|
- Doc: Added a Changelog file in the repository to ease comparing versions (it goes back to dear imgui 1.48), until now it was only on GitHub.
|
||||||
- Navigation: merged in the gamepad/keyboard navigation (about a million changes!). (#787, #323)
|
- Navigation: merged in the gamepad/keyboard navigation (about a million changes!). (#787, #323)
|
||||||
The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
||||||
- To use Gamepad Navigation:
|
- To use Gamepad Navigation:
|
||||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.
|
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.
|
||||||
- Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame(). Read imgui.cpp for more details.
|
- Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame(). Read imgui.cpp for more details.
|
||||||
- See https://github.com/ocornut/imgui/issues/1599 for recommended gamepad mapping or download PNG/PSD at http://goo.gl/9LgVZW
|
- See https://github.com/ocornut/imgui/issues/1599 for recommended gamepad mapping or download PNG/PSD at http://goo.gl/9LgVZW
|
||||||
- See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. Read imgui.cpp for more details.
|
- See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. Read imgui.cpp for more details.
|
||||||
- To use Keyboard Navigation:
|
- To use Keyboard Navigation:
|
||||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
||||||
- Basic controls: arrows to navigate, Alt to enter menus, Space to activate item, Enter to edit text, Escape to cancel/close, Ctrl-Tab to focus windows, etc.
|
- Basic controls: arrows to navigate, Alt to enter menus, Space to activate item, Enter to edit text, Escape to cancel/close, Ctrl-Tab to focus windows, etc.
|
||||||
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag will be set.
|
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag will be set.
|
||||||
For more advanced uses, you may want to read from io.NavActive or io.NavVisible. Read imgui.cpp for more details.
|
For more advanced uses, you may want to read from io.NavActive or io.NavVisible. Read imgui.cpp for more details.
|
||||||
- Navigation: SetItemDefaultFocus() sets the navigation position in addition to scrolling. (#787)
|
- Navigation: SetItemDefaultFocus() sets the navigation position in addition to scrolling. (#787)
|
||||||
- Navigation: Added IsItemFocused(), added IsAnyItemFocused(). (#787)
|
- Navigation: Added IsItemFocused(), added IsAnyItemFocused(). (#787)
|
||||||
- Navigation: Added window flags: ImGuiWindowFlags_NoNav (== ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus).
|
- Navigation: Added window flags: ImGuiWindowFlags_NoNav (== ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus).
|
||||||
@ -210,12 +296,12 @@ Other Changes:
|
|||||||
- Context: You may pass a ImFontAtlas to CreateContext() to specify a font atlas to share. Shared font atlas are not owned by the context and not destroyed along with it. (#1599)
|
- Context: You may pass a ImFontAtlas to CreateContext() to specify a font atlas to share. Shared font atlas are not owned by the context and not destroyed along with it. (#1599)
|
||||||
- Context: Added IMGUI_DISABLE_DEFAULT_ALLOCATORS to disable linking with malloc/free. (#1565, #586, #992, #1007, #1558)
|
- Context: Added IMGUI_DISABLE_DEFAULT_ALLOCATORS to disable linking with malloc/free. (#1565, #586, #992, #1007, #1558)
|
||||||
- IO: Added io.ConfigFlags for user application to store settings for imgui and for the backend:
|
- IO: Added io.ConfigFlags for user application to store settings for imgui and for the backend:
|
||||||
- ImGuiConfigFlags_NavEnableKeyboard: Enable keyboard navigation.
|
- ImGuiConfigFlags_NavEnableKeyboard: Enable keyboard navigation.
|
||||||
- ImGuiConfigFlags_NavEnableGamepad: Enable gamepad navigation (provided ImGuiBackendFlags_HasGamepad is also set by backend).
|
- ImGuiConfigFlags_NavEnableGamepad: Enable gamepad navigation (provided ImGuiBackendFlags_HasGamepad is also set by backend).
|
||||||
- ImGuiConfigFlags_NavEnableSetMousePos: Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward.
|
- ImGuiConfigFlags_NavEnableSetMousePos: Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward.
|
||||||
- ImGuiConfigFlags_NoMouseCursorChange: Instruct backend to not alter mouse cursor shape and visibility (by default the example backend use mouse cursor API of the platform when available)
|
- ImGuiConfigFlags_NoMouseCursorChange: Instruct backend to not alter mouse cursor shape and visibility (by default the example backend use mouse cursor API of the platform when available)
|
||||||
- ImGuiConfigFlags_NoMouse: Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information passed by the backend.
|
- ImGuiConfigFlags_NoMouse: Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information passed by the backend.
|
||||||
- ImGuiConfigFlags_IsSRGB, ImGuiConfigFlags_IsTouchScreen: Flags for general application use.
|
- ImGuiConfigFlags_IsSRGB, ImGuiConfigFlags_IsTouchScreen: Flags for general application use.
|
||||||
- IO: Added io.BackendFlags for backend to store its capabilities (currently: _HasGamepad, _HasMouseCursors, _HasSetMousePos). This will be used more in the next version.
|
- IO: Added io.BackendFlags for backend to store its capabilities (currently: _HasGamepad, _HasMouseCursors, _HasSetMousePos). This will be used more in the next version.
|
||||||
- IO: Added ImGuiKey_Insert, ImGuiKey_Space keys. Setup in all example bindings. (#1541)
|
- IO: Added ImGuiKey_Insert, ImGuiKey_Space keys. Setup in all example bindings. (#1541)
|
||||||
- IO: Added Horizontal Mouse Wheel support for horizontal scrolling. (#1463) [@tseeker]
|
- IO: Added Horizontal Mouse Wheel support for horizontal scrolling. (#1463) [@tseeker]
|
||||||
@ -344,7 +430,7 @@ Breaking Changes:
|
|||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
- Added `io.OptCursorBlink` option to allow disabling cursor blinking. (#1427)
|
- Added `io.OptCursorBlink` option to allow disabling cursor blinking. (#1427) [renamed to io.ConfigCursorBlink in 1.63]
|
||||||
- Added `GetOverlayDrawList()` helper to quickly get access to a ImDrawList that will be rendered in front of every windows.
|
- Added `GetOverlayDrawList()` helper to quickly get access to a ImDrawList that will be rendered in front of every windows.
|
||||||
- Added `GetFrameHeight()` helper which returns `(FontSize + style.FramePadding.y * 2)`.
|
- Added `GetFrameHeight()` helper which returns `(FontSize + style.FramePadding.y * 2)`.
|
||||||
- Drag and Drop: Added Beta API to easily use drag and drop patterns between imgui widgets.
|
- Drag and Drop: Added Beta API to easily use drag and drop patterns between imgui widgets.
|
||||||
@ -631,12 +717,12 @@ Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.50
|
|||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
||||||
- Added a void* user_data parameter to Clipboard function handlers. (#875)
|
- Added a void* user_data parameter to Clipboard function handlers. (#875)
|
||||||
- SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
|
- SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
|
||||||
- Renamed ImDrawList::PathFill() - rarely used directly - to ImDrawList::PathFillConvex() for clarity and consistency.
|
- Renamed ImDrawList::PathFill() - rarely used directly - to ImDrawList::PathFillConvex() for clarity and consistency.
|
||||||
- Removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset.
|
- Removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset.
|
||||||
- Style: style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc.
|
- Style: style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc.
|
||||||
- BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetId() and use it instead of passing string to BeginChild().
|
- BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetId() and use it instead of passing string to BeginChild().
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
@ -695,9 +781,9 @@ Other Changes:
|
|||||||
- Clipboard: Added a void* user_data parameter to Clipboard function handlers. (#875) (BREAKING API)
|
- Clipboard: Added a void* user_data parameter to Clipboard function handlers. (#875) (BREAKING API)
|
||||||
- Internals: Refactor internal text alignment options to use ImVec2, removed ImGuiAlign. (#842, #222)
|
- Internals: Refactor internal text alignment options to use ImVec2, removed ImGuiAlign. (#842, #222)
|
||||||
- Internals: Renamed ImLoadFileToMemory to ImFileLoadToMemory to be consistent with ImFileOpen + fix mismatching .h name. (#917)
|
- Internals: Renamed ImLoadFileToMemory to ImFileLoadToMemory to be consistent with ImFileOpen + fix mismatching .h name. (#917)
|
||||||
- Windows: Fixed Windows default clipboard handler leaving its buffer unfreed on application's exit. (#714)
|
- OS/Windows: Fixed Windows default clipboard handler leaving its buffer unfreed on application's exit. (#714)
|
||||||
- Windows: No default IME handler when compiling for Windows using GCC. (#738)
|
- OS/Windows: No default IME handler when compiling for Windows using GCC. (#738)
|
||||||
- Windows: Now using _wfopen() instead of fopen() to allow passing in paths/filenames with UTF-8 characters. (#917)
|
- OS/Windows: Now using _wfopen() instead of fopen() to allow passing in paths/filenames with UTF-8 characters. (#917)
|
||||||
- Tools: binary_to_compressed_c: Avoid ?? trigraphs sequences in string outputs which break some older compilers. (#839)
|
- Tools: binary_to_compressed_c: Avoid ?? trigraphs sequences in string outputs which break some older compilers. (#839)
|
||||||
- Demo: Added an extra 3-way columns demo.
|
- Demo: Added an extra 3-way columns demo.
|
||||||
- Demo: ShowStyleEditor: show font character map / grid in more details.
|
- Demo: ShowStyleEditor: show font character map / grid in more details.
|
||||||
|
31
README.md
@ -108,7 +108,7 @@ Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/
|
|||||||
_NB: those third-party bindings may be more or less maintained, more or less close to the original API (as people who create language bindings sometimes haven't used the C++ API themselves.. for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
_NB: those third-party bindings may be more or less maintained, more or less close to the original API (as people who create language bindings sometimes haven't used the C++ API themselves.. for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
||||||
|
|
||||||
Languages: (third-party bindings)
|
Languages: (third-party bindings)
|
||||||
- C: [cimgui](https://github.com/Extrawurst/cimgui) and [#1879](https://github.com/ocornut/imgui/issues/1879)
|
- C: [cimgui](https://github.com/Extrawurst/cimgui) or [sonoro1234's cimgui](https://github.com/sonoro1234/cimgui) (more recent update), also see [#1879](https://github.com/ocornut/imgui/issues/1879)
|
||||||
- C#/.Net: [ImGui.NET](https://github.com/mellinoe/ImGui.NET)
|
- C#/.Net: [ImGui.NET](https://github.com/mellinoe/ImGui.NET)
|
||||||
- ChaiScript: [imgui-chaiscript](https://github.com/JuJuBoSc/imgui-chaiscript)
|
- ChaiScript: [imgui-chaiscript](https://github.com/JuJuBoSc/imgui-chaiscript)
|
||||||
- D: [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
|
- D: [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
|
||||||
@ -125,17 +125,15 @@ Languages: (third-party bindings)
|
|||||||
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
||||||
|
|
||||||
Frameworks:
|
Frameworks:
|
||||||
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, OpenGL2, OpenGL3+, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, Metal, OpenGL2, OpenGL3+/ES2/ES3, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Platform: GLFW, SDL, Win32, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Unmerged Branch: OSX platform without GLFW/SDL: [#1873](https://github.com/ocornut/imgui/tree/osx)
|
|
||||||
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
||||||
- Unmerged PR: Native Win32 and OSX: [#281](https://github.com/ocornut/imgui/pull/281)
|
|
||||||
- Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421)
|
- Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421)
|
||||||
- Unmerged PR: ORX: [#1843](https://github.com/ocornut/imgui/pull/1843)
|
- Unmerged PR: ORX: [#1843](https://github.com/ocornut/imgui/pull/1843)
|
||||||
- Cinder: [Cinder-ImGui](https://github.com/simongeilfus/Cinder-ImGui)
|
- Cinder: [Cinder-ImGui](https://github.com/simongeilfus/Cinder-ImGui)
|
||||||
- Cocos2d-x: [imguix](https://github.com/c0i/imguix), [issue #551](https://github.com/ocornut/imgui/issues/551)
|
- Cocos2d-x: [imguix](https://github.com/c0i/imguix), [issue #551](https://github.com/ocornut/imgui/issues/551)
|
||||||
- Flexium/SFML: [FlexGUI](https://github.com/DXsmiley/FlexGUI)
|
- Flexium: [FlexGUI](https://github.com/DXsmiley/FlexGUI)
|
||||||
- GML/GameMakerStudio2: [ImGuiGML](https://marketplace.yoyogames.com/assets/6221/imguigml)
|
- GML/GameMakerStudio2: [ImGuiGML](https://marketplace.yoyogames.com/assets/6221/imguigml)
|
||||||
- Irrlicht: [IrrIMGUI](https://github.com/ZahlGraf/IrrIMGUI)
|
- Irrlicht: [IrrIMGUI](https://github.com/ZahlGraf/IrrIMGUI)
|
||||||
- Ogre: [ogreimgui](https://bitbucket.org/LMCrashy/ogreimgui/src)
|
- Ogre: [ogreimgui](https://bitbucket.org/LMCrashy/ogreimgui/src)
|
||||||
@ -144,8 +142,8 @@ Frameworks:
|
|||||||
- LÖVE+Lua: [love-imgui](https://github.com/slages/love-imgui)
|
- LÖVE+Lua: [love-imgui](https://github.com/slages/love-imgui)
|
||||||
- Magnum: [magnum-imgui](https://github.com/lecopivo/magnum-imgui), [MagnumImguiPort](https://github.com/lecopivo/MagnumImguiPort)
|
- Magnum: [magnum-imgui](https://github.com/lecopivo/magnum-imgui), [MagnumImguiPort](https://github.com/lecopivo/MagnumImguiPort)
|
||||||
- NanoRT: [syoyo/imgui](https://github.com/syoyo/imgui/tree/nanort)
|
- NanoRT: [syoyo/imgui](https://github.com/syoyo/imgui/tree/nanort)
|
||||||
- Qt3d: [imgui-qt3d](https://github.com/alpqr/imgui-qt3d)
|
- Qt3d: [imgui-qt3d](https://github.com/alpqr/imgui-qt3d), QOpenGLWindow [qtimgui](https://github.com/ocornut/imgui/issues/1910)
|
||||||
- SFML: [imgui-sfml](https://github.com/EliasD/imgui-sfml) or [imgui-backends](https://github.com/Mischa-Alff/imgui-backends)
|
- SFML: [imgui-sfml](https://github.com/EliasD/imgui-sfml)
|
||||||
- Software renderer: [imgui_software_renderer](https://github.com/emilk/imgui_software_renderer)
|
- Software renderer: [imgui_software_renderer](https://github.com/emilk/imgui_software_renderer)
|
||||||
- Unreal Engine 4: [segross/UnrealImGui](https://github.com/segross/UnrealImGui) or [sronsse/UnrealEngine_ImGui](https://github.com/sronsse/UnrealEngine_ImGui)
|
- Unreal Engine 4: [segross/UnrealImGui](https://github.com/segross/UnrealImGui) or [sronsse/UnrealEngine_ImGui](https://github.com/sronsse/UnrealEngine_ImGui)
|
||||||
|
|
||||||
@ -162,14 +160,14 @@ Some of the goals for 2018 are:
|
|||||||
|
|
||||||
Gallery
|
Gallery
|
||||||
-------
|
-------
|
||||||
|
|
||||||
User screenshots:
|
User screenshots:
|
||||||
<br>[Gallery Part 1](https://github.com/ocornut/imgui/issues/123) (Feb 2015 to Feb 2016)
|
<br>[Gallery Part 1](https://github.com/ocornut/imgui/issues/123) (Feb 2015 to Feb 2016)
|
||||||
<br>[Gallery Part 2](https://github.com/ocornut/imgui/issues/539) (Feb 2016 to Aug 2016)
|
<br>[Gallery Part 2](https://github.com/ocornut/imgui/issues/539) (Feb 2016 to Aug 2016)
|
||||||
<br>[Gallery Part 3](https://github.com/ocornut/imgui/issues/772) (Aug 2016 to Jan 2017)
|
<br>[Gallery Part 3](https://github.com/ocornut/imgui/issues/772) (Aug 2016 to Jan 2017)
|
||||||
<br>[Gallery Part 4](https://github.com/ocornut/imgui/issues/973) (Jan 2017 to Aug 2017)
|
<br>[Gallery Part 4](https://github.com/ocornut/imgui/issues/973) (Jan 2017 to Aug 2017)
|
||||||
<br>[Gallery Part 5](https://github.com/ocornut/imgui/issues/1269) (Aug 2017 to Feb 2018)
|
<br>[Gallery Part 5](https://github.com/ocornut/imgui/issues/1269) (Aug 2017 to Feb 2018)
|
||||||
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 onward)
|
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 to June 2018)
|
||||||
|
<br>[Gallery Part 7](https://github.com/ocornut/imgui/issues/1902) (June 2018 onward)
|
||||||
<br>Also see the [Mega screenshots](https://github.com/ocornut/imgui/issues/1273) for an idea of the available features.
|
<br>Also see the [Mega screenshots](https://github.com/ocornut/imgui/issues/1273) for an idea of the available features.
|
||||||
|
|
||||||
Various tools
|
Various tools
|
||||||
@ -213,6 +211,13 @@ The Immediate Mode GUI paradigm may at first appear unusual to some users. This
|
|||||||
|
|
||||||
See the [Wiki](https://github.com/ocornut/imgui/wiki) and [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for third-party bindings to different languages and frameworks.
|
See the [Wiki](https://github.com/ocornut/imgui/wiki) and [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for third-party bindings to different languages and frameworks.
|
||||||
|
|
||||||
|
Support Forums
|
||||||
|
--------------
|
||||||
|
|
||||||
|
If you have issues with: compiling, linking, adding fonts, running or displaying Dear ImGui, or wiring inputs: please post on the Discourse forum: https://discourse.dearimgui.org/c/getting-started.
|
||||||
|
|
||||||
|
For any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues.
|
||||||
|
|
||||||
Frequently Asked Question (FAQ)
|
Frequently Asked Question (FAQ)
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
@ -238,6 +243,7 @@ The library started its life and is best known as "ImGui" only due to the fact t
|
|||||||
<b>How can I tell whether to dispatch mouse/keyboard to imgui or to my application?</b>
|
<b>How can I tell whether to dispatch mouse/keyboard to imgui or to my application?</b>
|
||||||
<br><b>How can I display an image? What is ImTextureID, how does it works?</b>
|
<br><b>How can I display an image? What is ImTextureID, how does it works?</b>
|
||||||
<br><b>How can I have multiple widgets with the same label or without a label? A primer on labels and the ID Stack.</b>
|
<br><b>How can I have multiple widgets with the same label or without a label? A primer on labels and the ID Stack.</b>
|
||||||
|
<br><b>How can I use my own math types instead of ImVec2/ImVec4?</b>
|
||||||
<br><b>How can I load a different font than the default?</b>
|
<br><b>How can I load a different font than the default?</b>
|
||||||
<br><b>How can I easily use icons in my application?</b>
|
<br><b>How can I easily use icons in my application?</b>
|
||||||
<br><b>How can I load multiple fonts?</b>
|
<br><b>How can I load multiple fonts?</b>
|
||||||
@ -314,12 +320,13 @@ Double-chocolate sponsors:
|
|||||||
- Lizardcube
|
- Lizardcube
|
||||||
- Greggman
|
- Greggman
|
||||||
- DotEmu
|
- DotEmu
|
||||||
|
- Nadeo
|
||||||
|
|
||||||
Salty caramel supporters:
|
Salty caramel supporters:
|
||||||
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Recognition Robotics, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko, Mercury Labs, Singularity Demo Group, Mischa Alff, Sebastien Ronsse, Lionel Landwerlin, Nikolay Ivanov, Ron Gilbert, Brandon Townsend, Nikhil Deshpande, Cort Stratton, drudru.
|
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Recognition Robotics, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko, Mercury Labs, Singularity Demo Group, Mischa Alff, Sebastien Ronsse, Lionel Landwerlin, Nikolay Ivanov, Ron Gilbert, Brandon Townsend, Nikhil Deshpande, Cort Stratton, drudru, Harfang 3D, Supercell.
|
||||||
|
|
||||||
Caramel supporters:
|
Caramel supporters:
|
||||||
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Jeff Roberts, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, Kit framework, Josh Faust, Martin Donlon, Quinton, Felix, Andrew Belt, Codecat, Cort Stratton, Claudio Canepa, Doug McNabb, Emmanuel Julien, Guillaume Chereau, Jeffrey Slutter, Jeremiah Deckard, r-lyeh, Roger Clark, Nekith, Joshua Fisher, Malte Hoffmann, Mustafa Karaalioglu, Merlyn Morgan-Graham, Per Vognsen, Fabian Giesen, Jan Staubach, Matt Hargett, John Shearer, Jesse Chounard, kingcoopa, Miloš Tošić, Jonas Bernemann, Johan Andersson, Nathan Hartman, Michael Labbe, Tomasz Golebiowski, Louis Schnellbach, Felipe Alfonso, Jimmy Andrews, Bojan Endrovski, Robin Berg Pettersen, Rachel Crawford, Edsel Malasig, Andrew Johnson, Sean Hunter, Jordan Mellow, Nefarius Software Solutions, Laura Wieme, Robert Nix, Mick Honey.
|
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Jeff Roberts, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, Kit framework, Josh Faust, Martin Donlon, Quinton, Felix, Andrew Belt, Codecat, Cort Stratton, Claudio Canepa, Doug McNabb, Emmanuel Julien, Guillaume Chereau, Jeffrey Slutter, Jeremiah Deckard, r-lyeh, Roger Clark, Nekith, Joshua Fisher, Malte Hoffmann, Mustafa Karaalioglu, Merlyn Morgan-Graham, Per Vognsen, Fabian Giesen, Jan Staubach, Matt Hargett, John Shearer, Jesse Chounard, kingcoopa, Miloš Tošić, Jonas Bernemann, Johan Andersson, Nathan Hartman, Michael Labbe, Tomasz Golebiowski, Louis Schnellbach, Felipe Alfonso, Jimmy Andrews, Bojan Endrovski, Robin Berg Pettersen, Rachel Crawford, Edsel Malasig, Andrew Johnson, Sean Hunter, Jordan Mellow, Nefarius Software Solutions, Laura Wieme, Robert Nix, Mick Honey, Astrofra, Jonas Lehmann, Steven Kah Hien Wong, Bartosz Bielecki.
|
||||||
|
|
||||||
And other supporters; thanks!
|
And other supporters; thanks!
|
||||||
(Please contact me or PR if you would like to be added or removed from this list)
|
(Please contact me or PR if you would like to be added or removed from this list)
|
||||||
|
63
TODO.txt
@ -17,7 +17,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- window: background options for child windows, border option (disable rounding).
|
- window: background options for child windows, border option (disable rounding).
|
||||||
- window: resizing from any sides? done. > need backends to honor mouse cursors properly. (#822)
|
- window: resizing from any sides? done. > need backends to honor mouse cursors properly. (#822)
|
||||||
- window: resize from borders: support some form of outer padding to make it easier to grab borders. (#822)
|
- window: resize from borders: support some form of outer padding to make it easier to grab borders. (#822)
|
||||||
- window: begin with *p_open == false should return false.
|
- window: fix resize glitch when collapsing an AlwaysAutoResize window.
|
||||||
|
- window: begin with *p_open == false could return false.
|
||||||
- window: get size/pos helpers given names (see discussion in #249)
|
- window: get size/pos helpers given names (see discussion in #249)
|
||||||
- window: a collapsed window can be stuck behind the main menu bar?
|
- window: a collapsed window can be stuck behind the main menu bar?
|
||||||
- window: when window is very small, prioritize resize button over close button.
|
- window: when window is very small, prioritize resize button over close button.
|
||||||
@ -28,8 +29,10 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- window: using SetWindowPos() inside Begin() and moving the window with the mouse reacts a very ugly glitch. We should just defer the SetWindowPos() call.
|
- window: using SetWindowPos() inside Begin() and moving the window with the mouse reacts a very ugly glitch. We should just defer the SetWindowPos() call.
|
||||||
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
||||||
- window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate.
|
- window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate.
|
||||||
!- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
|
- window: investigate better auto-positioning for new windows.
|
||||||
|
- 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)
|
||||||
|
- scrolling/style: shadows on scrollable areas to denote that there is more contents
|
||||||
|
|
||||||
- drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded rendering.
|
- 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.
|
||||||
@ -38,9 +41,10 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- 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).
|
||||||
- drawlist/opt: AddRect() axis aligned pixel aligned (no-aa) could use 8 triangles instead of 16 and no normal calculation.
|
|
||||||
- drawlist: rendering: provide a way for imgui to output to a single/global vertex buffer, re-order indices only at the end of the frame (ref: https://gist.github.com/floooh/10388a0afbe08fce9e617d8aefa7d302)
|
- drawlist: rendering: provide a way for imgui to output to a single/global vertex buffer, re-order indices only at the end of the frame (ref: https://gist.github.com/floooh/10388a0afbe08fce9e617d8aefa7d302)
|
||||||
- drawlist: callback: add an extra void* in ImDrawCallback to allow passing render-local data to the callback (would break API).
|
- drawlist: callback: add an extra void* in ImDrawCallback to allow passing render-local data to the callback (would break API).
|
||||||
|
- drawlist/opt: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding. (#1962)
|
||||||
|
- drawlist/opt: AddRect() axis aligned pixel aligned (no-aa) could use 8 triangles instead of 16 and no normal calculation.
|
||||||
|
|
||||||
- main: considering adding an Init() function? some constructs are awkward in the implementation because of the lack of them.
|
- main: considering adding an Init() function? some constructs are awkward in the implementation because of the lack of them.
|
||||||
- main: find a way to preserve relative orders of multiple reappearing windows (so an app toggling between "modes" e.g. fullscreen vs all tools) won't lose relative ordering.
|
- main: find a way to preserve relative orders of multiple reappearing windows (so an app toggling between "modes" e.g. fullscreen vs all tools) won't lose relative ordering.
|
||||||
@ -52,6 +56,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- 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 visuals 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: start exposing PushItemFlag() and ImGuiItemFlags
|
||||||
- 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)
|
||||||
- widgets: a way to represent "mixed" values, so e.g. all values replaced with **, including check-boxes, colors, etc. with support for multi-components widgets (e.g. SliderFloat3, make only "Y" mixed)
|
- widgets: a way to represent "mixed" values, so e.g. all values replaced with **, including check-boxes, colors, etc. with support for multi-components widgets (e.g. SliderFloat3, make only "Y" mixed)
|
||||||
@ -61,20 +66,20 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- input text: expose CursorPos in char filter event (#816)
|
- input text: expose CursorPos in char filter event (#816)
|
||||||
- input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active.
|
- input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active.
|
||||||
- input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701)
|
- input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701)
|
||||||
- input text: way to dynamically grow the buffer without forcing the user to initially allocate for worse case, e.g. more natural std::string (follow up on #200)
|
|
||||||
- input text: hover tooltip could show unclamped text
|
- input text: hover tooltip could show unclamped text
|
||||||
- input text: option to Tab after an Enter validation.
|
- input text: option to Tab after an Enter validation.
|
||||||
- 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 dependent). 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: 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 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 multi-line: single call to AddText() should be coarse clipped on InputTextEx() end.
|
||||||
- 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
|
||||||
@ -102,7 +107,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
|
|
||||||
!- color: the color conversion helpers/types are a mess and needs sorting out.
|
!- color: the color conversion helpers/types are a mess and needs sorting out.
|
||||||
- color: (api breaking) ImGui::ColorConvertXXX functions should be loose ImColorConvertXX to match imgui_internals.h
|
- color: (api breaking) ImGui::ColorConvertXXX functions should be loose ImColorConvertXX to match imgui_internals.h
|
||||||
- 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 vertices (currently issues with averaging normals)
|
- plot: PlotLines() should use the polygon-stroke facilities, less vertices (currently issues with averaging normals)
|
||||||
@ -124,17 +128,17 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
|
|
||||||
- tabs: re-ordering, close buttons, context menu, persistent order (#261, #351)
|
- tabs: re-ordering, close buttons, context menu, persistent order (#261, #351)
|
||||||
|
|
||||||
- ext: stl-ish friendly extension (imgui_stl.h) that has wrapped for std::string, std::vector etc.
|
- ext: stl-ish friendly extension (imgui_stl.h) that has wrapper for std::string, std::vector etc.
|
||||||
|
|
||||||
- button: provide a button that looks framed.
|
- button: provide a button that looks framed.
|
||||||
- image/image button: misalignment on padded/bordered button?
|
- image/image button: misalignment on padded/bordered button?
|
||||||
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
||||||
- image button: not taking an explicit id is odd.
|
- image button: not taking an explicit id is odd.
|
||||||
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
||||||
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar).
|
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar). (#1946)
|
||||||
- slider: add dragging-based widgets to edit values with mouse (on 2 axises), saving screen real-estate.
|
- slider: add dragging-based widgets to edit values with mouse (on 2 axises), saving screen real-estate.
|
||||||
- slider: tint background based on value (e.g. v_min -> v_max, or use 0.0f either side of the sign)
|
- slider: tint background based on value (e.g. v_min -> v_max, or use 0.0f either side of the sign)
|
||||||
- slider: precision dragging
|
- slider: relative dragging? + precision dragging
|
||||||
- slider: step option (#1183)
|
- slider: step option (#1183)
|
||||||
- slider style: fill % of the bar instead of positioning a drag.
|
- slider style: fill % of the bar instead of positioning a drag.
|
||||||
- knob: rotating knob widget (#942)
|
- knob: rotating knob widget (#942)
|
||||||
@ -155,6 +159,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- listbox: scrolling should track modified selection.
|
- listbox: scrolling should track modified selection.
|
||||||
|
|
||||||
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
|
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
|
||||||
|
- popups/modal: make modal title bar blink when trying to click outside the modal
|
||||||
- popups: reopening context menu at new position should be the behavior by default? (equivalent to internal OpenPopupEx() with reopen_existing=true) (~#1497)
|
- popups: reopening context menu at new position should be the behavior by default? (equivalent to internal OpenPopupEx() with reopen_existing=true) (~#1497)
|
||||||
- popups: if the popup functions took explicit ImGuiID it would allow the user to manage the scope of those ID. (#331)
|
- popups: if the popup functions took explicit ImGuiID it would allow the user to manage the scope of those ID. (#331)
|
||||||
- popups: clicking outside (to close popup) and holding shouldn't drag window below.
|
- popups: clicking outside (to close popup) and holding shouldn't drag window below.
|
||||||
@ -163,15 +168,15 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- tooltip: drag and drop with tooltip near monitor edges lose/changes its last direction instead of locking one. The drag and drop tooltip should always follow without changing direction.
|
- tooltip: drag and drop with tooltip near monitor edges lose/changes its last direction instead of locking one. The drag and drop tooltip should always follow without changing direction.
|
||||||
- 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: tooltips with delay timers? or general timer policy? (instantaneous vs timed) (#1485)
|
- tooltip: tooltips with delay timers? or general timer policy? (instantaneous vs timed): IsItemHovered() with timer + implicit aabb-id for items with no ID. (#1485)
|
||||||
|
|
||||||
- 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 modal windows are acting weird.
|
||||||
- statusbar: add a per-window status bar helper similar to what menubar does.
|
- status-bar: add a per-window status bar helper similar to what menu-bar does.
|
||||||
- shortcuts: local-style shortcut api, e.g. parse "&Save"
|
- shortcuts: local-style shortcut api, e.g. parse "&Save"
|
||||||
- shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu
|
- shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu
|
||||||
- shortcuts: programmatically access shortcuts "Focus("&Save"))
|
- shortcuts: programmatically access shortcuts "Focus("&Save"))
|
||||||
- menus: menubars: main menu-bar could affect clamping of windows position (~ akin to modifying DisplayMin)
|
- menus: menu-bar: main menu-bar could affect clamping of windows position (~ akin to modifying DisplayMin)
|
||||||
- menus: hovering from menu to menu on a menu-bar has 1 frame without any menu, which is a little annoying. ideally either 0 either longer.
|
- menus: hovering from menu to menu on a menu-bar has 1 frame without any menu, which is a little annoying. ideally either 0 either longer.
|
||||||
|
|
||||||
- text: selectable text (for copy) as a generic feature (ItemFlags?)
|
- text: selectable text (for copy) as a generic feature (ItemFlags?)
|
||||||
@ -196,7 +201,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
!- style: better default styles. (#707)
|
!- style: better default styles. (#707)
|
||||||
- style: add a highlighted text color (for headers, etc.)
|
- style: add a highlighted text color (for headers, etc.)
|
||||||
- style: border types: out-screen, in-screen, etc. (#447)
|
- style: border types: out-screen, in-screen, etc. (#447)
|
||||||
- style/optimization: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding.
|
|
||||||
- style: add window shadow (fading away from the window. Paint-style calculation of vertices alpha after drawlist would be easier)
|
- style: add window shadow (fading away from the window. Paint-style calculation of vertices alpha after drawlist would be easier)
|
||||||
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
|
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
|
||||||
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
|
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
|
||||||
@ -212,15 +216,17 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- log: let user copy any window content to clipboard easily (CTRL+C on windows? while moving it? context menu?). code is commented because it fails with multiple Begin/End pairs.
|
- log: let user copy any window content to clipboard easily (CTRL+C on windows? while moving it? context menu?). code is commented because it fails with multiple Begin/End pairs.
|
||||||
|
|
||||||
- filters: set a current filter that tree node can automatically query to hide themselves
|
- filters: set a current filter that tree node can automatically query to hide themselves
|
||||||
- filters: handle wildcards (with implicit leading/trailing *), regexps
|
- filters: handle wild-cards (with implicit leading/trailing *), reg-exprs
|
||||||
- filters: fuzzy matches (may use code at blog.forrestthewoods.com/4cffeed33fdb)
|
- filters: fuzzy matches (may use code at blog.forrestthewoods.com/4cffeed33fdb)
|
||||||
|
|
||||||
- drag and drop: add demo. (#143, #479)
|
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov.
|
||||||
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov
|
- drag and drop: allow preview tooltip to be submitted from a different place than the drag source. (#1725)
|
||||||
- drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637)
|
- drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637)
|
||||||
|
- drag and drop: make it easier and provide a demo to have tooltip both are source and target site, with a more detailed one on target site (tooltip ordering problem)
|
||||||
- drag and drop: test with reordering nodes (in a list, or a tree node). (#143)
|
- drag and drop: test with reordering nodes (in a list, or a tree node). (#143)
|
||||||
- drag and drop: test integrating with os drag and drop.
|
- drag and drop: test integrating with os drag and drop (make it easy to do a naive WM_DROPFILE integration)
|
||||||
- drag and drop: make payload optional? (#143)
|
- drag and drop: make payload optional? (#143)
|
||||||
|
- drag and drop: feedback when hovering a modal (cursor?)
|
||||||
- node/graph editor (#306)
|
- node/graph editor (#306)
|
||||||
- pie menus patterns (#434)
|
- pie menus patterns (#434)
|
||||||
- markup: simple markup language for color change? (#902)
|
- markup: simple markup language for color change? (#902)
|
||||||
@ -234,12 +240,14 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- 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: MemoryTTF taking ownership confusing/not obvious, maybe default should be opposite?
|
||||||
|
- font/atlas: add a missing Glyphs.reserve()
|
||||||
- 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.
|
||||||
- font/atlas: allow user to submit its own primitive to be rectpacked, and allow to map them on a Unicode point.
|
- font/atlas: allow user to submit its own primitive to be rectpacked, and allow to map them on a Unicode point.
|
||||||
- font: MemoryTTF taking ownership confusing/not obvious, maybe default should be opposite?
|
- font/draw: vertical and/or rotated text renderer (#705) - vertical is easier clipping wise
|
||||||
- font draw: vertical and/or rotated text renderer (#705) - vertical is easier clipping wise
|
- font/draw: need to be able to specify wrap start position.
|
||||||
- font draw: need to be able to specify wrap start position.
|
- font/draw: better reserve policy for large horizontal block of text (shouldn't reserve for all clipped lines)
|
||||||
- font: imgui_freetype.h alternative renderer (#618)
|
- font: imgui_freetype.h alternative renderer (#618)
|
||||||
- font: optimization: for monospace font (like the default one) we can trim IndexXAdvance as long as trailing value is == FallbackXAdvance (need to make sure TAB is still correct).
|
- font: optimization: for monospace font (like the default one) we can trim IndexXAdvance as long as trailing value is == FallbackXAdvance (need to make sure TAB is still correct).
|
||||||
- font: add support for kerning, probably optional. A) perhaps default to (32..128)^2 matrix ~ 9K entries = 36KB, then hash for non-ascii?. B) or sparse lookup into per-char list?
|
- font: add support for kerning, probably optional. A) perhaps default to (32..128)^2 matrix ~ 9K entries = 36KB, then hash for non-ascii?. B) or sparse lookup into per-char list?
|
||||||
@ -247,15 +255,16 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- font: fix AddRemapChar() to work before font has been built.
|
- font: fix AddRemapChar() to work before font has been built.
|
||||||
- font: (api breaking) removed "TTF" from symbol names. also because it now supports OTF.
|
- font: (api breaking) removed "TTF" from symbol names. also because it now supports OTF.
|
||||||
|
|
||||||
- nav: wrap around logic to allow e.g. grid based layout (pressing NavRight on the right-most element would go to the next row, etc.)
|
- nav: wrap around logic to allow e.g. grid based layout (pressing NavRight on the right-most element would go to the next row, etc.). see internal's NavMoveRequestTryWrapping().
|
||||||
- nav: patterns to make it possible for arrows key to update selection
|
- nav: patterns to make it possible for arrows key to update selection
|
||||||
|
- nav: restore/find nearest navid when current one disappear (e.g. pressed a button that disappear, or perhaps auto restoring when current button change name)
|
||||||
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
|
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
|
||||||
- nav: allow input system to be be more tolerant of io.DeltaTime=0.0f
|
- nav: allow input system to be be more tolerant of io.DeltaTime=0.0f
|
||||||
- nav: ESC within a menu of a child window seems to exit the child window.
|
- nav: ESC within a menu of a child window seems to exit the child window.
|
||||||
- nav: NavFlattened: ESC on a flattened child should select something.
|
- nav: NavFlattened: ESC on a flattened child should select something.
|
||||||
- nav: NavFlattened: broken: in typical usage scenario, the items of a fully clipped child are currently not considered to enter into a NavFlattened child.
|
- nav: NavFlattened: broken: in typical usage scenario, the items of a fully clipped child are currently not considered to enter into a NavFlattened child.
|
||||||
- nav: NavFlattened: init request doesn't select items that are part of a NavFlattened child
|
- nav: NavFlattened: init request doesn't select items that are part of a NavFlattened child
|
||||||
- nav: NavFlattened: cannot access menubar of a flattened child window with Alt/menu key (not a very common use case..).
|
- nav: NavFlattened: cannot access menu-bar of a flattened child window with Alt/menu key (not a very common use case..).
|
||||||
- nav: Left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
|
- nav: Left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
|
||||||
- nav: menus: pressing left-right on a vertically clipped menu bar tends to jump to the collapse/close buttons.
|
- nav: menus: pressing left-right on a vertically clipped menu bar tends to jump to the collapse/close buttons.
|
||||||
- nav: menus: allow pressing Menu to leave a sub-menu.
|
- nav: menus: allow pressing Menu to leave a sub-menu.
|
||||||
@ -286,19 +295,17 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
|
|
||||||
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
||||||
- 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: 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)
|
||||||
|
|
||||||
- remote: make a system like RemoteImGui first-class citizen/project (#75)
|
- remote: make a system like RemoteImGui first-class citizen/project (#75)
|
||||||
|
|
||||||
- demo: find a way to demonstrate textures in the examples application, as it such a a common issue for new users.
|
- demo: find a way to demonstrate textures in the examples application, as it such a a common issue for new users.
|
||||||
- demo: add drag and drop demo.
|
|
||||||
- demo: add vertical separator demo
|
- demo: add vertical separator demo
|
||||||
- demo: add virtual scrolling example?
|
- demo: add virtual scrolling example?
|
||||||
- demo: demonstration Plot offset
|
- demo: demonstration Plot offset
|
||||||
- examples: window minimize, maximize (#583)
|
- examples: window minimize, maximize (#583)
|
||||||
- examples: provide a zero-framerate/idle example.
|
- examples: provide a zero frame-rate/idle example.
|
||||||
- examples: apple: apple_example should be using modern GL3.
|
- examples: apple: example_apple should be using modern GL3.
|
||||||
- examples: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // issue: DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
- examples: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // issue: DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
||||||
- optimization: replace vsnprintf with stb_printf? or enable the defines/infrastructure to allow it (#1038)
|
- optimization: replace vsnprintf with stb_printf? or enable the defines/infrastructure to allow it (#1038)
|
||||||
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
||||||
|
22
examples/.gitignore
vendored
@ -1,21 +1,33 @@
|
|||||||
build/*
|
build/*
|
||||||
*/Debug/*
|
*/Debug/*
|
||||||
*/Release/*
|
*/Release/*
|
||||||
*/ipch/*
|
|
||||||
*/x64/*
|
*/x64/*
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.suo
|
|
||||||
*.vcxproj.user
|
|
||||||
*.o
|
*.o
|
||||||
*.obj
|
*.obj
|
||||||
*.exe
|
*.exe
|
||||||
|
|
||||||
|
## Visual Studio cruft
|
||||||
|
.vs/*
|
||||||
|
*/ipch/*
|
||||||
|
*.opensdf
|
||||||
*.log
|
*.log
|
||||||
*.pdb
|
*.pdb
|
||||||
*.ilk
|
*.ilk
|
||||||
|
*.user
|
||||||
|
*.sdf
|
||||||
|
*.suo
|
||||||
*.VC.db
|
*.VC.db
|
||||||
*.VC.VC.opendb
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
## Xcode cruft
|
||||||
|
.DS_Store
|
||||||
|
project.xcworkspace
|
||||||
|
xcuserdata
|
||||||
|
|
||||||
|
## Emscripten output
|
||||||
|
*.out.js
|
||||||
|
*.out.wasm
|
||||||
|
|
||||||
## Unix executables
|
## Unix executables
|
||||||
example_glfw_opengl2/example_glfw_opengl2
|
example_glfw_opengl2/example_glfw_opengl2
|
||||||
example_glfw_opengl3/example_glfw_opengl3
|
example_glfw_opengl3/example_glfw_opengl3
|
||||||
|
@ -90,21 +90,17 @@ Most the example bindings are split in 2 parts:
|
|||||||
|
|
||||||
- Road-map: Dear ImGui 1.70 (WIP currently in the "viewport" branch) will allows imgui windows to be
|
- Road-map: Dear ImGui 1.70 (WIP currently in the "viewport" branch) will allows imgui windows to be
|
||||||
seamlessly detached from the main application window. This is achieved using an extra layer to the
|
seamlessly detached from the main application window. This is achieved using an extra layer to the
|
||||||
platform and renderer bindings, which allows imgui to communicate platform-specific requests such as
|
platform and renderer bindings, which allows imgui to communicate platform-specific requests.
|
||||||
"create an additional OS window", "create a render context", "get the OS position of this window" etc.
|
If you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
|
||||||
When using this feature, the coupling with your OS/renderer becomes much tighter than a regular imgui
|
improvements and fixes related to viewports and platform windows without extra work on your side.
|
||||||
integration. It is also much more complicated and require more work to integrate correctly.
|
|
||||||
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
|
|
||||||
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
|
|
||||||
Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
|
|
||||||
from improvements and fixes related to viewports and platform windows without extra work on your side.
|
|
||||||
See 'ImGuiPlatformIO' for details.
|
|
||||||
|
|
||||||
List of Platforms Bindings in this repository:
|
List of Platforms Bindings in this repository:
|
||||||
|
|
||||||
imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
|
imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
|
||||||
|
imgui_impl_osx.mm ; macOS native API
|
||||||
imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
|
imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
|
||||||
imgui_impl_win32.cpp ; Windows native API (Windows)
|
imgui_impl_win32.cpp ; Win32 native API (Windows)
|
||||||
imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
|
imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
|
||||||
|
|
||||||
List of Renderer Bindings in this repository:
|
List of Renderer Bindings in this repository:
|
||||||
@ -112,9 +108,10 @@ List of Renderer Bindings in this repository:
|
|||||||
imgui_impl_dx9.cpp ; DirectX9
|
imgui_impl_dx9.cpp ; DirectX9
|
||||||
imgui_impl_dx10.cpp ; DirectX10
|
imgui_impl_dx10.cpp ; DirectX10
|
||||||
imgui_impl_dx11.cpp ; DirectX11
|
imgui_impl_dx11.cpp ; DirectX11
|
||||||
imgui_impl_dx12.cpp ; DirectX12
|
imgui_impl_dx12.cpp ; DirectX12
|
||||||
|
imgui_impl_metal.mm ; Metal (with ObjC)
|
||||||
imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
|
imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
|
||||||
imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
|
imgui_impl_opengl3.cpp ; OpenGL3, OpenGL ES 2, OpenGL ES 3 (modern programmable pipeline)
|
||||||
imgui_impl_vulkan.cpp ; Vulkan
|
imgui_impl_vulkan.cpp ; Vulkan
|
||||||
|
|
||||||
List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
|
List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
|
||||||
@ -143,6 +140,7 @@ Building:
|
|||||||
- Makefiles for Linux/OSX
|
- Makefiles for Linux/OSX
|
||||||
- Batch files for Visual Studio 2008+
|
- Batch files for Visual Studio 2008+
|
||||||
- A .sln project file for Visual Studio 2010+
|
- A .sln project file for Visual Studio 2010+
|
||||||
|
- Xcode project files for the Apple examples
|
||||||
Please let me know if they don't work with your setup!
|
Please let me know if they don't work with your setup!
|
||||||
You can probably just import the imgui_impl_xxx.cpp/.h files into your own codebase or compile those
|
You can probably just import the imgui_impl_xxx.cpp/.h files into your own codebase or compile those
|
||||||
directly with a command-line compiler.
|
directly with a command-line compiler.
|
||||||
@ -165,6 +163,17 @@ example_win32_directx12/
|
|||||||
This is quite long and tedious, because: DirectX12.
|
This is quite long and tedious, because: DirectX12.
|
||||||
= main.cpp + imgui_impl_win32.cpp + imgui_impl_dx12.cpp
|
= main.cpp + imgui_impl_win32.cpp + imgui_impl_dx12.cpp
|
||||||
|
|
||||||
|
example_apple_metal/
|
||||||
|
OSX & iOS + Metal.
|
||||||
|
It is based on the "cross-platform" game template provided with Xcode as of Xcode 9.
|
||||||
|
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
|
||||||
|
= game template + imgui_impl_osx.mm + imgui_impl_metal.mm
|
||||||
|
|
||||||
|
example_apple_opengl2/
|
||||||
|
OSX + OpenGL2.
|
||||||
|
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
|
||||||
|
= main.mm + imgui_impl_osx.mm + imgui_impl_opengl2.cpp
|
||||||
|
|
||||||
example_glfw_opengl2/
|
example_glfw_opengl2/
|
||||||
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
||||||
@ -176,7 +185,7 @@ example_glfw_opengl2/
|
|||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
||||||
|
|
||||||
example_glfw_opengl3/
|
example_glfw_opengl3/
|
||||||
GLFW (Win32, Mac, Linux) + OpenGL3+ example (programmable pipeline, binding modern functions with GL3W).
|
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (programmable pipeline, binding modern functions with GL3W).
|
||||||
This uses more modern OpenGL calls and custom shaders.
|
This uses more modern OpenGL calls and custom shaders.
|
||||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
|
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
|
||||||
@ -197,7 +206,7 @@ example_sdl_opengl2/
|
|||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
||||||
|
|
||||||
example_sdl_opengl3/
|
example_sdl_opengl3/
|
||||||
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+ example.
|
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example.
|
||||||
This uses more modern OpenGL calls and custom shaders.
|
This uses more modern OpenGL calls and custom shaders.
|
||||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
|
||||||
@ -207,13 +216,6 @@ example_sdl_vulkan/
|
|||||||
This is quite long and tedious, because: Vulkan.
|
This is quite long and tedious, because: Vulkan.
|
||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
|
||||||
|
|
||||||
example_apple/
|
|
||||||
OSX & iOS example + OpenGL2.
|
|
||||||
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
|
|
||||||
Consider using the example_glfw_opengl3/ instead.
|
|
||||||
On iOS, Using Synergy to access keyboard/mouse data from server computer.
|
|
||||||
Synergy keyboard integration is rather hacky.
|
|
||||||
|
|
||||||
example_allegro5/
|
example_allegro5/
|
||||||
Allegro 5 example.
|
Allegro 5 example.
|
||||||
= main.cpp + imgui_impl_allegro5.cpp
|
= main.cpp + imgui_impl_allegro5.cpp
|
||||||
|
@ -16,7 +16,7 @@ int main(int, char**)
|
|||||||
al_init_primitives_addon();
|
al_init_primitives_addon();
|
||||||
al_set_new_display_flags(ALLEGRO_RESIZABLE);
|
al_set_new_display_flags(ALLEGRO_RESIZABLE);
|
||||||
ALLEGRO_DISPLAY* display = al_create_display(1280, 720);
|
ALLEGRO_DISPLAY* display = al_create_display(1280, 720);
|
||||||
al_set_window_title(display, "ImGui Allegro 5 example");
|
al_set_window_title(display, "Dear ImGui Allegro 5 example");
|
||||||
ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue();
|
ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue();
|
||||||
al_register_event_source(queue, al_get_display_event_source(display));
|
al_register_event_source(queue, al_get_display_event_source(display));
|
||||||
al_register_event_source(queue, al_get_keyboard_event_source());
|
al_register_event_source(queue, al_get_keyboard_event_source());
|
||||||
@ -75,47 +75,47 @@ int main(int, char**)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplAllegro5_NewFrame();
|
ImGui_ImplAllegro5_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
al_clear_to_color(al_map_rgba_f(clear_color.x, clear_color.y, clear_color.z, clear_color.w));
|
al_clear_to_color(al_map_rgba_f(clear_color.x, clear_color.y, clear_color.z, clear_color.w));
|
||||||
|
3
examples/example_apple/.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
imguiex.xcodeproj/project.xcworkspace/
|
|
||||||
imguiex.xcodeproj/xcuserdata/
|
|
@ -1,43 +0,0 @@
|
|||||||
# iOS / OSX example
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
|
|
||||||
|
|
||||||
This example is the default XCode "OpenGL" example code, modified to support ImGui and [Synergy](http://synergy-project.org/) to share mouse/keyboard on an iOS device.
|
|
||||||
|
|
||||||
It is a rather complex and messy example because of all of the faff required to get an XCode/iOS application running. Refer to the regular OpenGL examples if you want to learn about integrating ImGui. **The code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
|
|
||||||
|
|
||||||
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
|
|
||||||
|
|
||||||
## How to Use on iOS
|
|
||||||
|
|
||||||
* In Synergy, go to Preferences, and uncheck "Use SSL encryption"
|
|
||||||
* Run the example app.
|
|
||||||
* Tap the "servername" button in the corner
|
|
||||||
* Enter the name or the IP of your synergy host
|
|
||||||
* If you had previously connected to a server, you may need to kill and re-start the app.
|
|
||||||
|
|
||||||
## How to Build on OSX
|
|
||||||
|
|
||||||
* Make sure you have install `brew`, if not, please refer to [Homebrew Website](http://brew.sh)
|
|
||||||
* Run the command: `brew install glfw3`
|
|
||||||
* Double click `imguiex.xcodeproj` and select `imguiex-osx` scheme
|
|
||||||
* Click `Run` button
|
|
||||||
|
|
||||||
## Notes and TODOs
|
|
||||||
|
|
||||||
Things that would be nice but I didn't get around to doing:
|
|
||||||
|
|
||||||
* iOS software keyboard not supported for text inputs
|
|
||||||
* iOS hardware (bluetooth) keyboards not supported
|
|
||||||
* Graceful disconnect/reconnect from uSynergy.
|
|
||||||
* Copy/Paste not well-supported
|
|
||||||
|
|
||||||
## C++ on iOS / OSX
|
|
||||||
|
|
||||||
ImGui is a c++ library. If you want to include it directly, rename your Obj-C file to have the ".mm" extension.
|
|
||||||
|
|
||||||
Alternatively, you can wrap your debug code in a C interface, this is what I am demonstrating here with the "debug_hud.h" interface. Either approach works, use whatever you prefer.
|
|
||||||
|
|
||||||
In my case, most of my game code is already in C++ so it's not really an issue and I can use ImGui directly.
|
|
@ -1,13 +0,0 @@
|
|||||||
//
|
|
||||||
// AppDelegate.h
|
|
||||||
// imguiex
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
|
|
||||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
|
||||||
|
|
||||||
@property (strong, nonatomic) UIWindow *window;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
//
|
|
||||||
// AppDelegate.m
|
|
||||||
// imguiex
|
|
||||||
|
|
||||||
#import "AppDelegate.h"
|
|
||||||
|
|
||||||
@interface AppDelegate ()
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation AppDelegate
|
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
||||||
// Override point for customization after application launch.
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
|
||||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
|
||||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
|
||||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
|
||||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
|
||||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
|
||||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
|
||||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
|
||||||
<dependencies>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
|
||||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
|
||||||
</dependencies>
|
|
||||||
<objects>
|
|
||||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
|
||||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="imguiex" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
|
||||||
<rect key="frame" x="20" y="140" width="441" height="43"/>
|
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
|
||||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
</subviews>
|
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
|
|
||||||
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
|
|
||||||
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
|
|
||||||
</constraints>
|
|
||||||
<nil key="simulatedStatusBarMetrics"/>
|
|
||||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
|
||||||
<point key="canvasLocation" x="548" y="455"/>
|
|
||||||
</view>
|
|
||||||
</objects>
|
|
||||||
</document>
|
|
@ -1,44 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BV1-FR-VrT">
|
|
||||||
<dependencies>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
|
||||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
|
||||||
</dependencies>
|
|
||||||
<scenes>
|
|
||||||
<!--Game View Controller-->
|
|
||||||
<scene sceneID="tXr-a1-R10">
|
|
||||||
<objects>
|
|
||||||
<viewController id="BV1-FR-VrT" customClass="GameViewController" sceneMemberID="viewController">
|
|
||||||
<layoutGuides>
|
|
||||||
<viewControllerLayoutGuide type="top" id="8aa-yV-Osq"/>
|
|
||||||
<viewControllerLayoutGuide type="bottom" id="qHh-Mt-9TT"/>
|
|
||||||
</layoutGuides>
|
|
||||||
<view key="view" contentMode="scaleToFill" id="3se-qz-xqx" customClass="GLKView">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="piS-r7-VWh">
|
|
||||||
<rect key="frame" x="16" y="550" width="136" height="30"/>
|
|
||||||
<state key="normal" title="servername">
|
|
||||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
|
||||||
</state>
|
|
||||||
<connections>
|
|
||||||
<action selector="onServernameTapped:" destination="BV1-FR-VrT" eventType="touchUpInside" id="9sO-yv-0be"/>
|
|
||||||
</connections>
|
|
||||||
</button>
|
|
||||||
</subviews>
|
|
||||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="qHh-Mt-9TT" firstAttribute="top" secondItem="piS-r7-VWh" secondAttribute="bottom" constant="20" id="JxW-fj-qni"/>
|
|
||||||
<constraint firstItem="piS-r7-VWh" firstAttribute="leading" secondItem="3se-qz-xqx" secondAttribute="leadingMargin" constant="20" id="w5q-gx-tJj"/>
|
|
||||||
</constraints>
|
|
||||||
</view>
|
|
||||||
<connections>
|
|
||||||
<outlet property="btnServername" destination="piS-r7-VWh" id="9iV-ef-l6M"/>
|
|
||||||
</connections>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
|
||||||
</document>
|
|
@ -1,12 +0,0 @@
|
|||||||
//
|
|
||||||
// GameViewController.h
|
|
||||||
// imguiex
|
|
||||||
|
|
||||||
// This is the OpenGL Example template from XCode, modified to support ImGui
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import <GLKit/GLKit.h>
|
|
||||||
|
|
||||||
@interface GameViewController : GLKViewController
|
|
||||||
|
|
||||||
@end
|
|
@ -1,472 +0,0 @@
|
|||||||
//
|
|
||||||
// GameViewController.m
|
|
||||||
// imguiex
|
|
||||||
//
|
|
||||||
#import "GameViewController.h"
|
|
||||||
#import <OpenGLES/ES2/glext.h>
|
|
||||||
|
|
||||||
#import "imgui_impl_ios.h"
|
|
||||||
#import "debug_hud.h"
|
|
||||||
|
|
||||||
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
|
|
||||||
#define SERVERNAME_KEY @"ServerName"
|
|
||||||
#define SERVERNAME_ALERT_TAG 10
|
|
||||||
|
|
||||||
// Uniform index.
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
UNIFORM_MODELVIEWPROJECTION_MATRIX,
|
|
||||||
UNIFORM_NORMAL_MATRIX,
|
|
||||||
UNIFORM_DIFFUSE_COLOR,
|
|
||||||
UNIFORM_COUNT_
|
|
||||||
};
|
|
||||||
static GLint uniforms[UNIFORM_COUNT_];
|
|
||||||
|
|
||||||
// Attribute index.
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ATTRIB_VERTEX,
|
|
||||||
ATTRIB_NORMAL,
|
|
||||||
ATTRIB_COUNT_
|
|
||||||
};
|
|
||||||
|
|
||||||
static const GLfloat gCubeVertexData[216] =
|
|
||||||
{
|
|
||||||
// Data layout for each line below is:
|
|
||||||
// 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, 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, 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
|
|
||||||
};
|
|
||||||
|
|
||||||
@interface GameViewController () <UIAlertViewDelegate>
|
|
||||||
{
|
|
||||||
GLuint _program;
|
|
||||||
GLKMatrix4 _modelViewProjectionMatrix;
|
|
||||||
GLKMatrix3 _normalMatrix;
|
|
||||||
float _rotation;
|
|
||||||
GLuint _vertexArray;
|
|
||||||
GLuint _vertexBuffer;
|
|
||||||
DebugHUD _hud;
|
|
||||||
}
|
|
||||||
@property (strong, nonatomic) EAGLContext* context;
|
|
||||||
@property (strong, nonatomic) GLKBaseEffect* effect;
|
|
||||||
@property (strong, nonatomic) ImGuiHelper* imgui;
|
|
||||||
@property (weak, nonatomic) IBOutlet UIButton* btnServername;
|
|
||||||
@property (strong, nonatomic) NSString* serverName;
|
|
||||||
|
|
||||||
- (IBAction)onServernameTapped:(id)sender;
|
|
||||||
|
|
||||||
- (void)setupGL;
|
|
||||||
- (void)tearDownGL;
|
|
||||||
|
|
||||||
- (BOOL)loadShaders;
|
|
||||||
- (BOOL)compileShader:(GLuint*)shader type:(GLenum)type file:(NSString*)file;
|
|
||||||
- (BOOL)linkProgram:(GLuint)prog;
|
|
||||||
- (BOOL)validateProgram:(GLuint)prog;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation GameViewController
|
|
||||||
|
|
||||||
- (void)viewDidLoad
|
|
||||||
{
|
|
||||||
[super viewDidLoad];
|
|
||||||
|
|
||||||
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
|
||||||
|
|
||||||
if (!self.context)
|
|
||||||
NSLog(@"Failed to create ES context");
|
|
||||||
|
|
||||||
GLKView *view = (GLKView *)self.view;
|
|
||||||
view.context = self.context;
|
|
||||||
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
|
|
||||||
|
|
||||||
[self.btnServername setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
||||||
|
|
||||||
[self setupGL];
|
|
||||||
|
|
||||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
self.serverName = [userDefaults objectForKey: SERVERNAME_KEY ];
|
|
||||||
self.imgui = [[ImGuiHelper alloc] initWithView:self.view ];
|
|
||||||
if (self.serverName)
|
|
||||||
{
|
|
||||||
[self.btnServername setTitle:self.serverName forState:UIControlStateNormal];
|
|
||||||
[self.imgui connectServer: self.serverName ];
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugHUD_InitDefaults(&_hud);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[self tearDownGL];
|
|
||||||
|
|
||||||
if ([EAGLContext currentContext] == self.context)
|
|
||||||
[EAGLContext setCurrentContext:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
|
||||||
{
|
|
||||||
[super didReceiveMemoryWarning];
|
|
||||||
|
|
||||||
if ([self isViewLoaded] && ([[self view] window] == nil))
|
|
||||||
{
|
|
||||||
self.view = nil;
|
|
||||||
|
|
||||||
[self tearDownGL];
|
|
||||||
|
|
||||||
if ([EAGLContext currentContext] == self.context)
|
|
||||||
[EAGLContext setCurrentContext:nil];
|
|
||||||
self.context = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dispose of any resources that can be recreated.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)prefersStatusBarHidden
|
|
||||||
{
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)onServernameTapped:(id)sender
|
|
||||||
{
|
|
||||||
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Set Server" message:@"Enter server name or IP for uSynergy" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel", nil ];
|
|
||||||
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
|
|
||||||
alert.tag = SERVERNAME_ALERT_TAG; // cheezy way to tell which alert view we're responding to
|
|
||||||
[alert show];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
||||||
{
|
|
||||||
if ((buttonIndex==0) && (alertView.tag == SERVERNAME_ALERT_TAG))
|
|
||||||
{
|
|
||||||
// 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
|
|
||||||
// the usynergy stuff in connectServer
|
|
||||||
BOOL serverNameWasSet = self.serverName.length > 0;
|
|
||||||
NSString *serverName = [[alertView textFieldAtIndex:0] text];
|
|
||||||
|
|
||||||
if ([serverName length] > 0)
|
|
||||||
{
|
|
||||||
self.serverName = serverName;
|
|
||||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
[userDefaults setObject:serverName forKey:SERVERNAME_KEY ];
|
|
||||||
[userDefaults synchronize];
|
|
||||||
|
|
||||||
[self.btnServername setTitle:self.serverName forState:UIControlStateNormal];
|
|
||||||
|
|
||||||
// If we hadn't previously connected, try now
|
|
||||||
if (!serverNameWasSet)
|
|
||||||
{
|
|
||||||
[self.imgui connectServer:self.serverName];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Servername Updated"
|
|
||||||
message:@"Restart the app to connect the server"
|
|
||||||
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
|
|
||||||
[alert show];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setupGL
|
|
||||||
{
|
|
||||||
[EAGLContext setCurrentContext:self.context];
|
|
||||||
|
|
||||||
[self loadShaders];
|
|
||||||
|
|
||||||
self.effect = [[GLKBaseEffect alloc] init];
|
|
||||||
self.effect.light0.enabled = GL_TRUE;
|
|
||||||
self.effect.light0.diffuseColor = GLKVector4Make(1.0f, 0.4f, 0.4f, 1.0f);
|
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
glGenVertexArraysOES(1, &_vertexArray);
|
|
||||||
glBindVertexArrayOES(_vertexArray);
|
|
||||||
|
|
||||||
glGenBuffers(1, &_vertexBuffer);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(gCubeVertexData), gCubeVertexData, GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(GLKVertexAttribPosition);
|
|
||||||
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(0));
|
|
||||||
glEnableVertexAttribArray(GLKVertexAttribNormal);
|
|
||||||
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(12));
|
|
||||||
|
|
||||||
glBindVertexArrayOES(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)tearDownGL
|
|
||||||
{
|
|
||||||
[EAGLContext setCurrentContext:self.context];
|
|
||||||
|
|
||||||
glDeleteBuffers(1, &_vertexBuffer);
|
|
||||||
glDeleteVertexArraysOES(1, &_vertexArray);
|
|
||||||
|
|
||||||
self.effect = nil;
|
|
||||||
|
|
||||||
if (_program)
|
|
||||||
{
|
|
||||||
glDeleteProgram(_program);
|
|
||||||
_program = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - GLKView and GLKViewController delegate methods
|
|
||||||
|
|
||||||
- (void)update
|
|
||||||
{
|
|
||||||
float aspect = fabs(self.view.bounds.size.width / self.view.bounds.size.height);
|
|
||||||
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f);
|
|
||||||
|
|
||||||
self.effect.transform.projectionMatrix = projectionMatrix;
|
|
||||||
|
|
||||||
GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f);
|
|
||||||
baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f);
|
|
||||||
|
|
||||||
// Compute the model view matrix for the object rendered with GLKit
|
|
||||||
GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f);
|
|
||||||
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f);
|
|
||||||
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix);
|
|
||||||
|
|
||||||
self.effect.transform.modelviewMatrix = modelViewMatrix;
|
|
||||||
|
|
||||||
// Compute the model view matrix for the object rendered with ES2
|
|
||||||
modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f);
|
|
||||||
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f);
|
|
||||||
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix);
|
|
||||||
|
|
||||||
_normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL);
|
|
||||||
_modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix);
|
|
||||||
_rotation += self.timeSinceLastUpdate * (_hud.rotation_speed * (M_PI / 180.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
|
|
||||||
{
|
|
||||||
// Start the dear imgui frame
|
|
||||||
[self.imgui newFrame];
|
|
||||||
|
|
||||||
// Create some UI elements
|
|
||||||
DebugHUD_DoInterface( &_hud );
|
|
||||||
|
|
||||||
// Render
|
|
||||||
glClearColor(0.65f, 0.65f, 0.65f, 1.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
glBindVertexArrayOES(_vertexArray);
|
|
||||||
|
|
||||||
// Render the object with GLKit
|
|
||||||
[self.effect prepareToDraw];
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
|
||||||
|
|
||||||
// Render the object again with ES2
|
|
||||||
glUseProgram(_program);
|
|
||||||
glUniformMatrix4fv(uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX], 1, 0, _modelViewProjectionMatrix.m);
|
|
||||||
glUniformMatrix3fv(uniforms[UNIFORM_NORMAL_MATRIX], 1, 0, _normalMatrix.m);
|
|
||||||
glUniform3f(uniforms[UNIFORM_DIFFUSE_COLOR], _hud.cubeColor1[0], _hud.cubeColor1[1], _hud.cubeColor1[2] );
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
|
||||||
|
|
||||||
self.effect.light0.diffuseColor = GLKVector4Make( _hud.cubeColor2[0], _hud.cubeColor2[1], _hud.cubeColor2[2], 1.0f);
|
|
||||||
|
|
||||||
// Render dear imgui as the last thing in the frame if possible
|
|
||||||
[self.imgui render];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - OpenGL ES 2 shader compilation
|
|
||||||
|
|
||||||
- (BOOL)loadShaders
|
|
||||||
{
|
|
||||||
GLuint vertShader, fragShader;
|
|
||||||
NSString *vertShaderPathname, *fragShaderPathname;
|
|
||||||
|
|
||||||
// Create shader program.
|
|
||||||
_program = glCreateProgram();
|
|
||||||
|
|
||||||
// Create and compile vertex shader.
|
|
||||||
vertShaderPathname = [[NSBundle mainBundle] pathForResource:@"Shader" ofType:@"vsh"];
|
|
||||||
if (![self compileShader:&vertShader type:GL_VERTEX_SHADER file:vertShaderPathname]) {
|
|
||||||
NSLog(@"Failed to compile vertex shader");
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create and compile fragment shader.
|
|
||||||
fragShaderPathname = [[NSBundle mainBundle] pathForResource:@"Shader" ofType:@"fsh"];
|
|
||||||
if (![self compileShader:&fragShader type:GL_FRAGMENT_SHADER file:fragShaderPathname]) {
|
|
||||||
NSLog(@"Failed to compile fragment shader");
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attach vertex shader to program.
|
|
||||||
glAttachShader(_program, vertShader);
|
|
||||||
|
|
||||||
// Attach fragment shader to program.
|
|
||||||
glAttachShader(_program, fragShader);
|
|
||||||
|
|
||||||
// Bind attribute locations.
|
|
||||||
// This needs to be done prior to linking.
|
|
||||||
glBindAttribLocation(_program, GLKVertexAttribPosition, "position");
|
|
||||||
glBindAttribLocation(_program, GLKVertexAttribNormal, "normal");
|
|
||||||
|
|
||||||
// Link program.
|
|
||||||
if (![self linkProgram:_program])
|
|
||||||
{
|
|
||||||
NSLog(@"Failed to link program: %d", _program);
|
|
||||||
|
|
||||||
if (vertShader) {
|
|
||||||
glDeleteShader(vertShader);
|
|
||||||
vertShader = 0;
|
|
||||||
}
|
|
||||||
if (fragShader) {
|
|
||||||
glDeleteShader(fragShader);
|
|
||||||
fragShader = 0;
|
|
||||||
}
|
|
||||||
if (_program) {
|
|
||||||
glDeleteProgram(_program);
|
|
||||||
_program = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get uniform locations.
|
|
||||||
uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX] = glGetUniformLocation(_program, "modelViewProjectionMatrix");
|
|
||||||
uniforms[UNIFORM_NORMAL_MATRIX] = glGetUniformLocation(_program, "normalMatrix");
|
|
||||||
uniforms[UNIFORM_DIFFUSE_COLOR] = glGetUniformLocation(_program, "diffuseColor");
|
|
||||||
|
|
||||||
// Release vertex and fragment shaders.
|
|
||||||
if (vertShader)
|
|
||||||
{
|
|
||||||
glDetachShader(_program, vertShader);
|
|
||||||
glDeleteShader(vertShader);
|
|
||||||
}
|
|
||||||
if (fragShader)
|
|
||||||
{
|
|
||||||
glDetachShader(_program, fragShader);
|
|
||||||
glDeleteShader(fragShader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type file:(NSString *)file
|
|
||||||
{
|
|
||||||
GLint status;
|
|
||||||
const GLchar *source;
|
|
||||||
|
|
||||||
source = (GLchar *)[[NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil] UTF8String];
|
|
||||||
if (!source)
|
|
||||||
{
|
|
||||||
NSLog(@"Failed to load vertex shader");
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
*shader = glCreateShader(type);
|
|
||||||
glShaderSource(*shader, 1, &source, NULL);
|
|
||||||
glCompileShader(*shader);
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
|
||||||
GLint logLength;
|
|
||||||
glGetShaderiv(*shader, GL_INFO_LOG_LENGTH, &logLength);
|
|
||||||
if (logLength > 0) {
|
|
||||||
GLchar *log = (GLchar *)malloc(logLength);
|
|
||||||
glGetShaderInfoLog(*shader, logLength, &logLength, log);
|
|
||||||
NSLog(@"Shader compile log:\n%s", log);
|
|
||||||
free(log);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glGetShaderiv(*shader, GL_COMPILE_STATUS, &status);
|
|
||||||
if (status == 0)
|
|
||||||
{
|
|
||||||
glDeleteShader(*shader);
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)linkProgram:(GLuint)prog
|
|
||||||
{
|
|
||||||
GLint status;
|
|
||||||
glLinkProgram(prog);
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
|
||||||
GLint logLength;
|
|
||||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength);
|
|
||||||
if (logLength > 0)
|
|
||||||
{
|
|
||||||
GLchar *log = (GLchar *)malloc(logLength);
|
|
||||||
glGetProgramInfoLog(prog, logLength, &logLength, log);
|
|
||||||
NSLog(@"Program link log:\n%s", log);
|
|
||||||
free(log);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glGetProgramiv(prog, GL_LINK_STATUS, &status);
|
|
||||||
if (status == 0)
|
|
||||||
return NO;
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)validateProgram:(GLuint)prog
|
|
||||||
{
|
|
||||||
GLint logLength, status;
|
|
||||||
|
|
||||||
glValidateProgram(prog);
|
|
||||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength);
|
|
||||||
if (logLength > 0) {
|
|
||||||
GLchar *log = (GLchar *)malloc(logLength);
|
|
||||||
glGetProgramInfoLog(prog, logLength, &logLength, log);
|
|
||||||
NSLog(@"Program validate log:\n%s", log);
|
|
||||||
free(log);
|
|
||||||
}
|
|
||||||
|
|
||||||
glGetProgramiv(prog, GL_VALIDATE_STATUS, &status);
|
|
||||||
if (status == 0)
|
|
||||||
return NO;
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
@ -1,77 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "29x29",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "29x29",
|
|
||||||
"scale" : "3x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "40x40",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "40x40",
|
|
||||||
"scale" : "3x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"size" : "60x60",
|
|
||||||
"idiom" : "iphone",
|
|
||||||
"filename" : "icon_imgui_60@2x~iphone.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"size" : "60x60",
|
|
||||||
"idiom" : "iphone",
|
|
||||||
"filename" : "icon_imgui_60@3x~iphone.png",
|
|
||||||
"scale" : "3x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "29x29",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "29x29",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "40x40",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "40x40",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"size" : "76x76",
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"filename" : "icon_imgui_76~ipad.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"size" : "76x76",
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"filename" : "icon_imgui_76@2x~ipad.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "83.5x83.5",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.5 KiB |
@ -1,10 +0,0 @@
|
|||||||
//
|
|
||||||
// Shader.fsh
|
|
||||||
// imguiex
|
|
||||||
|
|
||||||
varying lowp vec4 colorVarying;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_FragColor = colorVarying;
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
//
|
|
||||||
// Shader.vsh
|
|
||||||
// imguiex
|
|
||||||
|
|
||||||
attribute vec4 position;
|
|
||||||
attribute vec3 normal;
|
|
||||||
|
|
||||||
varying lowp vec4 colorVarying;
|
|
||||||
|
|
||||||
uniform vec3 diffuseColor;
|
|
||||||
uniform mat4 modelViewProjectionMatrix;
|
|
||||||
uniform mat3 normalMatrix;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec3 eyeNormal = normalize(normalMatrix * normal);
|
|
||||||
vec3 lightPosition = vec3(0.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
float nDotVP = max(0.0, dot(eyeNormal, normalize(lightPosition)));
|
|
||||||
|
|
||||||
vec3 colorLit = diffuseColor * nDotVP;
|
|
||||||
colorVarying = vec4( colorLit.x, colorLit.y, colorLit.z, 1.0 );
|
|
||||||
|
|
||||||
gl_Position = modelViewProjectionMatrix * position;
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
//
|
|
||||||
// debug_hud.cpp
|
|
||||||
// imguiex
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "debug_hud.h"
|
|
||||||
#include "imgui.h"
|
|
||||||
|
|
||||||
void DebugHUD_InitDefaults( DebugHUD *hud )
|
|
||||||
{
|
|
||||||
hud->show_demo_window = true;
|
|
||||||
hud->show_another_window = true;
|
|
||||||
hud->rotation_speed = 15.0f;
|
|
||||||
|
|
||||||
hud->cubeColor1[0] = 0.4f;
|
|
||||||
hud->cubeColor1[1] = 0.4f;
|
|
||||||
hud->cubeColor1[2] = 1.0f;
|
|
||||||
hud->cubeColor1[3] = 1.0f;
|
|
||||||
|
|
||||||
hud->cubeColor2[0] = 1.0f;
|
|
||||||
hud->cubeColor2[1] = 0.4f;
|
|
||||||
hud->cubeColor2[2] = 0.4f;
|
|
||||||
hud->cubeColor2[3] = 1.0f;
|
|
||||||
|
|
||||||
hud->clearColor[0] = 0.45f;
|
|
||||||
hud->clearColor[1] = 0.55f;
|
|
||||||
hud->clearColor[2] = 0.60f;
|
|
||||||
hud->clearColor[3] = 1.00f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugHUD_DoInterface(DebugHUD *hud)
|
|
||||||
{
|
|
||||||
// 1. Show a simple window.
|
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
|
||||||
{
|
|
||||||
static float f = 0.0f;
|
|
||||||
static int counter = 0;
|
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
|
||||||
ImGui::ColorEdit3("clear color", hud->clearColor); // Edit 3 floats representing a color
|
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &hud->show_demo_window); // Edit bools storing our windows open/close state
|
|
||||||
ImGui::Checkbox("Another Window", &hud->show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Text("counter = %d", counter);
|
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
|
||||||
if (hud->show_another_window)
|
|
||||||
{
|
|
||||||
ImGui::Begin("Another Window", &hud->show_another_window);
|
|
||||||
ImGui::Text("Hello from another window!");
|
|
||||||
ImGui::ColorEdit3("Cube 1 Color", hud->cubeColor1);
|
|
||||||
ImGui::ColorEdit3("Cube 2 Color", hud->cubeColor2);
|
|
||||||
ImGui::SliderFloat("Rotation Speed", &hud->rotation_speed, 0.0f, 200.0f);
|
|
||||||
if (ImGui::Button("Close Me"))
|
|
||||||
hud->show_another_window = false;
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (hud->show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&hud->show_demo_window);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
//
|
|
||||||
// debug_hud.h
|
|
||||||
// imguiex
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
typedef struct DebugHUD
|
|
||||||
{
|
|
||||||
bool show_demo_window;
|
|
||||||
bool show_another_window;
|
|
||||||
float rotation_speed;
|
|
||||||
float cubeColor1[4];
|
|
||||||
float cubeColor2[4];
|
|
||||||
float clearColor[4];
|
|
||||||
} DebugHUD;
|
|
||||||
|
|
||||||
#if __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DebugHUD_InitDefaults(DebugHUD *hud);
|
|
||||||
void DebugHUD_DoInterface(DebugHUD *hud);
|
|
||||||
|
|
||||||
#if __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
Before Width: | Height: | Size: 12 KiB |
@ -1,22 +0,0 @@
|
|||||||
// ImGui iOS+OpenGL+Synergy binding
|
|
||||||
// In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp.
|
|
||||||
// Providing a standalone iOS application with Synergy integration makes this sample more verbose than others. It also hasn't been tested as much.
|
|
||||||
// Refer to other examples to get an easier understanding of how to integrate ImGui into your existing application.
|
|
||||||
|
|
||||||
// by Joel Davis (joeld42@gmail.com)
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Foundation/Foundation.h>
|
|
||||||
#include <UIKit/UIKit.h>
|
|
||||||
|
|
||||||
@interface ImGuiHelper : NSObject
|
|
||||||
|
|
||||||
- (id) initWithView: (UIView *)view;
|
|
||||||
|
|
||||||
- (void)connectServer: (NSString*)serverName;
|
|
||||||
|
|
||||||
- (void)render;
|
|
||||||
- (void)newFrame;
|
|
||||||
|
|
||||||
@end
|
|
@ -1,803 +0,0 @@
|
|||||||
// ImGui iOS+OpenGL+Synergy binding
|
|
||||||
// In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp.
|
|
||||||
// Providing a standalone iOS application with Synergy integration makes this sample more verbose than others. It also hasn't been tested as much.
|
|
||||||
// Refer to other examples to get an easier understanding of how to integrate ImGui into your existing application.
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// - Clipboard is not supported.
|
|
||||||
|
|
||||||
#import <OpenGLES/ES3/gl.h>
|
|
||||||
#import <OpenGLES/ES3/glext.h>
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
|
|
||||||
#include "imgui_impl_ios.h"
|
|
||||||
#include "imgui.h"
|
|
||||||
|
|
||||||
#include "uSynergy.h"
|
|
||||||
|
|
||||||
// From Carbon HIToolbox/Events.h
|
|
||||||
// FIXME: Keyboard mapping is hacked in because Synergy doesn't give us character but only keycode which aren't really portable if you consider keyboard locale. See https://github.com/ocornut/imgui/pull/247
|
|
||||||
enum {
|
|
||||||
kVK_ANSI_A = 0x00,
|
|
||||||
kVK_ANSI_S = 0x01,
|
|
||||||
kVK_ANSI_D = 0x02,
|
|
||||||
kVK_ANSI_F = 0x03,
|
|
||||||
kVK_ANSI_H = 0x04,
|
|
||||||
kVK_ANSI_G = 0x05,
|
|
||||||
kVK_ANSI_Z = 0x06,
|
|
||||||
kVK_ANSI_X = 0x07,
|
|
||||||
kVK_ANSI_C = 0x08,
|
|
||||||
kVK_ANSI_V = 0x09,
|
|
||||||
kVK_ANSI_B = 0x0B,
|
|
||||||
kVK_ANSI_Q = 0x0C,
|
|
||||||
kVK_ANSI_W = 0x0D,
|
|
||||||
kVK_ANSI_E = 0x0E,
|
|
||||||
kVK_ANSI_R = 0x0F,
|
|
||||||
kVK_ANSI_Y = 0x10,
|
|
||||||
kVK_ANSI_T = 0x11,
|
|
||||||
kVK_ANSI_1 = 0x12,
|
|
||||||
kVK_ANSI_2 = 0x13,
|
|
||||||
kVK_ANSI_3 = 0x14,
|
|
||||||
kVK_ANSI_4 = 0x15,
|
|
||||||
kVK_ANSI_6 = 0x16,
|
|
||||||
kVK_ANSI_5 = 0x17,
|
|
||||||
kVK_ANSI_Equal = 0x18,
|
|
||||||
kVK_ANSI_9 = 0x19,
|
|
||||||
kVK_ANSI_7 = 0x1A,
|
|
||||||
kVK_ANSI_Minus = 0x1B,
|
|
||||||
kVK_ANSI_8 = 0x1C,
|
|
||||||
kVK_ANSI_0 = 0x1D,
|
|
||||||
kVK_ANSI_RightBracket = 0x1E,
|
|
||||||
kVK_ANSI_O = 0x1F,
|
|
||||||
kVK_ANSI_U = 0x20,
|
|
||||||
kVK_ANSI_LeftBracket = 0x21,
|
|
||||||
kVK_ANSI_I = 0x22,
|
|
||||||
kVK_ANSI_P = 0x23,
|
|
||||||
kVK_ANSI_L = 0x25,
|
|
||||||
kVK_ANSI_J = 0x26,
|
|
||||||
kVK_ANSI_Quote = 0x27,
|
|
||||||
kVK_ANSI_K = 0x28,
|
|
||||||
kVK_ANSI_Semicolon = 0x29,
|
|
||||||
kVK_ANSI_Backslash = 0x2A,
|
|
||||||
kVK_ANSI_Comma = 0x2B,
|
|
||||||
kVK_ANSI_Slash = 0x2C,
|
|
||||||
kVK_ANSI_N = 0x2D,
|
|
||||||
kVK_ANSI_M = 0x2E,
|
|
||||||
kVK_ANSI_Period = 0x2F,
|
|
||||||
kVK_ANSI_Grave = 0x32,
|
|
||||||
kVK_ANSI_KeypadDecimal = 0x41,
|
|
||||||
kVK_ANSI_KeypadMultiply = 0x43,
|
|
||||||
kVK_ANSI_KeypadPlus = 0x45,
|
|
||||||
kVK_ANSI_KeypadClear = 0x47,
|
|
||||||
kVK_ANSI_KeypadDivide = 0x4B,
|
|
||||||
kVK_ANSI_KeypadEnter = 0x4C,
|
|
||||||
kVK_ANSI_KeypadMinus = 0x4E,
|
|
||||||
kVK_ANSI_KeypadEquals = 0x51,
|
|
||||||
kVK_ANSI_Keypad0 = 0x52,
|
|
||||||
kVK_ANSI_Keypad1 = 0x53,
|
|
||||||
kVK_ANSI_Keypad2 = 0x54,
|
|
||||||
kVK_ANSI_Keypad3 = 0x55,
|
|
||||||
kVK_ANSI_Keypad4 = 0x56,
|
|
||||||
kVK_ANSI_Keypad5 = 0x57,
|
|
||||||
kVK_ANSI_Keypad6 = 0x58,
|
|
||||||
kVK_ANSI_Keypad7 = 0x59,
|
|
||||||
kVK_ANSI_Keypad8 = 0x5B,
|
|
||||||
kVK_ANSI_Keypad9 = 0x5C
|
|
||||||
};
|
|
||||||
|
|
||||||
/* keycodes for keys that are independent of keyboard layout*/
|
|
||||||
enum {
|
|
||||||
kVK_Return = 0x24,
|
|
||||||
kVK_Tab = 0x30,
|
|
||||||
kVK_Space = 0x31,
|
|
||||||
kVK_Delete = 0x33,
|
|
||||||
kVK_Escape = 0x35,
|
|
||||||
kVK_Command = 0x37,
|
|
||||||
kVK_Shift = 0x38,
|
|
||||||
kVK_CapsLock = 0x39,
|
|
||||||
kVK_Option = 0x3A,
|
|
||||||
kVK_Control = 0x3B,
|
|
||||||
kVK_RightShift = 0x3C,
|
|
||||||
kVK_RightOption = 0x3D,
|
|
||||||
kVK_RightControl = 0x3E,
|
|
||||||
kVK_Function = 0x3F,
|
|
||||||
kVK_F17 = 0x40,
|
|
||||||
kVK_VolumeUp = 0x48,
|
|
||||||
kVK_VolumeDown = 0x49,
|
|
||||||
kVK_Mute = 0x4A,
|
|
||||||
kVK_F18 = 0x4F,
|
|
||||||
kVK_F19 = 0x50,
|
|
||||||
kVK_F20 = 0x5A,
|
|
||||||
kVK_F5 = 0x60,
|
|
||||||
kVK_F6 = 0x61,
|
|
||||||
kVK_F7 = 0x62,
|
|
||||||
kVK_F3 = 0x63,
|
|
||||||
kVK_F8 = 0x64,
|
|
||||||
kVK_F9 = 0x65,
|
|
||||||
kVK_F11 = 0x67,
|
|
||||||
kVK_F13 = 0x69,
|
|
||||||
kVK_F16 = 0x6A,
|
|
||||||
kVK_F14 = 0x6B,
|
|
||||||
kVK_F10 = 0x6D,
|
|
||||||
kVK_F12 = 0x6F,
|
|
||||||
kVK_F15 = 0x71,
|
|
||||||
kVK_Help = 0x72,
|
|
||||||
kVK_Home = 0x73,
|
|
||||||
kVK_PageUp = 0x74,
|
|
||||||
kVK_ForwardDelete = 0x75,
|
|
||||||
kVK_F4 = 0x76,
|
|
||||||
kVK_End = 0x77,
|
|
||||||
kVK_F2 = 0x78,
|
|
||||||
kVK_PageDown = 0x79,
|
|
||||||
kVK_F1 = 0x7A,
|
|
||||||
kVK_LeftArrow = 0x7B,
|
|
||||||
kVK_RightArrow = 0x7C,
|
|
||||||
kVK_DownArrow = 0x7D,
|
|
||||||
kVK_UpArrow = 0x7E
|
|
||||||
};
|
|
||||||
|
|
||||||
static char g_keycodeCharUnshifted[256] = {};
|
|
||||||
static char g_keycodeCharShifted[256] = {};
|
|
||||||
|
|
||||||
//static double g_Time = 0.0f;
|
|
||||||
static bool g_MousePressed[3] = { false, false, false };
|
|
||||||
static float g_mouseWheelX = 0.0f;
|
|
||||||
static float g_mouseWheelY = 0.0f;
|
|
||||||
|
|
||||||
static GLuint g_FontTexture = 0;
|
|
||||||
static int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
|
||||||
static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0;
|
|
||||||
static int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0;
|
|
||||||
static size_t g_VboSize = 0;
|
|
||||||
static unsigned int g_VboHandle = 0, g_VaoHandle = 0;
|
|
||||||
static float g_displayScale;
|
|
||||||
|
|
||||||
static int usynergy_sockfd;
|
|
||||||
static bool g_synergyPtrActive = false;
|
|
||||||
static uint16_t g_mousePosX = 0;
|
|
||||||
static uint16_t g_mousePosY = 0;
|
|
||||||
|
|
||||||
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data);
|
|
||||||
bool ImGui_ImplIOS_CreateDeviceObjects();
|
|
||||||
|
|
||||||
static NSString *g_serverName;
|
|
||||||
|
|
||||||
uSynergyBool ImGui_ConnectFunc(uSynergyCookie cookie)
|
|
||||||
{
|
|
||||||
// NOTE: You need to turn off "Use SSL Encryption" in Synergy preferences, since
|
|
||||||
// uSynergy does not support SSL.
|
|
||||||
|
|
||||||
NSLog( @"Connect Func!");
|
|
||||||
struct addrinfo hints, *res;
|
|
||||||
|
|
||||||
// first, load up address structs with getaddrinfo():
|
|
||||||
memset(&hints, 0, sizeof hints);
|
|
||||||
hints.ai_family = AF_UNSPEC; // use IPv4 or IPv6, whichever
|
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
|
||||||
|
|
||||||
// get server address
|
|
||||||
getaddrinfo([g_serverName UTF8String], "24800", &hints, &res);
|
|
||||||
|
|
||||||
if (!res)
|
|
||||||
{
|
|
||||||
NSLog( @"Could not find server: %@", g_serverName );
|
|
||||||
return USYNERGY_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make a socket:
|
|
||||||
usynergy_sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
|
||||||
|
|
||||||
// connect it to the address and port we passed in to getaddrinfo():
|
|
||||||
int ret = connect(usynergy_sockfd, res->ai_addr, res->ai_addrlen);
|
|
||||||
if (!ret) {
|
|
||||||
NSLog( @"Connect succeeded...");
|
|
||||||
} else {
|
|
||||||
NSLog( @"Connect failed, %d", ret );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return USYNERGY_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
uSynergyBool ImGui_SendFunc(uSynergyCookie cookie, const uint8_t *buffer, int length)
|
|
||||||
{
|
|
||||||
// NSLog( @"Send Func" );
|
|
||||||
send( usynergy_sockfd, buffer, length, 0 );
|
|
||||||
|
|
||||||
return USYNERGY_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
uSynergyBool ImGui_RecvFunc(uSynergyCookie cookie, uint8_t *buffer, int maxLength, int* outLength)
|
|
||||||
{
|
|
||||||
*outLength = (int)recv( usynergy_sockfd, buffer, maxLength, 0 );
|
|
||||||
|
|
||||||
return USYNERGY_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_SleepFunc(uSynergyCookie cookie, int timeMs)
|
|
||||||
{
|
|
||||||
usleep( timeMs * 1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t ImGui_GetTimeFunc()
|
|
||||||
{
|
|
||||||
struct timeval tv;
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
|
|
||||||
return (int32_t)((tv.tv_sec) * 1000 + (tv.tv_usec) / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_TraceFunc(uSynergyCookie cookie, const char *text)
|
|
||||||
{
|
|
||||||
puts(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ScreenActiveCallback(uSynergyCookie cookie, uSynergyBool active)
|
|
||||||
{
|
|
||||||
g_synergyPtrActive = active;
|
|
||||||
// printf( "Synergy: screen activate %s\n", active?"YES":"NO" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_MouseCallback(uSynergyCookie cookie, uint16_t x, uint16_t y, int16_t wheelX, int16_t wheelY,
|
|
||||||
uSynergyBool buttonLeft, uSynergyBool buttonRight, uSynergyBool buttonMiddle)
|
|
||||||
{
|
|
||||||
// printf("Synergy: mouse callback %d %d -- wheel %d %d\n", x, y, wheelX, wheelY );
|
|
||||||
uSynergyContext *ctx = (uSynergyContext*)cookie;
|
|
||||||
g_mousePosX = x;
|
|
||||||
g_mousePosY = y;
|
|
||||||
g_mouseWheelX = wheelX;
|
|
||||||
g_mouseWheelY = wheelY;
|
|
||||||
g_MousePressed[0] = buttonLeft;
|
|
||||||
g_MousePressed[1] = buttonMiddle;
|
|
||||||
g_MousePressed[2] = buttonRight;
|
|
||||||
|
|
||||||
ctx->m_mouseWheelX = 0;
|
|
||||||
ctx->m_mouseWheelY = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_KeyboardCallback(uSynergyCookie cookie, uint16_t key,
|
|
||||||
uint16_t modifiers, uSynergyBool down, uSynergyBool repeat)
|
|
||||||
{
|
|
||||||
int scanCode = key-1;
|
|
||||||
// printf("Synergy: keyboard callback: 0x%02X (%s)", scanCode, down?"true":"false");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
io.KeysDown[key] = down;
|
|
||||||
io.KeyShift = (modifiers & USYNERGY_MODIFIER_SHIFT);
|
|
||||||
io.KeyCtrl = (modifiers & USYNERGY_MODIFIER_CTRL);
|
|
||||||
io.KeyAlt = (modifiers & USYNERGY_MODIFIER_ALT);
|
|
||||||
io.KeySuper = (modifiers & USYNERGY_MODIFIER_WIN);
|
|
||||||
|
|
||||||
// Add this as keyboard input
|
|
||||||
if ((down) && (key) && (scanCode<256) && !(modifiers & USYNERGY_MODIFIER_CTRL))
|
|
||||||
{
|
|
||||||
// If this key maps to a character input, apply it
|
|
||||||
int charForKeycode = (modifiers & USYNERGY_MODIFIER_SHIFT) ? g_keycodeCharShifted[scanCode] : g_keycodeCharUnshifted[scanCode];
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
printf("Synergy: joystick callback TODO\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ClipboardCallback(uSynergyCookie cookie, enum uSynergyClipboardFormat format, const uint8_t *data, uint32_t size)
|
|
||||||
{
|
|
||||||
printf("Synergy: clipboard callback TODO\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@interface ImGuiHelper ()
|
|
||||||
{
|
|
||||||
BOOL _mouseDown;
|
|
||||||
BOOL _mouseTapped;
|
|
||||||
CGPoint _touchPos;
|
|
||||||
|
|
||||||
uSynergyContext _synergyCtx;
|
|
||||||
dispatch_queue_t _synergyQueue;
|
|
||||||
}
|
|
||||||
@property (nonatomic, weak) UIView *view;
|
|
||||||
@property (nonatomic, strong) NSString *serverName;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation ImGuiHelper
|
|
||||||
|
|
||||||
- (id) initWithView: (UIView *)view
|
|
||||||
{
|
|
||||||
self = [super init];
|
|
||||||
if (self)
|
|
||||||
{
|
|
||||||
self.view = view;
|
|
||||||
|
|
||||||
[self setupImGuiHooks];
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setupKeymaps
|
|
||||||
{
|
|
||||||
// The keyboard mapping is a big headache. I tried for a while to find a better way to do this,
|
|
||||||
// but this was the best I could come up with. There are some device independent API's available
|
|
||||||
// to convert scan codes to unicode characters, but these are only available on mac and not
|
|
||||||
// on iOS as far as I can tell (it's part of Carbon). I didn't see any better way to do
|
|
||||||
// this or any way to get the character codes out of usynergy.
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_A ]='a';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_S ]='s';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_D ]='d';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_F ]='f';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_H ]='h';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_G ]='g';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Z ]='z';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_X ]='x';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_C ]='c';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_V ]='v';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_B ]='b';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Q ]='q';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_W ]='w';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_E ]='e';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_R ]='r';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Y ]='y';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_T ]='t';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_1 ]='1';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_2 ]='2';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_3 ]='3';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_4 ]='4';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_6 ]='6';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_5 ]='5';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Equal ]='=';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_9 ]='9';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_7 ]='7';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Minus ]='-';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_8 ]='8';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_0 ]='0';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_RightBracket ]=']';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_O ]='o';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_U ]='u';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_LeftBracket ]='[';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_I ]='i';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_P ]='p';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_L ]='l';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_J ]='j';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Quote ]='\'';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_K ]='k';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Semicolon ]=';';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Backslash ]='\\';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Comma ]=',';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Slash ]='/';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_N ]='n';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_M ]='m';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Period ]='.';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Grave ]='`';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_KeypadDecimal ]='.';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_KeypadMultiply ]='*';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_KeypadPlus ]='+';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_KeypadDivide ]='/';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_KeypadEnter ]='\n';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_KeypadMinus ]='-';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_KeypadEquals ]='=';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad0 ]='0';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad1 ]='1';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad2 ]='2';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad3 ]='3';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad4 ]='4';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad5 ]='5';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad6 ]='6';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad7 ]='7';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad8 ]='8';
|
|
||||||
g_keycodeCharUnshifted[ kVK_ANSI_Keypad9 ]='9';
|
|
||||||
g_keycodeCharUnshifted[ kVK_Space ]=' ';
|
|
||||||
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_A ]='A';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_S ]='S';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_D ]='D';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_F ]='F';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_H ]='H';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_G ]='G';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Z ]='Z';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_X ]='X';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_C ]='C';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_V ]='V';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_B ]='B';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Q ]='Q';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_W ]='W';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_E ]='E';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_R ]='R';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Y ]='Y';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_T ]='T';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_1 ]='!';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_2 ]='@';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_3 ]='#';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_4 ]='$';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_6 ]='^';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_5 ]='%';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Equal ]='+';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_9 ]='(';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_7 ]='&';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Minus ]='_';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_8 ]='*';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_0 ]=')';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_RightBracket ]='}';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_O ]='O';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_U ]='U';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_LeftBracket ]='{';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_I ]='I';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_P ]='P';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_L ]='L';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_J ]='J';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Quote ]='\"';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_K ]='K';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Semicolon ]=':';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Backslash ]='|';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Comma ]='<';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Slash ]='?';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_N ]='N';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_M ]='M';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Period ]='>';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Grave ]='~';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_KeypadDecimal ]='.';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_KeypadMultiply ]='*';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_KeypadPlus ]='+';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_KeypadDivide ]='/';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_KeypadEnter ]='\n';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_KeypadMinus ]='-';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_KeypadEquals ]='=';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad0 ]='0';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad1 ]='1';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad2 ]='2';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad3 ]='3';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad4 ]='4';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad5 ]='5';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad6 ]='6';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad7 ]='7';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad8 ]='8';
|
|
||||||
g_keycodeCharShifted[ kVK_ANSI_Keypad9 ]='9';
|
|
||||||
g_keycodeCharShifted[ kVK_Space ]=' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setupImGuiHooks
|
|
||||||
{
|
|
||||||
ImGui::CreateContext();
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
|
|
||||||
[self setupKeymaps];
|
|
||||||
|
|
||||||
// Account for retina display for glScissor
|
|
||||||
g_displayScale = [[UIScreen mainScreen] scale];
|
|
||||||
|
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
|
||||||
style.TouchExtraPadding = ImVec2( 4.0, 4.0 );
|
|
||||||
|
|
||||||
io.RenderDrawListsFn = ImGui_ImplIOS_RenderDrawLists;
|
|
||||||
|
|
||||||
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(viewDidPan:) ];
|
|
||||||
[self.view addGestureRecognizer:panRecognizer];
|
|
||||||
|
|
||||||
UITapGestureRecognizer *tapRecoginzer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector( viewDidTap:)];
|
|
||||||
[self.view addGestureRecognizer:tapRecoginzer];
|
|
||||||
|
|
||||||
// Fill out the Synergy key map
|
|
||||||
// (for some reason synergy scan codes are off by 1)
|
|
||||||
io.KeyMap[ImGuiKey_Tab] = kVK_Tab+1;
|
|
||||||
io.KeyMap[ImGuiKey_LeftArrow] = kVK_LeftArrow+1;
|
|
||||||
io.KeyMap[ImGuiKey_RightArrow] = kVK_RightArrow+1;
|
|
||||||
io.KeyMap[ImGuiKey_UpArrow] = kVK_UpArrow+1;
|
|
||||||
io.KeyMap[ImGuiKey_DownArrow] = kVK_DownArrow+1;
|
|
||||||
io.KeyMap[ImGuiKey_Home] = kVK_Home+1;
|
|
||||||
io.KeyMap[ImGuiKey_End] = kVK_End+1;
|
|
||||||
io.KeyMap[ImGuiKey_Insert] = kVK_Help+1;
|
|
||||||
io.KeyMap[ImGuiKey_Delete] = kVK_ForwardDelete+1;
|
|
||||||
io.KeyMap[ImGuiKey_Backspace] = kVK_Delete+1;
|
|
||||||
io.KeyMap[ImGuiKey_Space] = kVK_Space+1;
|
|
||||||
io.KeyMap[ImGuiKey_Enter] = kVK_Return+1;
|
|
||||||
io.KeyMap[ImGuiKey_Escape] = kVK_Escape+1;
|
|
||||||
io.KeyMap[ImGuiKey_A] = kVK_ANSI_A+1;
|
|
||||||
io.KeyMap[ImGuiKey_C] = kVK_ANSI_C+1;
|
|
||||||
io.KeyMap[ImGuiKey_V] = kVK_ANSI_V+1;
|
|
||||||
io.KeyMap[ImGuiKey_X] = kVK_ANSI_X+1;
|
|
||||||
io.KeyMap[ImGuiKey_Y] = kVK_ANSI_Y+1;
|
|
||||||
io.KeyMap[ImGuiKey_Z] = kVK_ANSI_Z+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connectServer: (NSString*)serverName
|
|
||||||
{
|
|
||||||
self.serverName = serverName;
|
|
||||||
g_serverName = serverName;
|
|
||||||
|
|
||||||
// Init synergy
|
|
||||||
NSString *bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey];
|
|
||||||
|
|
||||||
uSynergyInit( &_synergyCtx );
|
|
||||||
_synergyCtx.m_clientName = strdup( [bundleName UTF8String] );
|
|
||||||
_synergyCtx.m_clientWidth = self.view.bounds.size.width;
|
|
||||||
_synergyCtx.m_clientHeight = self.view.bounds.size.height;
|
|
||||||
|
|
||||||
_synergyCtx.m_connectFunc = ImGui_ConnectFunc;
|
|
||||||
_synergyCtx.m_sendFunc = ImGui_SendFunc;
|
|
||||||
_synergyCtx.m_receiveFunc = ImGui_RecvFunc;
|
|
||||||
_synergyCtx.m_sleepFunc = ImGui_SleepFunc;
|
|
||||||
_synergyCtx.m_traceFunc = ImGui_TraceFunc;
|
|
||||||
_synergyCtx.m_getTimeFunc = ImGui_GetTimeFunc;
|
|
||||||
|
|
||||||
_synergyCtx.m_traceFunc = ImGui_TraceFunc;
|
|
||||||
_synergyCtx.m_screenActiveCallback = ImGui_ScreenActiveCallback;
|
|
||||||
_synergyCtx.m_mouseCallback = ImGui_MouseCallback;
|
|
||||||
_synergyCtx.m_keyboardCallback = ImGui_KeyboardCallback;
|
|
||||||
|
|
||||||
_synergyCtx.m_cookie = (uSynergyCookie)&_synergyCtx;
|
|
||||||
|
|
||||||
// Create a background thread for synergy
|
|
||||||
_synergyQueue = dispatch_queue_create( "imgui-usynergy", NULL );
|
|
||||||
dispatch_async( _synergyQueue, ^{
|
|
||||||
while (1)
|
|
||||||
uSynergyUpdate(&_synergyCtx);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)viewDidPan: (UIPanGestureRecognizer *)recognizer
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((recognizer.state == UIGestureRecognizerStateBegan) ||
|
|
||||||
(recognizer.state == UIGestureRecognizerStateChanged))
|
|
||||||
{
|
|
||||||
_mouseDown = YES;
|
|
||||||
_touchPos = [recognizer locationInView:self.view];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_mouseDown = NO;
|
|
||||||
_touchPos = CGPointMake( -1, -1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)viewDidTap: (UITapGestureRecognizer*)recognizer
|
|
||||||
{
|
|
||||||
_touchPos = [recognizer locationInView:self.view];
|
|
||||||
_mouseTapped = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)render
|
|
||||||
{
|
|
||||||
ImGui::Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)newFrame
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
|
||||||
|
|
||||||
if (!g_FontTexture)
|
|
||||||
ImGui_ImplIOS_CreateDeviceObjects();
|
|
||||||
|
|
||||||
io.DisplaySize = ImVec2(_view.bounds.size.width, _view.bounds.size.height);
|
|
||||||
|
|
||||||
io.MouseDrawCursor = g_synergyPtrActive;
|
|
||||||
if (g_synergyPtrActive)
|
|
||||||
{
|
|
||||||
style.TouchExtraPadding = ImVec2(0.0, 0.0);
|
|
||||||
io.MousePos = ImVec2(g_mousePosX, g_mousePosY);
|
|
||||||
for (int i=0; i < 3; 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.
|
|
||||||
io.MouseWheel = g_mouseWheelY / 500.0;
|
|
||||||
io.MouseWheelH = g_mouseWheelX / 500.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Synergy not active, use touch events
|
|
||||||
style.TouchExtraPadding = ImVec2(4.0, 4.0);
|
|
||||||
io.MousePos = ImVec2(_touchPos.x, _touchPos.y);
|
|
||||||
if ((_mouseDown) || (_mouseTapped))
|
|
||||||
{
|
|
||||||
io.MouseDown[0] = true;
|
|
||||||
_mouseTapped = NO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
io.MouseDown[0] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::NewFrame();
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
|
||||||
// If text or lines are blurry when integrating ImGui in your engine:
|
|
||||||
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
|
||||||
// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
|
|
||||||
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
|
|
||||||
{
|
|
||||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
|
|
||||||
// FIXME: Backport changes from imgui_impl_glfw_gl3.cpp
|
|
||||||
GLint last_program, last_texture;
|
|
||||||
glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
glDisable(GL_CULL_FACE);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
// Setup orthographic projection matrix
|
|
||||||
const float width = ImGui::GetIO().DisplaySize.x;
|
|
||||||
const float height = ImGui::GetIO().DisplaySize.y;
|
|
||||||
const float ortho_projection[4][4] =
|
|
||||||
{
|
|
||||||
{ 2.0f/width, 0.0f, 0.0f, 0.0f },
|
|
||||||
{ 0.0f, 2.0f/-height, 0.0f, 0.0f },
|
|
||||||
{ 0.0f, 0.0f, -1.0f, 0.0f },
|
|
||||||
{ -1.0f, 1.0f, 0.0f, 1.0f },
|
|
||||||
};
|
|
||||||
glUseProgram(g_ShaderHandle);
|
|
||||||
glUniform1i(g_AttribLocationTex, 0);
|
|
||||||
glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
|
||||||
glBindVertexArray(g_VaoHandle);
|
|
||||||
|
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
|
||||||
{
|
|
||||||
ImDrawList* cmd_list = draw_data->CmdLists[n];
|
|
||||||
ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
|
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
|
||||||
const int needed_vtx_size = cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
|
|
||||||
if (g_VboSize < needed_vtx_size)
|
|
||||||
{
|
|
||||||
// Grow our buffer if needed
|
|
||||||
g_VboSize = needed_vtx_size + 2000 * sizeof(ImDrawVert);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)g_VboSize, NULL, GL_STREAM_DRAW);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char* vtx_data = (unsigned char*)glMapBufferRange(GL_ARRAY_BUFFER, 0, needed_vtx_size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
|
||||||
if (!vtx_data)
|
|
||||||
continue;
|
|
||||||
memcpy(vtx_data, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
|
||||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
|
||||||
{
|
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
|
||||||
if (pcmd->UserCallback)
|
|
||||||
{
|
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
|
||||||
glScissor((int)(pcmd->ClipRect.x * g_displayScale),
|
|
||||||
(int)((height - pcmd->ClipRect.w) * g_displayScale),
|
|
||||||
(int)((pcmd->ClipRect.z - pcmd->ClipRect.x) * g_displayScale),
|
|
||||||
(int)((pcmd->ClipRect.w - pcmd->ClipRect.y) * g_displayScale));
|
|
||||||
glDrawElements( GL_TRIANGLES, (GLsizei)pcmd->ElemCount, GL_UNSIGNED_SHORT, idx_buffer );
|
|
||||||
}
|
|
||||||
idx_buffer += pcmd->ElemCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore modified state
|
|
||||||
glBindVertexArray(0);
|
|
||||||
glBindBuffer( GL_ARRAY_BUFFER, 0);
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glUseProgram(last_program);
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplIOS_CreateFontsTexture()
|
|
||||||
{
|
|
||||||
// Build texture atlas
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
unsigned char* pixels;
|
|
||||||
int width, height;
|
|
||||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
|
|
||||||
|
|
||||||
// Upload texture to graphics system
|
|
||||||
GLint last_texture;
|
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
|
||||||
glGenTextures(1, &g_FontTexture);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
|
||||||
|
|
||||||
// Store our identifier
|
|
||||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
|
||||||
|
|
||||||
// Restore state
|
|
||||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImGui_ImplIOS_CreateDeviceObjects()
|
|
||||||
{
|
|
||||||
const GLchar *vertex_shader =
|
|
||||||
"uniform mat4 ProjMtx;\n"
|
|
||||||
"attribute highp vec2 Position;\n"
|
|
||||||
"attribute highp vec2 UV;\n"
|
|
||||||
"attribute highp vec4 Color;\n"
|
|
||||||
"varying vec2 Frag_UV;\n"
|
|
||||||
"varying vec4 Frag_Color;\n"
|
|
||||||
"void main()\n"
|
|
||||||
"{\n"
|
|
||||||
" Frag_UV = UV;\n"
|
|
||||||
" Frag_Color = Color;\n"
|
|
||||||
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
|
||||||
"}\n";
|
|
||||||
|
|
||||||
const GLchar* fragment_shader =
|
|
||||||
"uniform sampler2D Texture;\n"
|
|
||||||
"varying highp vec2 Frag_UV;\n"
|
|
||||||
"varying highp vec4 Frag_Color;\n"
|
|
||||||
"void main()\n"
|
|
||||||
"{\n"
|
|
||||||
" gl_FragColor = Frag_Color * texture2D( Texture, Frag_UV.st);\n"
|
|
||||||
"}\n";
|
|
||||||
|
|
||||||
g_ShaderHandle = glCreateProgram();
|
|
||||||
g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
|
|
||||||
g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
|
||||||
glShaderSource(g_VertHandle, 1, &vertex_shader, 0);
|
|
||||||
glShaderSource(g_FragHandle, 1, &fragment_shader, 0);
|
|
||||||
glCompileShader(g_VertHandle);
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
|
||||||
GLint logLength;
|
|
||||||
glGetShaderiv( g_VertHandle, GL_INFO_LOG_LENGTH, &logLength);
|
|
||||||
if (logLength > 0) {
|
|
||||||
GLchar *log = (GLchar *)malloc(logLength);
|
|
||||||
glGetShaderInfoLog(g_VertHandle, logLength, &logLength, log);
|
|
||||||
NSLog(@"VERTEX Shader compile log:\n%s", log);
|
|
||||||
free(log);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glCompileShader(g_FragHandle);
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
|
||||||
glGetShaderiv( g_FragHandle, GL_INFO_LOG_LENGTH, &logLength);
|
|
||||||
if (logLength > 0) {
|
|
||||||
GLchar *log = (GLchar *)malloc(logLength);
|
|
||||||
glGetShaderInfoLog(g_FragHandle, logLength, &logLength, log);
|
|
||||||
NSLog(@"FRAGMENT Shader compile log:\n%s", log);
|
|
||||||
free(log);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glAttachShader(g_ShaderHandle, g_VertHandle);
|
|
||||||
glAttachShader(g_ShaderHandle, g_FragHandle);
|
|
||||||
glLinkProgram(g_ShaderHandle);
|
|
||||||
|
|
||||||
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
|
|
||||||
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
|
|
||||||
g_AttribLocationPosition = glGetAttribLocation(g_ShaderHandle, "Position");
|
|
||||||
g_AttribLocationUV = glGetAttribLocation(g_ShaderHandle, "UV");
|
|
||||||
g_AttribLocationColor = glGetAttribLocation(g_ShaderHandle, "Color");
|
|
||||||
|
|
||||||
glGenBuffers(1, &g_VboHandle);
|
|
||||||
|
|
||||||
glGenVertexArrays(1, &g_VaoHandle);
|
|
||||||
glBindVertexArray(g_VaoHandle);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
|
||||||
glEnableVertexAttribArray(g_AttribLocationPosition);
|
|
||||||
glEnableVertexAttribArray(g_AttribLocationUV);
|
|
||||||
glEnableVertexAttribArray(g_AttribLocationColor);
|
|
||||||
|
|
||||||
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
|
|
||||||
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
|
|
||||||
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col));
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
|
|
||||||
ImGui_ImplIOS_CreateFontsTexture();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// AppDelegate.h
|
|
||||||
// imguiex-osx
|
|
||||||
//
|
|
||||||
// Created by James Chen on 4/5/16.
|
|
||||||
// Copyright © 2016 Joel Davis. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
//
|
|
||||||
// AppDelegate.m
|
|
||||||
// imguiex-osx
|
|
||||||
//
|
|
||||||
// Created by James Chen on 4/5/16.
|
|
||||||
// Copyright © 2016 Joel Davis. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "AppDelegate.h"
|
|
||||||
|
|
||||||
@interface AppDelegate ()
|
|
||||||
|
|
||||||
@property (weak) IBOutlet NSWindow *window;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation AppDelegate
|
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
|
||||||
// Insert code here to initialize your application
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
|
||||||
// Insert code here to tear down your application
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
@ -1,64 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "16x16",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "16x16",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "32x32",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "32x32",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "128x128",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "128x128",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "256x256",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "256x256",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "512x512",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"size" : "512x512",
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "icon_imgui_180x180.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "512x512",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 5.8 KiB |
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
//
|
|
||||||
// main.m
|
|
||||||
// imguiex-osx
|
|
||||||
//
|
|
||||||
// Created by James Chen on 4/5/16.
|
|
||||||
// Copyright © 2016 Joel Davis. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
int main(int argc, const char * argv[]) {
|
|
||||||
return NSApplicationMain(argc, argv);
|
|
||||||
}
|
|
@ -1,539 +0,0 @@
|
|||||||
// !$*UTF8*$!
|
|
||||||
{
|
|
||||||
archiveVersion = 1;
|
|
||||||
classes = {
|
|
||||||
};
|
|
||||||
objectVersion = 46;
|
|
||||||
objects = {
|
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
|
||||||
197E1E871B8943FE00E3FE6A /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 197E1E861B8943FE00E3FE6A /* imgui_draw.cpp */; };
|
|
||||||
197E1E891B89443600E3FE6A /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 197E1E881B89443600E3FE6A /* imgui_demo.cpp */; };
|
|
||||||
1A1A0F231CB39FB50090F036 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1A0F221CB39FB50090F036 /* AppDelegate.m */; };
|
|
||||||
1A1A0F281CB39FB50090F036 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A1A0F271CB39FB50090F036 /* Assets.xcassets */; };
|
|
||||||
1A1A0F301CB3A0DA0090F036 /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 197E1E861B8943FE00E3FE6A /* imgui_draw.cpp */; };
|
|
||||||
1A1A0F311CB3A0DA0090F036 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5861B2E64AB00C130BA /* imgui.cpp */; };
|
|
||||||
1A1A0F321CB3A0DE0090F036 /* uSynergy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6D1E39151B35EEF10017B40F /* uSynergy.c */; };
|
|
||||||
1A1A0F331CB3A0E10090F036 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 197E1E881B89443600E3FE6A /* imgui_demo.cpp */; };
|
|
||||||
1A1A0F341CB3A0EC0090F036 /* debug_hud.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5891B2E6A5500C130BA /* debug_hud.cpp */; };
|
|
||||||
1A1A0F481CB3A2E50090F036 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1A0F391CB3A1B20090F036 /* main.cpp */; };
|
|
||||||
1A1A0F4A1CB3A5070090F036 /* imgui_impl_glfw_gl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw_gl2.cpp */; };
|
|
||||||
1A1A0F4E1CB3C54D0090F036 /* libglfw.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1A0F4D1CB3C54D0090F036 /* libglfw.dylib */; };
|
|
||||||
6D1E39171B35EEF10017B40F /* uSynergy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6D1E39151B35EEF10017B40F /* uSynergy.c */; };
|
|
||||||
6D2FC55A1B2E632000C130BA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5591B2E632000C130BA /* main.m */; };
|
|
||||||
6D2FC55D1B2E632000C130BA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC55C1B2E632000C130BA /* AppDelegate.m */; };
|
|
||||||
6D2FC55F1B2E632000C130BA /* Shader.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 6D2FC55E1B2E632000C130BA /* Shader.fsh */; };
|
|
||||||
6D2FC5611B2E632000C130BA /* Shader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 6D2FC5601B2E632000C130BA /* Shader.vsh */; };
|
|
||||||
6D2FC5641B2E632000C130BA /* GameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5631B2E632000C130BA /* GameViewController.m */; };
|
|
||||||
6D2FC5671B2E632000C130BA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D2FC5651B2E632000C130BA /* Main.storyboard */; };
|
|
||||||
6D2FC5691B2E632000C130BA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D2FC5681B2E632000C130BA /* Images.xcassets */; };
|
|
||||||
6D2FC56C1B2E632000C130BA /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6D2FC56A1B2E632000C130BA /* LaunchScreen.xib */; };
|
|
||||||
6D2FC5831B2E63A100C130BA /* imgui_impl_ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5811B2E63A100C130BA /* imgui_impl_ios.mm */; };
|
|
||||||
6D2FC5881B2E64AB00C130BA /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5861B2E64AB00C130BA /* imgui.cpp */; };
|
|
||||||
6D2FC58B1B2E6A5500C130BA /* debug_hud.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5891B2E6A5500C130BA /* debug_hud.cpp */; };
|
|
||||||
6D2FC5911B30773F00C130BA /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D2FC5901B30773F00C130BA /* CFNetwork.framework */; };
|
|
||||||
6D2FC5931B30774900C130BA /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D2FC5921B30774900C130BA /* SystemConfiguration.framework */; };
|
|
||||||
/* End PBXBuildFile section */
|
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
|
||||||
197E1E861B8943FE00E3FE6A /* imgui_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_draw.cpp; path = ../../imgui_draw.cpp; sourceTree = "<group>"; };
|
|
||||||
197E1E881B89443600E3FE6A /* imgui_demo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_demo.cpp; path = ../../../imgui_demo.cpp; sourceTree = "<group>"; };
|
|
||||||
1A1A0F1F1CB39FB50090F036 /* imguiex-osx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "imguiex-osx.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
1A1A0F211CB39FB50090F036 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
|
||||||
1A1A0F221CB39FB50090F036 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
|
||||||
1A1A0F271CB39FB50090F036 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
|
||||||
1A1A0F2C1CB39FB50090F036 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
|
||||||
1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw_gl2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = imgui_impl_glfw_gl2.cpp; sourceTree = "<group>"; };
|
|
||||||
1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw_gl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgui_impl_glfw_gl2.h; sourceTree = "<group>"; };
|
|
||||||
1A1A0F391CB3A1B20090F036 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
|
||||||
1A1A0F4D1CB3C54D0090F036 /* libglfw.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libglfw.dylib; path = /usr/local/lib/libglfw.dylib; sourceTree = "<absolute>"; };
|
|
||||||
6D1E39151B35EEF10017B40F /* uSynergy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uSynergy.c; sourceTree = "<group>"; };
|
|
||||||
6D1E39161B35EEF10017B40F /* uSynergy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uSynergy.h; sourceTree = "<group>"; };
|
|
||||||
6D2FC5541B2E632000C130BA /* imguiex-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "imguiex-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
6D2FC5581B2E632000C130BA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
|
||||||
6D2FC5591B2E632000C130BA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
|
||||||
6D2FC55B1B2E632000C130BA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
|
||||||
6D2FC55C1B2E632000C130BA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
|
||||||
6D2FC55E1B2E632000C130BA /* Shader.fsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.fsh; path = Shaders/Shader.fsh; sourceTree = "<group>"; };
|
|
||||||
6D2FC5601B2E632000C130BA /* Shader.vsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.vsh; path = Shaders/Shader.vsh; sourceTree = "<group>"; };
|
|
||||||
6D2FC5621B2E632000C130BA /* GameViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GameViewController.h; sourceTree = "<group>"; };
|
|
||||||
6D2FC5631B2E632000C130BA /* GameViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GameViewController.m; sourceTree = "<group>"; };
|
|
||||||
6D2FC5661B2E632000C130BA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
|
||||||
6D2FC5681B2E632000C130BA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
|
||||||
6D2FC56B1B2E632000C130BA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
|
|
||||||
6D2FC5811B2E63A100C130BA /* imgui_impl_ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = imgui_impl_ios.mm; sourceTree = "<group>"; };
|
|
||||||
6D2FC5821B2E63A100C130BA /* imgui_impl_ios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgui_impl_ios.h; sourceTree = "<group>"; };
|
|
||||||
6D2FC5851B2E64AB00C130BA /* imconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imconfig.h; path = ../../imconfig.h; sourceTree = "<group>"; };
|
|
||||||
6D2FC5861B2E64AB00C130BA /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../imgui.cpp; sourceTree = "<group>"; };
|
|
||||||
6D2FC5871B2E64AB00C130BA /* imgui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui.h; path = ../../imgui.h; sourceTree = "<group>"; };
|
|
||||||
6D2FC5891B2E6A5500C130BA /* debug_hud.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = debug_hud.cpp; sourceTree = "<group>"; };
|
|
||||||
6D2FC58A1B2E6A5500C130BA /* debug_hud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug_hud.h; sourceTree = "<group>"; };
|
|
||||||
6D2FC5901B30773F00C130BA /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
|
|
||||||
6D2FC5921B30774900C130BA /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
|
||||||
/* End PBXFileReference section */
|
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
|
||||||
1A1A0F1C1CB39FB50090F036 /* Frameworks */ = {
|
|
||||||
isa = PBXFrameworksBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
1A1A0F4E1CB3C54D0090F036 /* libglfw.dylib in Frameworks */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
6D2FC5511B2E632000C130BA /* Frameworks */ = {
|
|
||||||
isa = PBXFrameworksBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
6D2FC5931B30774900C130BA /* SystemConfiguration.framework in Frameworks */,
|
|
||||||
6D2FC5911B30773F00C130BA /* CFNetwork.framework in Frameworks */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXFrameworksBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
|
||||||
1A1A0F201CB39FB50090F036 /* imguiex-osx */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
1A1A0F4D1CB3C54D0090F036 /* libglfw.dylib */,
|
|
||||||
1A1A0F351CB3A1B20090F036 /* opengl2_example */,
|
|
||||||
1A1A0F211CB39FB50090F036 /* AppDelegate.h */,
|
|
||||||
1A1A0F221CB39FB50090F036 /* AppDelegate.m */,
|
|
||||||
1A1A0F271CB39FB50090F036 /* Assets.xcassets */,
|
|
||||||
1A1A0F2C1CB39FB50090F036 /* Info.plist */,
|
|
||||||
1A1A0F241CB39FB50090F036 /* Supporting Files */,
|
|
||||||
);
|
|
||||||
path = "imguiex-osx";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
1A1A0F241CB39FB50090F036 /* Supporting Files */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
);
|
|
||||||
name = "Supporting Files";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
1A1A0F351CB3A1B20090F036 /* opengl2_example */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw_gl2.cpp */,
|
|
||||||
1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw_gl2.h */,
|
|
||||||
1A1A0F391CB3A1B20090F036 /* main.cpp */,
|
|
||||||
);
|
|
||||||
name = opengl2_example;
|
|
||||||
path = ../../opengl2_example;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6D1E39141B35EEF10017B40F /* usynergy */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
6D1E39151B35EEF10017B40F /* uSynergy.c */,
|
|
||||||
6D1E39161B35EEF10017B40F /* uSynergy.h */,
|
|
||||||
);
|
|
||||||
name = usynergy;
|
|
||||||
path = ../libs/usynergy;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6D2FC54B1B2E632000C130BA = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
6D1E39141B35EEF10017B40F /* usynergy */,
|
|
||||||
6D2FC5841B2E648D00C130BA /* imgui */,
|
|
||||||
6D2FC5561B2E632000C130BA /* imguiex-ios */,
|
|
||||||
1A1A0F201CB39FB50090F036 /* imguiex-osx */,
|
|
||||||
6D2FC5551B2E632000C130BA /* Products */,
|
|
||||||
);
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6D2FC5551B2E632000C130BA /* Products */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
6D2FC5541B2E632000C130BA /* imguiex-ios.app */,
|
|
||||||
1A1A0F1F1CB39FB50090F036 /* imguiex-osx.app */,
|
|
||||||
);
|
|
||||||
name = Products;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6D2FC5561B2E632000C130BA /* imguiex-ios */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
6D2FC5811B2E63A100C130BA /* imgui_impl_ios.mm */,
|
|
||||||
6D2FC5821B2E63A100C130BA /* imgui_impl_ios.h */,
|
|
||||||
197E1E881B89443600E3FE6A /* imgui_demo.cpp */,
|
|
||||||
6D2FC5891B2E6A5500C130BA /* debug_hud.cpp */,
|
|
||||||
6D2FC58A1B2E6A5500C130BA /* debug_hud.h */,
|
|
||||||
6D2FC55B1B2E632000C130BA /* AppDelegate.h */,
|
|
||||||
6D2FC55C1B2E632000C130BA /* AppDelegate.m */,
|
|
||||||
6D2FC55E1B2E632000C130BA /* Shader.fsh */,
|
|
||||||
6D2FC5601B2E632000C130BA /* Shader.vsh */,
|
|
||||||
6D2FC5621B2E632000C130BA /* GameViewController.h */,
|
|
||||||
6D2FC5631B2E632000C130BA /* GameViewController.m */,
|
|
||||||
6D2FC5651B2E632000C130BA /* Main.storyboard */,
|
|
||||||
6D2FC5681B2E632000C130BA /* Images.xcassets */,
|
|
||||||
6D2FC56A1B2E632000C130BA /* LaunchScreen.xib */,
|
|
||||||
6D2FC5571B2E632000C130BA /* Supporting Files */,
|
|
||||||
);
|
|
||||||
path = "imguiex-ios";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6D2FC5571B2E632000C130BA /* Supporting Files */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
6D2FC5921B30774900C130BA /* SystemConfiguration.framework */,
|
|
||||||
6D2FC5901B30773F00C130BA /* CFNetwork.framework */,
|
|
||||||
6D2FC5581B2E632000C130BA /* Info.plist */,
|
|
||||||
6D2FC5591B2E632000C130BA /* main.m */,
|
|
||||||
);
|
|
||||||
name = "Supporting Files";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6D2FC5841B2E648D00C130BA /* imgui */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
6D2FC5851B2E64AB00C130BA /* imconfig.h */,
|
|
||||||
197E1E861B8943FE00E3FE6A /* imgui_draw.cpp */,
|
|
||||||
6D2FC5861B2E64AB00C130BA /* imgui.cpp */,
|
|
||||||
6D2FC5871B2E64AB00C130BA /* imgui.h */,
|
|
||||||
);
|
|
||||||
name = imgui;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXGroup section */
|
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
|
||||||
1A1A0F1E1CB39FB50090F036 /* imguiex-osx */ = {
|
|
||||||
isa = PBXNativeTarget;
|
|
||||||
buildConfigurationList = 1A1A0F2F1CB39FB50090F036 /* Build configuration list for PBXNativeTarget "imguiex-osx" */;
|
|
||||||
buildPhases = (
|
|
||||||
1A1A0F1B1CB39FB50090F036 /* Sources */,
|
|
||||||
1A1A0F1C1CB39FB50090F036 /* Frameworks */,
|
|
||||||
1A1A0F1D1CB39FB50090F036 /* Resources */,
|
|
||||||
);
|
|
||||||
buildRules = (
|
|
||||||
);
|
|
||||||
dependencies = (
|
|
||||||
);
|
|
||||||
name = "imguiex-osx";
|
|
||||||
productName = "imguiex-osx";
|
|
||||||
productReference = 1A1A0F1F1CB39FB50090F036 /* imguiex-osx.app */;
|
|
||||||
productType = "com.apple.product-type.application";
|
|
||||||
};
|
|
||||||
6D2FC5531B2E632000C130BA /* imguiex-ios */ = {
|
|
||||||
isa = PBXNativeTarget;
|
|
||||||
buildConfigurationList = 6D2FC57B1B2E632000C130BA /* Build configuration list for PBXNativeTarget "imguiex-ios" */;
|
|
||||||
buildPhases = (
|
|
||||||
6D2FC5501B2E632000C130BA /* Sources */,
|
|
||||||
6D2FC5511B2E632000C130BA /* Frameworks */,
|
|
||||||
6D2FC5521B2E632000C130BA /* Resources */,
|
|
||||||
);
|
|
||||||
buildRules = (
|
|
||||||
);
|
|
||||||
dependencies = (
|
|
||||||
);
|
|
||||||
name = "imguiex-ios";
|
|
||||||
productName = imguiex;
|
|
||||||
productReference = 6D2FC5541B2E632000C130BA /* imguiex-ios.app */;
|
|
||||||
productType = "com.apple.product-type.application";
|
|
||||||
};
|
|
||||||
/* End PBXNativeTarget section */
|
|
||||||
|
|
||||||
/* Begin PBXProject section */
|
|
||||||
6D2FC54C1B2E632000C130BA /* Project object */ = {
|
|
||||||
isa = PBXProject;
|
|
||||||
attributes = {
|
|
||||||
LastUpgradeCheck = 0630;
|
|
||||||
ORGANIZATIONNAME = "Joel Davis";
|
|
||||||
TargetAttributes = {
|
|
||||||
1A1A0F1E1CB39FB50090F036 = {
|
|
||||||
CreatedOnToolsVersion = 7.3;
|
|
||||||
};
|
|
||||||
6D2FC5531B2E632000C130BA = {
|
|
||||||
CreatedOnToolsVersion = 6.3.2;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
buildConfigurationList = 6D2FC54F1B2E632000C130BA /* Build configuration list for PBXProject "imguiex" */;
|
|
||||||
compatibilityVersion = "Xcode 3.2";
|
|
||||||
developmentRegion = English;
|
|
||||||
hasScannedForEncodings = 0;
|
|
||||||
knownRegions = (
|
|
||||||
en,
|
|
||||||
Base,
|
|
||||||
);
|
|
||||||
mainGroup = 6D2FC54B1B2E632000C130BA;
|
|
||||||
productRefGroup = 6D2FC5551B2E632000C130BA /* Products */;
|
|
||||||
projectDirPath = "";
|
|
||||||
projectRoot = "";
|
|
||||||
targets = (
|
|
||||||
6D2FC5531B2E632000C130BA /* imguiex-ios */,
|
|
||||||
1A1A0F1E1CB39FB50090F036 /* imguiex-osx */,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
/* End PBXProject section */
|
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
|
||||||
1A1A0F1D1CB39FB50090F036 /* Resources */ = {
|
|
||||||
isa = PBXResourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
1A1A0F281CB39FB50090F036 /* Assets.xcassets in Resources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
6D2FC5521B2E632000C130BA /* Resources */ = {
|
|
||||||
isa = PBXResourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
6D2FC56C1B2E632000C130BA /* LaunchScreen.xib in Resources */,
|
|
||||||
6D2FC5671B2E632000C130BA /* Main.storyboard in Resources */,
|
|
||||||
6D2FC5691B2E632000C130BA /* Images.xcassets in Resources */,
|
|
||||||
6D2FC5611B2E632000C130BA /* Shader.vsh in Resources */,
|
|
||||||
6D2FC55F1B2E632000C130BA /* Shader.fsh in Resources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXResourcesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
|
||||||
1A1A0F1B1CB39FB50090F036 /* Sources */ = {
|
|
||||||
isa = PBXSourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
1A1A0F301CB3A0DA0090F036 /* imgui_draw.cpp in Sources */,
|
|
||||||
1A1A0F311CB3A0DA0090F036 /* imgui.cpp in Sources */,
|
|
||||||
1A1A0F331CB3A0E10090F036 /* imgui_demo.cpp in Sources */,
|
|
||||||
1A1A0F341CB3A0EC0090F036 /* debug_hud.cpp in Sources */,
|
|
||||||
1A1A0F481CB3A2E50090F036 /* main.cpp in Sources */,
|
|
||||||
1A1A0F321CB3A0DE0090F036 /* uSynergy.c in Sources */,
|
|
||||||
1A1A0F231CB39FB50090F036 /* AppDelegate.m in Sources */,
|
|
||||||
1A1A0F4A1CB3A5070090F036 /* imgui_impl_glfw_gl2.cpp in Sources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
6D2FC5501B2E632000C130BA /* Sources */ = {
|
|
||||||
isa = PBXSourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
6D2FC55D1B2E632000C130BA /* AppDelegate.m in Sources */,
|
|
||||||
6D2FC5831B2E63A100C130BA /* imgui_impl_ios.mm in Sources */,
|
|
||||||
6D1E39171B35EEF10017B40F /* uSynergy.c in Sources */,
|
|
||||||
6D2FC5641B2E632000C130BA /* GameViewController.m in Sources */,
|
|
||||||
6D2FC55A1B2E632000C130BA /* main.m in Sources */,
|
|
||||||
6D2FC5881B2E64AB00C130BA /* imgui.cpp in Sources */,
|
|
||||||
6D2FC58B1B2E6A5500C130BA /* debug_hud.cpp in Sources */,
|
|
||||||
197E1E871B8943FE00E3FE6A /* imgui_draw.cpp in Sources */,
|
|
||||||
197E1E891B89443600E3FE6A /* imgui_demo.cpp in Sources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXSourcesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
|
||||||
6D2FC5651B2E632000C130BA /* Main.storyboard */ = {
|
|
||||||
isa = PBXVariantGroup;
|
|
||||||
children = (
|
|
||||||
6D2FC5661B2E632000C130BA /* Base */,
|
|
||||||
);
|
|
||||||
name = Main.storyboard;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6D2FC56A1B2E632000C130BA /* LaunchScreen.xib */ = {
|
|
||||||
isa = PBXVariantGroup;
|
|
||||||
children = (
|
|
||||||
6D2FC56B1B2E632000C130BA /* Base */,
|
|
||||||
);
|
|
||||||
name = LaunchScreen.xib;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXVariantGroup section */
|
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
|
||||||
1A1A0F2D1CB39FB50090F036 /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
|
||||||
CODE_SIGN_IDENTITY = "-";
|
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
|
||||||
ENABLE_TESTABILITY = YES;
|
|
||||||
HEADER_SEARCH_PATHS = (
|
|
||||||
"$(inherited)",
|
|
||||||
"$(SRCROOT)/../../",
|
|
||||||
/usr/local/include,
|
|
||||||
);
|
|
||||||
INFOPLIST_FILE = "imguiex-osx/Info.plist";
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
|
||||||
LIBRARY_SEARCH_PATHS = /usr/local/lib;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.imguiex.imguiex-osx";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SDKROOT = macosx;
|
|
||||||
USER_HEADER_SEARCH_PATHS = "";
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
1A1A0F2E1CB39FB50090F036 /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
|
||||||
CODE_SIGN_IDENTITY = "-";
|
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
|
||||||
HEADER_SEARCH_PATHS = (
|
|
||||||
"$(inherited)",
|
|
||||||
"$(SRCROOT)/../../",
|
|
||||||
/usr/local/include,
|
|
||||||
);
|
|
||||||
INFOPLIST_FILE = "imguiex-osx/Info.plist";
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
|
||||||
LIBRARY_SEARCH_PATHS = /usr/local/lib;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.imguiex.imguiex-osx";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SDKROOT = macosx;
|
|
||||||
USER_HEADER_SEARCH_PATHS = "";
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
6D2FC5791B2E632000C130BA /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
|
||||||
CLANG_ENABLE_MODULES = YES;
|
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
|
||||||
COPY_PHASE_STRIP = NO;
|
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
||||||
"DEBUG=1",
|
|
||||||
"$(inherited)",
|
|
||||||
);
|
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
||||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../";
|
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
SDKROOT = iphoneos;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
|
||||||
USER_HEADER_SEARCH_PATHS = "";
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
6D2FC57A1B2E632000C130BA /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
|
||||||
CLANG_ENABLE_MODULES = YES;
|
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
|
||||||
COPY_PHASE_STRIP = NO;
|
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
||||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../";
|
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
|
||||||
SDKROOT = iphoneos;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
|
||||||
USER_HEADER_SEARCH_PATHS = "";
|
|
||||||
VALIDATE_PRODUCT = YES;
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
6D2FC57C1B2E632000C130BA /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
||||||
INFOPLIST_FILE = "imguiex-ios/Info.plist";
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
6D2FC57D1B2E632000C130BA /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
||||||
INFOPLIST_FILE = "imguiex-ios/Info.plist";
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
/* End XCBuildConfiguration section */
|
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
|
||||||
1A1A0F2F1CB39FB50090F036 /* Build configuration list for PBXNativeTarget "imguiex-osx" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
1A1A0F2D1CB39FB50090F036 /* Debug */,
|
|
||||||
1A1A0F2E1CB39FB50090F036 /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
6D2FC54F1B2E632000C130BA /* Build configuration list for PBXProject "imguiex" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
6D2FC5791B2E632000C130BA /* Debug */,
|
|
||||||
6D2FC57A1B2E632000C130BA /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
6D2FC57B1B2E632000C130BA /* Build configuration list for PBXNativeTarget "imguiex-ios" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
6D2FC57C1B2E632000C130BA /* Debug */,
|
|
||||||
6D2FC57D1B2E632000C130BA /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
/* End XCConfigurationList section */
|
|
||||||
};
|
|
||||||
rootObject = 6D2FC54C1B2E632000C130BA /* Project object */;
|
|
||||||
}
|
|
8
examples/example_apple_metal/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# iOS / OSX Metal example
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This example shows how to integrate Dear ImGui with Metal. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9.
|
||||||
|
|
||||||
|
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
|
||||||
|
|
19
examples/example_apple_metal/Shared/AppDelegate.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
#import <TargetConditionals.h>
|
||||||
|
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||||
|
@property (strong, nonatomic) UIWindow *window;
|
||||||
|
@end
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
12
examples/example_apple_metal/Shared/AppDelegate.m
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
#import "AppDelegate.h"
|
||||||
|
|
||||||
|
@implementation AppDelegate
|
||||||
|
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@end
|
9
examples/example_apple_metal/Shared/Renderer.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
#import <MetalKit/MetalKit.h>
|
||||||
|
|
||||||
|
@interface Renderer : NSObject <MTKViewDelegate>
|
||||||
|
|
||||||
|
-(nonnull instancetype)initWithView:(nonnull MTKView *)view;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
132
examples/example_apple_metal/Shared/Renderer.mm
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
|
||||||
|
#import "Renderer.h"
|
||||||
|
#import <Metal/Metal.h>
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_metal.h"
|
||||||
|
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
#include "imgui_impl_osx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface Renderer ()
|
||||||
|
@property (nonatomic, strong) id <MTLDevice> device;
|
||||||
|
@property (nonatomic, strong) id <MTLCommandQueue> commandQueue;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation Renderer
|
||||||
|
|
||||||
|
-(nonnull instancetype)initWithView:(nonnull MTKView *)view;
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if(self)
|
||||||
|
{
|
||||||
|
_device = view.device;
|
||||||
|
_commandQueue = [_device newCommandQueue];
|
||||||
|
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
ImGui::CreateContext();
|
||||||
|
(void)ImGui::GetIO();
|
||||||
|
|
||||||
|
ImGui_ImplMetal_Init(_device);
|
||||||
|
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawInMTKView:(MTKView *)view
|
||||||
|
{
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
io.DisplaySize.x = view.bounds.size.width;
|
||||||
|
io.DisplaySize.y = view.bounds.size.height;
|
||||||
|
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
CGFloat framebufferScale = view.window.screen.backingScaleFactor ?: NSScreen.mainScreen.backingScaleFactor;
|
||||||
|
#else
|
||||||
|
CGFloat framebufferScale = view.window.screen.scale ?: UIScreen.mainScreen.scale;
|
||||||
|
#endif
|
||||||
|
io.DisplayFramebufferScale = ImVec2(framebufferScale, framebufferScale);
|
||||||
|
|
||||||
|
io.DeltaTime = 1 / float(view.preferredFramesPerSecond ?: 60);
|
||||||
|
|
||||||
|
id<MTLCommandBuffer> commandBuffer = [self.commandQueue commandBuffer];
|
||||||
|
|
||||||
|
static bool show_demo_window = true;
|
||||||
|
static bool show_another_window = false;
|
||||||
|
static float clear_color[4] = { 0.28f, 0.36f, 0.5f, 1.0f };
|
||||||
|
|
||||||
|
MTLRenderPassDescriptor *renderPassDescriptor = view.currentRenderPassDescriptor;
|
||||||
|
if (renderPassDescriptor != nil)
|
||||||
|
{
|
||||||
|
renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clear_color[0], clear_color[1], clear_color[2], clear_color[3]);
|
||||||
|
|
||||||
|
// Here, you could do additional rendering work, including other passes as necessary.
|
||||||
|
|
||||||
|
id <MTLRenderCommandEncoder> renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
|
||||||
|
[renderEncoder pushDebugGroup:@"ImGui demo"];
|
||||||
|
|
||||||
|
// Start the Dear ImGui frame
|
||||||
|
ImGui_ImplMetal_NewFrame(renderPassDescriptor);
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
ImGui_ImplOSX_NewFrame(view);
|
||||||
|
#endif
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
|
{
|
||||||
|
static float f = 0.0f;
|
||||||
|
static int counter = 0;
|
||||||
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
|
counter++;
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Show another simple window.
|
||||||
|
if (show_another_window)
|
||||||
|
{
|
||||||
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
|
ImGui::Text("Hello from another window!");
|
||||||
|
if (ImGui::Button("Close Me"))
|
||||||
|
show_another_window = false;
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rendering
|
||||||
|
ImGui::Render();
|
||||||
|
ImDrawData *drawData = ImGui::GetDrawData();
|
||||||
|
ImGui_ImplMetal_RenderDrawData(drawData, commandBuffer, renderEncoder);
|
||||||
|
|
||||||
|
[renderEncoder popDebugGroup];
|
||||||
|
[renderEncoder endEncoding];
|
||||||
|
|
||||||
|
[commandBuffer presentDrawable:view.currentDrawable];
|
||||||
|
}
|
||||||
|
|
||||||
|
[commandBuffer commit];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
20
examples/example_apple_metal/Shared/ViewController.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
#import <Metal/Metal.h>
|
||||||
|
#import <MetalKit/MetalKit.h>
|
||||||
|
#import "Renderer.h"
|
||||||
|
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@interface ViewController : UIViewController
|
||||||
|
@end
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@interface ViewController : NSViewController
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
130
examples/example_apple_metal/Shared/ViewController.mm
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
|
||||||
|
#import "ViewController.h"
|
||||||
|
#import "Renderer.h"
|
||||||
|
#include "imgui.h"
|
||||||
|
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
#include "imgui_impl_osx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface ViewController ()
|
||||||
|
@property (nonatomic, readonly) MTKView *mtkView;
|
||||||
|
@property (nonatomic, strong) Renderer *renderer;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation ViewController
|
||||||
|
|
||||||
|
- (MTKView *)mtkView {
|
||||||
|
return (MTKView *)self.view;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidLoad
|
||||||
|
{
|
||||||
|
[super viewDidLoad];
|
||||||
|
|
||||||
|
self.mtkView.device = MTLCreateSystemDefaultDevice();
|
||||||
|
|
||||||
|
if (!self.mtkView.device) {
|
||||||
|
NSLog(@"Metal is not supported");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
self.renderer = [[Renderer alloc] initWithView:self.mtkView];
|
||||||
|
|
||||||
|
[self.renderer mtkView:self.mtkView drawableSizeWillChange:self.mtkView.bounds.size];
|
||||||
|
|
||||||
|
self.mtkView.delegate = self.renderer;
|
||||||
|
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
// Add a tracking area in order to receive mouse events whenever the mouse is within the bounds of our view
|
||||||
|
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect
|
||||||
|
options:NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingActiveAlways
|
||||||
|
owner:self
|
||||||
|
userInfo:nil];
|
||||||
|
[self.view addTrackingArea:trackingArea];
|
||||||
|
|
||||||
|
// If we want to receive key events, we either need to be in the responder chain of the key view,
|
||||||
|
// or else we can install a local monitor. The consequence of this heavy-handed approach is that
|
||||||
|
// we receive events for all controls, not just ImGui widgets. If we had native controls in our
|
||||||
|
// window, we'd want to be much more careful than just ingesting the complete event stream, though
|
||||||
|
// we do make an effort to be good citizens by passing along events when ImGui doesn't want to capture.
|
||||||
|
NSEventMask eventMask = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventTypeScrollWheel;
|
||||||
|
[NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event) {
|
||||||
|
BOOL wantsCapture = ImGui_ImplOSX_HandleEvent(event, self.view);
|
||||||
|
if (event.type == NSEventTypeKeyDown && wantsCapture) {
|
||||||
|
return nil;
|
||||||
|
} else {
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
}];
|
||||||
|
|
||||||
|
ImGui_ImplOSX_Init();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
|
||||||
|
- (void)mouseMoved:(NSEvent *)event {
|
||||||
|
ImGui_ImplOSX_HandleEvent(event, self.view);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)mouseDown:(NSEvent *)event {
|
||||||
|
ImGui_ImplOSX_HandleEvent(event, self.view);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)mouseUp:(NSEvent *)event {
|
||||||
|
ImGui_ImplOSX_HandleEvent(event, self.view);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)mouseDragged:(NSEvent *)event {
|
||||||
|
ImGui_ImplOSX_HandleEvent(event, self.view);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)scrollWheel:(NSEvent *)event {
|
||||||
|
ImGui_ImplOSX_HandleEvent(event, self.view);
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif TARGET_OS_IOS
|
||||||
|
|
||||||
|
// This touch mapping is super cheesy/hacky. We treat any touch on the screen
|
||||||
|
// as if it were a depressed left mouse button, and we don't bother handling
|
||||||
|
// multitouch correctly at all. This causes the "cursor" to behave very erratically
|
||||||
|
// when there are multiple active touches. But for demo purposes, single-touch
|
||||||
|
// interaction actually works surprisingly well.
|
||||||
|
- (void)updateIOWithTouchEvent:(UIEvent *)event {
|
||||||
|
UITouch *anyTouch = event.allTouches.anyObject;
|
||||||
|
CGPoint touchLocation = [anyTouch locationInView:self.view];
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
io.MousePos = ImVec2(touchLocation.x, touchLocation.y);
|
||||||
|
|
||||||
|
BOOL hasActiveTouch = NO;
|
||||||
|
for (UITouch *touch in event.allTouches) {
|
||||||
|
if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) {
|
||||||
|
hasActiveTouch = YES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
io.MouseDown[0] = hasActiveTouch;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||||
|
[self updateIOWithTouchEvent:event];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||||
|
[self updateIOWithTouchEvent:event];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||||
|
[self updateIOWithTouchEvent:event];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||||
|
[self updateIOWithTouchEvent:event];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
//
|
|
||||||
// main.m
|
#import <TargetConditionals.h>
|
||||||
// imguiex
|
|
||||||
//
|
#if TARGET_OS_IPHONE
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
@ -11,3 +11,13 @@ int main(int argc, char * argv[]) {
|
|||||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
int main(int argc, const char * argv[]) {
|
||||||
|
return NSApplicationMain(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,541 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 50;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
8307E7CC20E9F9C900473790 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7CB20E9F9C900473790 /* ViewController.mm */; };
|
||||||
|
8307E7CF20E9F9C900473790 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8307E7CD20E9F9C900473790 /* Main.storyboard */; };
|
||||||
|
8307E7DE20E9F9C900473790 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7DD20E9F9C900473790 /* AppDelegate.m */; };
|
||||||
|
8307E7E420E9F9C900473790 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8307E7E220E9F9C900473790 /* Main.storyboard */; };
|
||||||
|
8307E7E720E9F9C900473790 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7E620E9F9C900473790 /* main.m */; };
|
||||||
|
8307E7E820E9F9C900473790 /* Renderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7BC20E9F9C700473790 /* Renderer.mm */; };
|
||||||
|
8307E7E920E9F9C900473790 /* Renderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7BC20E9F9C700473790 /* Renderer.mm */; };
|
||||||
|
836D2A2E20EE208E0098E909 /* imgui_impl_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 836D2A2D20EE208E0098E909 /* imgui_impl_osx.mm */; };
|
||||||
|
836D2A3020EE4A180098E909 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 836D2A2F20EE4A180098E909 /* Default-568h@2x.png */; };
|
||||||
|
836D2A3220EE4A900098E909 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 836D2A3120EE4A900098E909 /* Launch Screen.storyboard */; };
|
||||||
|
83BBE9DE20EB3FFC00295997 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7E620E9F9C900473790 /* main.m */; };
|
||||||
|
83BBE9DF20EB40AE00295997 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7DD20E9F9C900473790 /* AppDelegate.m */; };
|
||||||
|
83BBE9E020EB42D000295997 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7CB20E9F9C900473790 /* ViewController.mm */; };
|
||||||
|
83BBE9E520EB46B900295997 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9E420EB46B900295997 /* Metal.framework */; };
|
||||||
|
83BBE9E720EB46BD00295997 /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9E620EB46BD00295997 /* MetalKit.framework */; };
|
||||||
|
83BBE9E920EB46C100295997 /* ModelIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9E820EB46C100295997 /* ModelIO.framework */; };
|
||||||
|
83BBE9EC20EB471700295997 /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9EA20EB471700295997 /* MetalKit.framework */; };
|
||||||
|
83BBE9ED20EB471700295997 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9EB20EB471700295997 /* Metal.framework */; };
|
||||||
|
83BBE9EF20EB471C00295997 /* ModelIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9EE20EB471C00295997 /* ModelIO.framework */; };
|
||||||
|
83BBE9FE20EB54D800295997 /* imgui_impl_metal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */; };
|
||||||
|
83BBE9FF20EB54D800295997 /* imgui_impl_metal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */; };
|
||||||
|
83BBEA0520EB54E700295997 /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0120EB54E700295997 /* imgui_draw.cpp */; };
|
||||||
|
83BBEA0620EB54E700295997 /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0120EB54E700295997 /* imgui_draw.cpp */; };
|
||||||
|
83BBEA0720EB54E700295997 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0220EB54E700295997 /* imgui_demo.cpp */; };
|
||||||
|
83BBEA0820EB54E700295997 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0220EB54E700295997 /* imgui_demo.cpp */; };
|
||||||
|
83BBEA0920EB54E700295997 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0320EB54E700295997 /* imgui.cpp */; };
|
||||||
|
83BBEA0A20EB54E700295997 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0320EB54E700295997 /* imgui.cpp */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
8307E7BB20E9F9C700473790 /* Renderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Renderer.h; sourceTree = "<group>"; };
|
||||||
|
8307E7BC20E9F9C700473790 /* Renderer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Renderer.mm; sourceTree = "<group>"; };
|
||||||
|
8307E7C420E9F9C900473790 /* example_apple_metal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example_apple_metal.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
8307E7CA20E9F9C900473790 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
||||||
|
8307E7CB20E9F9C900473790 /* ViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = "<group>"; };
|
||||||
|
8307E7CE20E9F9C900473790 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||||
|
8307E7D320E9F9C900473790 /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; };
|
||||||
|
8307E7DA20E9F9C900473790 /* example_apple_metal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example_apple_metal.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
8307E7DC20E9F9C900473790 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||||
|
8307E7DD20E9F9C900473790 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||||
|
8307E7E320E9F9C900473790 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||||
|
8307E7E520E9F9C900473790 /* Info-macOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-macOS.plist"; sourceTree = "<group>"; };
|
||||||
|
8307E7E620E9F9C900473790 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||||
|
836D2A2C20EE208D0098E909 /* imgui_impl_osx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_osx.h; path = ../../imgui_impl_osx.h; sourceTree = "<group>"; };
|
||||||
|
836D2A2D20EE208E0098E909 /* imgui_impl_osx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = imgui_impl_osx.mm; path = ../../imgui_impl_osx.mm; sourceTree = "<group>"; };
|
||||||
|
836D2A2F20EE4A180098E909 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
||||||
|
836D2A3120EE4A900098E909 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
|
||||||
|
83BBE9E420EB46B900295997 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
|
83BBE9E620EB46BD00295997 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/MetalKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
|
83BBE9E820EB46C100295997 /* ModelIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ModelIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/ModelIO.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
|
83BBE9EA20EB471700295997 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; };
|
||||||
|
83BBE9EB20EB471700295997 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
|
||||||
|
83BBE9EE20EB471C00295997 /* ModelIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ModelIO.framework; path = System/Library/Frameworks/ModelIO.framework; sourceTree = SDKROOT; };
|
||||||
|
83BBE9FC20EB54D800295997 /* imgui_impl_metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_metal.h; path = ../../imgui_impl_metal.h; sourceTree = "<group>"; };
|
||||||
|
83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = imgui_impl_metal.mm; path = ../../imgui_impl_metal.mm; sourceTree = "<group>"; };
|
||||||
|
83BBEA0020EB54E700295997 /* imgui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui.h; path = ../../imgui.h; sourceTree = "<group>"; };
|
||||||
|
83BBEA0120EB54E700295997 /* imgui_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_draw.cpp; path = ../../imgui_draw.cpp; sourceTree = "<group>"; };
|
||||||
|
83BBEA0220EB54E700295997 /* imgui_demo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_demo.cpp; path = ../../imgui_demo.cpp; sourceTree = "<group>"; };
|
||||||
|
83BBEA0320EB54E700295997 /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../imgui.cpp; sourceTree = "<group>"; };
|
||||||
|
83BBEA0420EB54E700295997 /* imconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imconfig.h; path = ../../imconfig.h; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
8307E7C120E9F9C900473790 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
83BBE9E920EB46C100295997 /* ModelIO.framework in Frameworks */,
|
||||||
|
83BBE9E720EB46BD00295997 /* MetalKit.framework in Frameworks */,
|
||||||
|
83BBE9E520EB46B900295997 /* Metal.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
8307E7D720E9F9C900473790 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
83BBE9EF20EB471C00295997 /* ModelIO.framework in Frameworks */,
|
||||||
|
83BBE9EC20EB471700295997 /* MetalKit.framework in Frameworks */,
|
||||||
|
83BBE9ED20EB471700295997 /* Metal.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
8307E7B520E9F9C700473790 = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
83BBE9F020EB544400295997 /* imgui */,
|
||||||
|
8307E7BA20E9F9C700473790 /* Shared */,
|
||||||
|
8307E7C620E9F9C900473790 /* iOS */,
|
||||||
|
8307E7DB20E9F9C900473790 /* macOS */,
|
||||||
|
8307E7C520E9F9C900473790 /* Products */,
|
||||||
|
83BBE9E320EB46B800295997 /* Frameworks */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8307E7BA20E9F9C700473790 /* Shared */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
83BBE9FC20EB54D800295997 /* imgui_impl_metal.h */,
|
||||||
|
83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */,
|
||||||
|
836D2A2C20EE208D0098E909 /* imgui_impl_osx.h */,
|
||||||
|
836D2A2D20EE208E0098E909 /* imgui_impl_osx.mm */,
|
||||||
|
8307E7DC20E9F9C900473790 /* AppDelegate.h */,
|
||||||
|
8307E7DD20E9F9C900473790 /* AppDelegate.m */,
|
||||||
|
8307E7BB20E9F9C700473790 /* Renderer.h */,
|
||||||
|
8307E7BC20E9F9C700473790 /* Renderer.mm */,
|
||||||
|
8307E7CA20E9F9C900473790 /* ViewController.h */,
|
||||||
|
8307E7CB20E9F9C900473790 /* ViewController.mm */,
|
||||||
|
8307E7E620E9F9C900473790 /* main.m */,
|
||||||
|
);
|
||||||
|
path = Shared;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8307E7C520E9F9C900473790 /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8307E7C420E9F9C900473790 /* example_apple_metal.app */,
|
||||||
|
8307E7DA20E9F9C900473790 /* example_apple_metal.app */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8307E7C620E9F9C900473790 /* iOS */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
836D2A2F20EE4A180098E909 /* Default-568h@2x.png */,
|
||||||
|
8307E7CD20E9F9C900473790 /* Main.storyboard */,
|
||||||
|
8307E7D320E9F9C900473790 /* Info-iOS.plist */,
|
||||||
|
836D2A3120EE4A900098E909 /* Launch Screen.storyboard */,
|
||||||
|
);
|
||||||
|
path = iOS;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8307E7DB20E9F9C900473790 /* macOS */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8307E7E220E9F9C900473790 /* Main.storyboard */,
|
||||||
|
8307E7E520E9F9C900473790 /* Info-macOS.plist */,
|
||||||
|
);
|
||||||
|
path = macOS;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
83BBE9E320EB46B800295997 /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
83BBE9EE20EB471C00295997 /* ModelIO.framework */,
|
||||||
|
83BBE9EB20EB471700295997 /* Metal.framework */,
|
||||||
|
83BBE9EA20EB471700295997 /* MetalKit.framework */,
|
||||||
|
83BBE9E820EB46C100295997 /* ModelIO.framework */,
|
||||||
|
83BBE9E620EB46BD00295997 /* MetalKit.framework */,
|
||||||
|
83BBE9E420EB46B900295997 /* Metal.framework */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
83BBE9F020EB544400295997 /* imgui */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
83BBEA0420EB54E700295997 /* imconfig.h */,
|
||||||
|
83BBEA0020EB54E700295997 /* imgui.h */,
|
||||||
|
83BBEA0220EB54E700295997 /* imgui_demo.cpp */,
|
||||||
|
83BBEA0120EB54E700295997 /* imgui_draw.cpp */,
|
||||||
|
83BBEA0320EB54E700295997 /* imgui.cpp */,
|
||||||
|
);
|
||||||
|
name = imgui;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
8307E7C320E9F9C900473790 /* example_apple_metal_ios */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 8307E7F020E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_ios" */;
|
||||||
|
buildPhases = (
|
||||||
|
8307E7C020E9F9C900473790 /* Sources */,
|
||||||
|
8307E7C120E9F9C900473790 /* Frameworks */,
|
||||||
|
8307E7C220E9F9C900473790 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = example_apple_metal_ios;
|
||||||
|
productName = "imguiex iOS";
|
||||||
|
productReference = 8307E7C420E9F9C900473790 /* example_apple_metal.app */;
|
||||||
|
productType = "com.apple.product-type.application";
|
||||||
|
};
|
||||||
|
8307E7D920E9F9C900473790 /* example_apple_metal_macos */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 8307E7F320E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_macos" */;
|
||||||
|
buildPhases = (
|
||||||
|
8307E7D620E9F9C900473790 /* Sources */,
|
||||||
|
8307E7D720E9F9C900473790 /* Frameworks */,
|
||||||
|
8307E7D820E9F9C900473790 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = example_apple_metal_macos;
|
||||||
|
productName = "imguiex macOS";
|
||||||
|
productReference = 8307E7DA20E9F9C900473790 /* example_apple_metal.app */;
|
||||||
|
productType = "com.apple.product-type.application";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
8307E7B620E9F9C700473790 /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
LastUpgradeCheck = 0940;
|
||||||
|
ORGANIZATIONNAME = "Warren Moore";
|
||||||
|
TargetAttributes = {
|
||||||
|
8307E7C320E9F9C900473790 = {
|
||||||
|
CreatedOnToolsVersion = 9.4.1;
|
||||||
|
};
|
||||||
|
8307E7D920E9F9C900473790 = {
|
||||||
|
CreatedOnToolsVersion = 9.4.1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = 8307E7B920E9F9C700473790 /* Build configuration list for PBXProject "example_apple_metal" */;
|
||||||
|
compatibilityVersion = "Xcode 9.3";
|
||||||
|
developmentRegion = en;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
Base,
|
||||||
|
);
|
||||||
|
mainGroup = 8307E7B520E9F9C700473790;
|
||||||
|
productRefGroup = 8307E7C520E9F9C900473790 /* Products */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
8307E7C320E9F9C900473790 /* example_apple_metal_ios */,
|
||||||
|
8307E7D920E9F9C900473790 /* example_apple_metal_macos */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
8307E7C220E9F9C900473790 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
836D2A3220EE4A900098E909 /* Launch Screen.storyboard in Resources */,
|
||||||
|
8307E7CF20E9F9C900473790 /* Main.storyboard in Resources */,
|
||||||
|
836D2A3020EE4A180098E909 /* Default-568h@2x.png in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
8307E7D820E9F9C900473790 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
8307E7E420E9F9C900473790 /* Main.storyboard in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
8307E7C020E9F9C900473790 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
8307E7E820E9F9C900473790 /* Renderer.mm in Sources */,
|
||||||
|
8307E7CC20E9F9C900473790 /* ViewController.mm in Sources */,
|
||||||
|
83BBEA0520EB54E700295997 /* imgui_draw.cpp in Sources */,
|
||||||
|
83BBE9DF20EB40AE00295997 /* AppDelegate.m in Sources */,
|
||||||
|
83BBEA0920EB54E700295997 /* imgui.cpp in Sources */,
|
||||||
|
83BBEA0720EB54E700295997 /* imgui_demo.cpp in Sources */,
|
||||||
|
83BBE9FE20EB54D800295997 /* imgui_impl_metal.mm in Sources */,
|
||||||
|
83BBE9DE20EB3FFC00295997 /* main.m in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
8307E7D620E9F9C900473790 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
83BBE9E020EB42D000295997 /* ViewController.mm in Sources */,
|
||||||
|
8307E7E920E9F9C900473790 /* Renderer.mm in Sources */,
|
||||||
|
83BBEA0620EB54E700295997 /* imgui_draw.cpp in Sources */,
|
||||||
|
8307E7E720E9F9C900473790 /* main.m in Sources */,
|
||||||
|
83BBEA0A20EB54E700295997 /* imgui.cpp in Sources */,
|
||||||
|
83BBEA0820EB54E700295997 /* imgui_demo.cpp in Sources */,
|
||||||
|
83BBE9FF20EB54D800295997 /* imgui_impl_metal.mm in Sources */,
|
||||||
|
836D2A2E20EE208E0098E909 /* imgui_impl_osx.mm in Sources */,
|
||||||
|
8307E7DE20E9F9C900473790 /* AppDelegate.m in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXVariantGroup section */
|
||||||
|
8307E7CD20E9F9C900473790 /* Main.storyboard */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
8307E7CE20E9F9C900473790 /* Base */,
|
||||||
|
);
|
||||||
|
name = Main.storyboard;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8307E7E220E9F9C900473790 /* Main.storyboard */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
8307E7E320E9F9C900473790 /* Base */,
|
||||||
|
);
|
||||||
|
name = Main.storyboard;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXVariantGroup section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
8307E7EE20E9F9C900473790 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
8307E7EF20E9F9C900473790 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
8307E7F120E9F9C900473790 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios";
|
||||||
|
PRODUCT_NAME = example_apple_metal;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
8307E7F220E9F9C900473790 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios";
|
||||||
|
PRODUCT_NAME = example_apple_metal;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
VALIDATE_PRODUCT = YES;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
8307E7F420E9F9C900473790 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos";
|
||||||
|
PRODUCT_NAME = example_apple_metal;
|
||||||
|
SDKROOT = macosx;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
8307E7F520E9F9C900473790 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos";
|
||||||
|
PRODUCT_NAME = example_apple_metal;
|
||||||
|
SDKROOT = macosx;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
8307E7B920E9F9C700473790 /* Build configuration list for PBXProject "example_apple_metal" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
8307E7EE20E9F9C900473790 /* Debug */,
|
||||||
|
8307E7EF20E9F9C900473790 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
8307E7F020E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_ios" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
8307E7F120E9F9C900473790 /* Debug */,
|
||||||
|
8307E7F220E9F9C900473790 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
8307E7F320E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_macos" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
8307E7F420E9F9C900473790 /* Debug */,
|
||||||
|
8307E7F520E9F9C900473790 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = 8307E7B620E9F9C700473790 /* Project object */;
|
||||||
|
}
|
28
examples/example_apple_metal/iOS/Base.lproj/Main.storyboard
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BV1-FR-VrT">
|
||||||
|
<device id="retina4_7" orientation="portrait">
|
||||||
|
<adaptation id="fullscreen"/>
|
||||||
|
</device>
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||||
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="tXr-a1-R10">
|
||||||
|
<objects>
|
||||||
|
<viewController id="BV1-FR-VrT" customClass="ViewController" sceneMemberID="viewController">
|
||||||
|
<view key="view" contentMode="scaleToFill" id="3se-qz-xqx" customClass="MTKView">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
<viewLayoutGuide key="safeArea" id="BKg-qs-eN0"/>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
BIN
examples/example_apple_metal/iOS/Default-568h@2x.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
@ -3,33 +3,34 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>org.imgui.example.$(PRODUCT_NAME:rfc1034identifier)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>$(PRODUCT_NAME)</string>
|
<string>imgui</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>Launch Screen</string>
|
||||||
<key>UIMainStoryboardFile</key>
|
<key>UIMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>UIRequiredDeviceCapabilities</key>
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
<array>
|
<array>
|
||||||
<string>armv7</string>
|
<string>armv7</string>
|
||||||
|
<string>metal</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>UIRequiresFullScreen</key>
|
||||||
|
<true/>
|
||||||
<key>UIStatusBarHidden</key>
|
<key>UIStatusBarHidden</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
@ -37,6 +38,7 @@
|
|||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
29
examples/example_apple_metal/iOS/Launch Screen.storyboard
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14269.14" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||||
|
<device id="retina4_7" orientation="portrait">
|
||||||
|
<adaptation id="fullscreen"/>
|
||||||
|
</device>
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14252.5"/>
|
||||||
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="EHf-IW-A2E">
|
||||||
|
<objects>
|
||||||
|
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||||
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="53" y="375"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
130
examples/example_apple_metal/macOS/Base.lproj/Main.storyboard
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14269.14" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="macosx"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14269.14"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--Application-->
|
||||||
|
<scene sceneID="JPo-4y-FX3">
|
||||||
|
<objects>
|
||||||
|
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
||||||
|
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||||
|
<items>
|
||||||
|
<menuItem title="ImGui" id="1Xt-HY-uBw">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="ImGui" systemMenu="apple" id="uQy-DD-JDr">
|
||||||
|
<items>
|
||||||
|
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
|
||||||
|
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
|
||||||
|
<menuItem title="Services" id="NMo-om-nkz">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||||
|
<menuItem title="Hide" keyEquivalent="h" id="Olw-nP-bQN">
|
||||||
|
<connections>
|
||||||
|
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="hideOtherApplications:" target="Ady-hI-5gd" id="VT4-aY-XCT"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="unhideAllApplications:" target="Ady-hI-5gd" id="Dhg-Le-xox"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||||
|
<menuItem title="Quit" keyEquivalent="q" id="4sb-4s-VLi">
|
||||||
|
<connections>
|
||||||
|
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="View" id="H8h-7b-M4v">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||||
|
<items>
|
||||||
|
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="toggleFullScreen:" target="Ady-hI-5gd" id="dU3-MA-1Rq"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Window" id="aUF-d1-5bR">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||||
|
<items>
|
||||||
|
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||||
|
<connections>
|
||||||
|
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="performZoom:" target="Ady-hI-5gd" id="DIl-cC-cCs"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
|
||||||
|
</connections>
|
||||||
|
</application>
|
||||||
|
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
|
||||||
|
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||||
|
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="75" y="0.0"/>
|
||||||
|
</scene>
|
||||||
|
<!--Window Controller-->
|
||||||
|
<scene sceneID="R2V-B0-nI4">
|
||||||
|
<objects>
|
||||||
|
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
|
||||||
|
<window key="window" title="ImGui" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titleVisibility="hidden" id="IQv-IB-iLA">
|
||||||
|
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||||
|
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||||
|
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
|
||||||
|
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="B8D-0N-5wS" id="CyC-Pq-WbN"/>
|
||||||
|
</connections>
|
||||||
|
</window>
|
||||||
|
<connections>
|
||||||
|
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
|
||||||
|
</connections>
|
||||||
|
</windowController>
|
||||||
|
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="-128" y="390"/>
|
||||||
|
</scene>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="hIz-AP-VOD">
|
||||||
|
<objects>
|
||||||
|
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
|
||||||
|
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl" customClass="MTKView">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="1280" height="720"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="205" y="1032"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
@ -3,7 +3,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
@ -13,21 +13,19 @@
|
|||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>$(PRODUCT_NAME)</string>
|
<string>imgui</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2016 Joel Davis. All rights reserved.</string>
|
<string>Copyright © 2018 Warren Moore. All rights reserved.</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainStoryboardFile</key>
|
||||||
<string>MainMenu</string>
|
<string>Main</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
</dict>
|
</dict>
|
@ -0,0 +1,325 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 50;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
4080A99820B02D340036BA46 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4080A98A20B02CD90036BA46 /* main.mm */; };
|
||||||
|
4080A9A220B034280036BA46 /* imgui_impl_opengl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */; };
|
||||||
|
4080A9AD20B0343C0036BA46 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A9A620B0343C0036BA46 /* imgui_demo.cpp */; };
|
||||||
|
4080A9AE20B0343C0036BA46 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A9A720B0343C0036BA46 /* imgui.cpp */; };
|
||||||
|
4080A9AF20B0343C0036BA46 /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A9AA20B0343C0036BA46 /* imgui_draw.cpp */; };
|
||||||
|
4080A9B020B0347A0036BA46 /* imgui_impl_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4080A99F20B034280036BA46 /* imgui_impl_osx.mm */; };
|
||||||
|
4080A9B320B034E40036BA46 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4080A9B220B034E40036BA46 /* Cocoa.framework */; };
|
||||||
|
4080A9B520B034EA0036BA46 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4080A9B420B034EA0036BA46 /* OpenGL.framework */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
4080A96920B029B00036BA46 /* CopyFiles */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = /usr/share/man/man1/;
|
||||||
|
dstSubfolderSpec = 0;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
|
};
|
||||||
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
4080A96B20B029B00036BA46 /* example_osx_opengl2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = example_osx_opengl2; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
4080A98A20B02CD90036BA46 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = SOURCE_ROOT; };
|
||||||
|
4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_impl_opengl2.cpp; path = ../imgui_impl_opengl2.cpp; sourceTree = "<group>"; };
|
||||||
|
4080A99F20B034280036BA46 /* imgui_impl_osx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = imgui_impl_osx.mm; path = ../imgui_impl_osx.mm; sourceTree = "<group>"; };
|
||||||
|
4080A9A020B034280036BA46 /* imgui_impl_opengl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_opengl2.h; path = ../imgui_impl_opengl2.h; sourceTree = "<group>"; };
|
||||||
|
4080A9A120B034280036BA46 /* imgui_impl_osx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_osx.h; path = ../imgui_impl_osx.h; sourceTree = "<group>"; };
|
||||||
|
4080A9A420B0343C0036BA46 /* stb_truetype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../stb_truetype.h; sourceTree = "<group>"; };
|
||||||
|
4080A9A520B0343C0036BA46 /* imgui_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_internal.h; path = ../../imgui_internal.h; sourceTree = "<group>"; };
|
||||||
|
4080A9A620B0343C0036BA46 /* imgui_demo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_demo.cpp; path = ../../imgui_demo.cpp; sourceTree = "<group>"; };
|
||||||
|
4080A9A720B0343C0036BA46 /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../imgui.cpp; sourceTree = "<group>"; };
|
||||||
|
4080A9A820B0343C0036BA46 /* imgui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui.h; path = ../../imgui.h; sourceTree = "<group>"; };
|
||||||
|
4080A9A920B0343C0036BA46 /* stb_rect_pack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_rect_pack.h; path = ../../stb_rect_pack.h; sourceTree = "<group>"; };
|
||||||
|
4080A9AA20B0343C0036BA46 /* imgui_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_draw.cpp; path = ../../imgui_draw.cpp; sourceTree = "<group>"; };
|
||||||
|
4080A9AB20B0343C0036BA46 /* stb_textedit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_textedit.h; path = ../../stb_textedit.h; sourceTree = "<group>"; };
|
||||||
|
4080A9AC20B0343C0036BA46 /* imconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imconfig.h; path = ../../imconfig.h; sourceTree = "<group>"; };
|
||||||
|
4080A9B220B034E40036BA46 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||||
|
4080A9B420B034EA0036BA46 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
4080A96820B029B00036BA46 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
4080A9B520B034EA0036BA46 /* OpenGL.framework in Frameworks */,
|
||||||
|
4080A9B320B034E40036BA46 /* Cocoa.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
4080A96220B029B00036BA46 = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
4080A9AC20B0343C0036BA46 /* imconfig.h */,
|
||||||
|
4080A9A620B0343C0036BA46 /* imgui_demo.cpp */,
|
||||||
|
4080A9AA20B0343C0036BA46 /* imgui_draw.cpp */,
|
||||||
|
4080A9A520B0343C0036BA46 /* imgui_internal.h */,
|
||||||
|
4080A9A720B0343C0036BA46 /* imgui.cpp */,
|
||||||
|
4080A9A820B0343C0036BA46 /* imgui.h */,
|
||||||
|
4080A9A920B0343C0036BA46 /* stb_rect_pack.h */,
|
||||||
|
4080A9AB20B0343C0036BA46 /* stb_textedit.h */,
|
||||||
|
4080A9A420B0343C0036BA46 /* stb_truetype.h */,
|
||||||
|
4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */,
|
||||||
|
4080A9A020B034280036BA46 /* imgui_impl_opengl2.h */,
|
||||||
|
4080A9A120B034280036BA46 /* imgui_impl_osx.h */,
|
||||||
|
4080A99F20B034280036BA46 /* imgui_impl_osx.mm */,
|
||||||
|
4080A98A20B02CD90036BA46 /* main.mm */,
|
||||||
|
4080A96C20B029B00036BA46 /* Products */,
|
||||||
|
4080A9B120B034E40036BA46 /* Frameworks */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
4080A96C20B029B00036BA46 /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
4080A96B20B029B00036BA46 /* example_osx_opengl2 */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
4080A9B120B034E40036BA46 /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
4080A9B420B034EA0036BA46 /* OpenGL.framework */,
|
||||||
|
4080A9B220B034E40036BA46 /* Cocoa.framework */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
4080A96A20B029B00036BA46 /* example_osx_opengl2 */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 4080A97220B029B00036BA46 /* Build configuration list for PBXNativeTarget "example_osx_opengl2" */;
|
||||||
|
buildPhases = (
|
||||||
|
4080A96720B029B00036BA46 /* Sources */,
|
||||||
|
4080A96820B029B00036BA46 /* Frameworks */,
|
||||||
|
4080A96920B029B00036BA46 /* CopyFiles */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = example_osx_opengl2;
|
||||||
|
productName = example_osx_opengl2;
|
||||||
|
productReference = 4080A96B20B029B00036BA46 /* example_osx_opengl2 */;
|
||||||
|
productType = "com.apple.product-type.tool";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
4080A96320B029B00036BA46 /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
LastUpgradeCheck = 0930;
|
||||||
|
ORGANIZATIONNAME = ImGui;
|
||||||
|
TargetAttributes = {
|
||||||
|
4080A96A20B029B00036BA46 = {
|
||||||
|
CreatedOnToolsVersion = 9.3.1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = 4080A96620B029B00036BA46 /* Build configuration list for PBXProject "example_osx_opengl2" */;
|
||||||
|
compatibilityVersion = "Xcode 9.3";
|
||||||
|
developmentRegion = en;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
);
|
||||||
|
mainGroup = 4080A96220B029B00036BA46;
|
||||||
|
productRefGroup = 4080A96C20B029B00036BA46 /* Products */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
4080A96A20B029B00036BA46 /* example_osx_opengl2 */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
4080A96720B029B00036BA46 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
4080A99820B02D340036BA46 /* main.mm in Sources */,
|
||||||
|
4080A9AD20B0343C0036BA46 /* imgui_demo.cpp in Sources */,
|
||||||
|
4080A9AF20B0343C0036BA46 /* imgui_draw.cpp in Sources */,
|
||||||
|
4080A9A220B034280036BA46 /* imgui_impl_opengl2.cpp in Sources */,
|
||||||
|
4080A9B020B0347A0036BA46 /* imgui_impl_osx.mm in Sources */,
|
||||||
|
4080A9AE20B0343C0036BA46 /* imgui.cpp in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
4080A97020B029B00036BA46 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = macosx;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
4080A97120B029B00036BA46 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
SDKROOT = macosx;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
4080A97320B029B00036BA46 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w;
|
||||||
|
USER_HEADER_SEARCH_PATHS = ../..;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
4080A97420B029B00036BA46 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w;
|
||||||
|
USER_HEADER_SEARCH_PATHS = ../..;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
4080A96620B029B00036BA46 /* Build configuration list for PBXProject "example_osx_opengl2" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
4080A97020B029B00036BA46 /* Debug */,
|
||||||
|
4080A97120B029B00036BA46 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
4080A97220B029B00036BA46 /* Build configuration list for PBXNativeTarget "example_osx_opengl2" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
4080A97320B029B00036BA46 /* Debug */,
|
||||||
|
4080A97420B029B00036BA46 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = 4080A96320B029B00036BA46 /* Project object */;
|
||||||
|
}
|
281
examples/example_apple_opengl2/main.mm
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
// ImGui - standalone example application for OSX + OpenGL2, using legacy fixed pipeline
|
||||||
|
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "../imgui_impl_osx.h"
|
||||||
|
#include "../imgui_impl_opengl2.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <OpenGL/gl.h>
|
||||||
|
#import <OpenGL/glu.h>
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
// ImGuiExampleView
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@interface ImGuiExampleView : NSOpenGLView
|
||||||
|
{
|
||||||
|
NSTimer* animationTimer;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation ImGuiExampleView
|
||||||
|
|
||||||
|
-(void)animationTimerFired:(NSTimer*)timer
|
||||||
|
{
|
||||||
|
[self setNeedsDisplay:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)prepareOpenGL
|
||||||
|
{
|
||||||
|
[super prepareOpenGL];
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
GLint swapInterval = 1;
|
||||||
|
[[self openGLContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
|
||||||
|
if (swapInterval == 0)
|
||||||
|
NSLog(@"Error: Cannot set swap interval.");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)updateAndDrawDemoView
|
||||||
|
{
|
||||||
|
// Start the Dear ImGui frame
|
||||||
|
ImGui_ImplOpenGL2_NewFrame();
|
||||||
|
ImGui_ImplOSX_NewFrame(self);
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
// Global data for the demo
|
||||||
|
static bool show_demo_window = true;
|
||||||
|
static bool show_another_window = false;
|
||||||
|
static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||||
|
|
||||||
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
|
{
|
||||||
|
static float f = 0.0f;
|
||||||
|
static int counter = 0;
|
||||||
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
|
counter++;
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Show another simple window.
|
||||||
|
if (show_another_window)
|
||||||
|
{
|
||||||
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
|
ImGui::Text("Hello from another window!");
|
||||||
|
if (ImGui::Button("Close Me"))
|
||||||
|
show_another_window = false;
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rendering
|
||||||
|
ImGui::Render();
|
||||||
|
[[self openGLContext] makeCurrentContext];
|
||||||
|
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
GLsizei width = (GLsizei)(io.DisplaySize.x * io.DisplayFramebufferScale.x);
|
||||||
|
GLsizei height = (GLsizei)(io.DisplaySize.y * io.DisplayFramebufferScale.y);
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
|
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
|
// Present
|
||||||
|
[[self openGLContext] flushBuffer];
|
||||||
|
|
||||||
|
if (!animationTimer)
|
||||||
|
animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)reshape
|
||||||
|
{
|
||||||
|
[[self openGLContext] update];
|
||||||
|
[self updateAndDrawDemoView];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)drawRect:(NSRect)bounds
|
||||||
|
{
|
||||||
|
[self updateAndDrawDemoView];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(BOOL)acceptsFirstResponder
|
||||||
|
{
|
||||||
|
return (YES);
|
||||||
|
}
|
||||||
|
|
||||||
|
-(BOOL)becomeFirstResponder
|
||||||
|
{
|
||||||
|
return (YES);
|
||||||
|
}
|
||||||
|
|
||||||
|
-(BOOL)resignFirstResponder
|
||||||
|
{
|
||||||
|
return (YES);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flip coordinate system upside down on Y
|
||||||
|
-(BOOL)isFlipped
|
||||||
|
{
|
||||||
|
return (YES);
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)dealloc
|
||||||
|
{
|
||||||
|
animationTimer = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forward Mouse/Keyboard events to dear imgui OSX back-end. It returns true when imgui is expecting to use the event.
|
||||||
|
-(void)keyUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
|
||||||
|
-(void)keyDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
|
||||||
|
-(void)flagsChanged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
|
||||||
|
-(void)mouseDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
|
||||||
|
-(void)mouseUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
|
||||||
|
-(void)scrollWheel:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
// ImGuiExampleAppDelegate
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@interface ImGuiExampleAppDelegate : NSObject <NSApplicationDelegate>
|
||||||
|
@property (nonatomic, readonly) NSWindow* window;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation ImGuiExampleAppDelegate
|
||||||
|
@synthesize window = _window;
|
||||||
|
|
||||||
|
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSWindow*)window
|
||||||
|
{
|
||||||
|
if (_window != nil)
|
||||||
|
return (_window);
|
||||||
|
|
||||||
|
NSRect viewRect = NSMakeRect(100.0, 100.0, 100.0 + 1280.0, 100 + 720.0);
|
||||||
|
|
||||||
|
_window = [[NSWindow alloc] initWithContentRect:viewRect styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable|NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:YES];
|
||||||
|
[_window setTitle:@"Dear ImGui OSX+OpenGL2 Example"];
|
||||||
|
[_window setOpaque:YES];
|
||||||
|
[_window makeKeyAndOrderFront:NSApp];
|
||||||
|
|
||||||
|
return (_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)setupMenu
|
||||||
|
{
|
||||||
|
NSMenu* mainMenuBar = [[NSMenu alloc] init];
|
||||||
|
NSMenu* appMenu;
|
||||||
|
NSMenuItem* menuItem;
|
||||||
|
|
||||||
|
appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+OpenGL2 Example"];
|
||||||
|
menuItem = [appMenu addItemWithTitle:@"Quit Dear ImGui OSX+OpenGL2 Example" action:@selector(terminate:) keyEquivalent:@"q"];
|
||||||
|
[menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
|
||||||
|
|
||||||
|
menuItem = [[NSMenuItem alloc] init];
|
||||||
|
[menuItem setSubmenu:appMenu];
|
||||||
|
|
||||||
|
[mainMenuBar addItem:menuItem];
|
||||||
|
|
||||||
|
appMenu = nil;
|
||||||
|
[NSApp setMainMenu:mainMenuBar];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)dealloc
|
||||||
|
{
|
||||||
|
_window = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
// Make the application a foreground application (else it won't receive keyboard events)
|
||||||
|
ProcessSerialNumber psn = {0, kCurrentProcess};
|
||||||
|
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
[self setupMenu];
|
||||||
|
|
||||||
|
NSOpenGLPixelFormatAttribute attrs[] =
|
||||||
|
{
|
||||||
|
NSOpenGLPFADoubleBuffer,
|
||||||
|
NSOpenGLPFADepthSize, 32,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||||
|
ImGuiExampleView* view = [[ImGuiExampleView alloc] initWithFrame:self.window.frame pixelFormat:format];
|
||||||
|
format = nil;
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
|
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||||
|
[view setWantsBestResolutionOpenGLSurface:YES];
|
||||||
|
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
|
[self.window setContentView:view];
|
||||||
|
|
||||||
|
if ([view openGLContext] == nil)
|
||||||
|
NSLog(@"No OpenGL Context!");
|
||||||
|
|
||||||
|
// Setup Dear ImGui binding
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
ImGui::CreateContext();
|
||||||
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
ImGui_ImplOSX_Init();
|
||||||
|
ImGui_ImplOpenGL2_Init();
|
||||||
|
|
||||||
|
// Setup style
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
// Load Fonts
|
||||||
|
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
||||||
|
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
||||||
|
// - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
|
||||||
|
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
|
||||||
|
// - Read 'misc/fonts/README.txt' for more instructions and details.
|
||||||
|
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
|
||||||
|
//io.Fonts->AddFontDefault();
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
|
||||||
|
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||||
|
//IM_ASSERT(font != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[])
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
|
{
|
||||||
|
NSApp = [NSApplication sharedApplication];
|
||||||
|
ImGuiExampleAppDelegate* delegate = [[ImGuiExampleAppDelegate alloc] init];
|
||||||
|
[[NSApplication sharedApplication] setDelegate:delegate];
|
||||||
|
[NSApp run];
|
||||||
|
}
|
||||||
|
return NSApplicationMain(argc, argv);
|
||||||
|
}
|
@ -17,53 +17,54 @@ static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
|||||||
|
|
||||||
void my_display_code()
|
void my_display_code()
|
||||||
{
|
{
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void glut_display_func()
|
void glut_display_func()
|
||||||
{
|
{
|
||||||
|
// Start the ImGui frame
|
||||||
ImGui_ImplOpenGL2_NewFrame();
|
ImGui_ImplOpenGL2_NewFrame();
|
||||||
ImGui_ImplFreeGLUT_NewFrame();
|
ImGui_ImplFreeGLUT_NewFrame();
|
||||||
|
|
||||||
my_display_code();
|
my_display_code();
|
||||||
|
|
||||||
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y);
|
glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y);
|
||||||
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||||
@ -87,7 +88,7 @@ int main(int argc, char** argv)
|
|||||||
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
|
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
|
||||||
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
|
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
|
||||||
glutInitWindowSize(1280, 720);
|
glutInitWindowSize(1280, 720);
|
||||||
glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
|
glutCreateWindow("Dear ImGui FreeGLUT+OpenGL2 Example");
|
||||||
|
|
||||||
// Setup GLUT display function
|
// Setup GLUT display function
|
||||||
// We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
|
// We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
|
||||||
|
@ -23,7 +23,9 @@ int main(int, char**)
|
|||||||
glfwSetErrorCallback(glfw_error_callback);
|
glfwSetErrorCallback(glfw_error_callback);
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
return 1;
|
return 1;
|
||||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui GLFW+OpenGL2 example", NULL, NULL);
|
GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL2 example", NULL, NULL);
|
||||||
|
if (window == NULL)
|
||||||
|
return 1;
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval(1); // Enable vsync
|
glfwSwapInterval(1); // Enable vsync
|
||||||
|
|
||||||
@ -70,48 +72,48 @@ int main(int, char**)
|
|||||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplOpenGL2_NewFrame();
|
ImGui_ImplOpenGL2_NewFrame();
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
int display_w, display_h;
|
int display_w, display_h;
|
||||||
|
@ -18,17 +18,35 @@ EXE = example_glfw_opengl3
|
|||||||
SOURCES = main.cpp
|
SOURCES = main.cpp
|
||||||
SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl3.cpp
|
SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl3.cpp
|
||||||
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
|
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
|
||||||
SOURCES += ../libs/gl3w/GL/gl3w.c
|
|
||||||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
||||||
|
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
|
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
## OPENGL LOADER
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Using OpenGL loader: gl3w [default]
|
||||||
|
SOURCES += ../libs/gl3w/GL/gl3w.c
|
||||||
|
CXXFLAGS = -I../libs/gl3w
|
||||||
|
|
||||||
|
## Using OpenGL loader: glew
|
||||||
|
## (This assumes a system-wide installation)
|
||||||
|
# CXXFLAGS = -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||||
|
|
||||||
|
## Using OpenGL loader: glad
|
||||||
|
## (You'll also need to change the rule at line ~77 of this Makefile to compile/link glad.c/.o)
|
||||||
|
# SOURCES += ../libs/glad/src/glad.c
|
||||||
|
# CXXFLAGS = -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
|
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
## BUILD FLAGS PER PLATFORM
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Linux) #LINUX
|
ifeq ($(UNAME_S), Linux) #LINUX
|
||||||
ECHO_MESSAGE = "Linux"
|
ECHO_MESSAGE = "Linux"
|
||||||
LIBS = -lGL `pkg-config --static --libs glfw3`
|
LIBS = -lGL `pkg-config --static --libs glfw3`
|
||||||
|
|
||||||
CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3`
|
CXXFLAGS += -I../ -I../../ `pkg-config --cflags glfw3`
|
||||||
CXXFLAGS += -Wall -Wformat
|
CXXFLAGS += -Wall -Wformat
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
@ -39,7 +57,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE
|
|||||||
#LIBS += -L/usr/local/lib -lglfw3
|
#LIBS += -L/usr/local/lib -lglfw3
|
||||||
LIBS += -L/usr/local/lib -lglfw
|
LIBS += -L/usr/local/lib -lglfw
|
||||||
|
|
||||||
CXXFLAGS = -I../ -I../../ -I../libs/gl3w -I/usr/local/include
|
CXXFLAGS += -I../ -I../../ -I/usr/local/include
|
||||||
CXXFLAGS += -Wall -Wformat
|
CXXFLAGS += -Wall -Wformat
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
@ -48,11 +66,14 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
|||||||
ECHO_MESSAGE = "Windows"
|
ECHO_MESSAGE = "Windows"
|
||||||
LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32
|
LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32
|
||||||
|
|
||||||
CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3`
|
CXXFLAGS += -I../ -I../../ `pkg-config --cflags glfw3`
|
||||||
CXXFLAGS += -Wall -Wformat
|
CXXFLAGS += -Wall -Wformat
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
## BUILD RULES
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
|
||||||
%.o:%.cpp
|
%.o:%.cpp
|
||||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||||
@ -64,6 +85,7 @@ endif
|
|||||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
%.o:../libs/gl3w/GL/%.c
|
%.o:../libs/gl3w/GL/%.c
|
||||||
|
# %.o:../libs/glad/src/%.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
all: $(EXE)
|
all: $(EXE)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
||||||
mkdir Debug
|
mkdir Debug
|
||||||
cl /nologo /Zi /MD /I ..\.. /I ..\libs\glfw\include /I ..\libs\gl3w *.cpp ..\imgui_impl_glfw.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_glfw_opengl3.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
|
cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I ..\libs\gl3w *.cpp ..\imgui_impl_glfw.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_glfw_opengl3.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
|
||||||
|
@ -1,15 +1,26 @@
|
|||||||
// ImGui - standalone example application for GLFW + OpenGL 3, using programmable pipeline
|
// ImGui - standalone example application for GLFW + OpenGL 3, using programmable pipeline
|
||||||
// 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.
|
||||||
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||||
// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.)
|
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_glfw.h"
|
#include "imgui_impl_glfw.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
|
|
||||||
//#include <glew.h>
|
// About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual function pointers to be loaded manually.
|
||||||
#include <GLFW/glfw3.h>
|
// Helper libraries are often used for this purpose! Here we are supporting a few common ones: gl3w, glew, glad.
|
||||||
|
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
|
||||||
|
#include <GL/gl3w.h> // Initialize with gl3wInit()
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
|
||||||
|
#include <GL/glew.h> // Initialize with glewInit()
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
|
#include <glad/glad.h> // Initialize with gladLoadGL()
|
||||||
|
#else
|
||||||
|
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <GLFW/glfw3.h> // Include glfw3.h after our OpenGL definitions
|
||||||
|
|
||||||
static void glfw_error_callback(int error, const char* description)
|
static void glfw_error_callback(int error, const char* description)
|
||||||
{
|
{
|
||||||
@ -22,16 +33,44 @@ int main(int, char**)
|
|||||||
glfwSetErrorCallback(glfw_error_callback);
|
glfwSetErrorCallback(glfw_error_callback);
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
// Decide GL+GLSL versions
|
||||||
|
#if __APPLE__
|
||||||
|
// GL 3.2 + GLSL 150
|
||||||
|
const char* glsl_version = "#version 150";
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
|
||||||
#if __APPLE__
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
#else
|
||||||
|
// GL 3.0 + GLSL 130
|
||||||
|
const char* glsl_version = "#version 130";
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
|
//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
|
||||||
|
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only
|
||||||
#endif
|
#endif
|
||||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui GLFW+OpenGL3 example", NULL, NULL);
|
|
||||||
|
// Create window with graphics context
|
||||||
|
GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL3 example", NULL, NULL);
|
||||||
|
if (window == NULL)
|
||||||
|
return 1;
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval(1); // Enable vsync
|
glfwSwapInterval(1); // Enable vsync
|
||||||
gl3wInit();
|
|
||||||
|
// Initialize OpenGL loader
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
|
||||||
|
bool err = gl3wInit() != 0;
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
|
||||||
|
bool err = glewInit() != GLEW_OK;
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
|
bool err = gladLoadGL() != 0;
|
||||||
|
#endif
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to initialize OpenGL loader!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui binding
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
@ -41,15 +80,15 @@ int main(int, char**)
|
|||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
|
||||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||||
ImGui_ImplOpenGL3_Init();
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
// Load Fonts
|
// Load Fonts
|
||||||
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
||||||
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
||||||
// - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
|
// - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
|
||||||
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
|
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
|
||||||
// - Read 'misc/fonts/README.txt' for more instructions and details.
|
// - Read 'misc/fonts/README.txt' for more instructions and details.
|
||||||
@ -76,48 +115,48 @@ int main(int, char**)
|
|||||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
int display_w, display_h;
|
int display_w, display_h;
|
||||||
@ -127,7 +166,7 @@ int main(int, char**)
|
|||||||
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ include_directories(${GLFW_DIR}/include)
|
|||||||
|
|
||||||
# ImGui
|
# ImGui
|
||||||
set(IMGUI_DIR ../../)
|
set(IMGUI_DIR ../../)
|
||||||
include_directories(${IMGUI_DIR})
|
include_directories(${IMGUI_DIR} ..)
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
find_library(VULKAN_LIBRARY
|
find_library(VULKAN_LIBRARY
|
||||||
|
@ -196,11 +196,12 @@ static void SetupVulkanWindowData(ImGui_ImplVulkanH_WindowData* wd, VkSurfaceKHR
|
|||||||
|
|
||||||
// Get Present Mode
|
// Get Present Mode
|
||||||
#ifdef IMGUI_UNLIMITED_FRAME_RATE
|
#ifdef IMGUI_UNLIMITED_FRAME_RATE
|
||||||
VkPresentModeKHR present_mode = VK_PRESENT_MODE_MAILBOX_KHR;// VK_PRESENT_MODE_IMMEDIATE_KHR;
|
VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR };
|
||||||
#else
|
#else
|
||||||
VkPresentModeKHR present_mode = VK_PRESENT_MODE_FIFO_KHR;
|
VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR };
|
||||||
#endif
|
#endif
|
||||||
wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_mode, 1);
|
wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_modes[0], IM_ARRAYSIZE(present_modes));
|
||||||
|
//printf("[vulkan] Selected PresentMode = %d\n", wd->PresentMode);
|
||||||
|
|
||||||
// Create SwapChain, RenderPass, Framebuffer, etc.
|
// Create SwapChain, RenderPass, Framebuffer, etc.
|
||||||
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator);
|
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator);
|
||||||
@ -318,7 +319,7 @@ int main(int, char**)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui GLFW+Vulkan example", NULL, NULL);
|
GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+Vulkan example", NULL, NULL);
|
||||||
|
|
||||||
// Setup Vulkan
|
// Setup Vulkan
|
||||||
if (!glfwVulkanSupported())
|
if (!glfwVulkanSupported())
|
||||||
@ -433,48 +434,48 @@ int main(int, char**)
|
|||||||
g_ResizeWanted = false;
|
g_ResizeWanted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplVulkan_NewFrame();
|
ImGui_ImplVulkan_NewFrame();
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color (nb: you could use (float*)&wd->ClearValue instead)
|
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
|
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
|
||||||
|
@ -60,47 +60,47 @@ int main(int, char**)
|
|||||||
s3eKeyboardUpdate();
|
s3eKeyboardUpdate();
|
||||||
s3ePointerUpdate();
|
s3ePointerUpdate();
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_Marmalade_NewFrame();
|
ImGui_Marmalade_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
|
IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
|
||||||
|
@ -5,18 +5,18 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
set SDL2DIR=path_to_your_sdl2_folder
|
set SDL2DIR=path_to_your_sdl2_folder
|
||||||
cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
cl /Zi /MD /I %SDL2DIR%\include /I .. /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||||
```
|
```
|
||||||
|
|
||||||
- On Linux and similar Unixes
|
- On Linux and similar Unixes
|
||||||
|
|
||||||
```
|
```
|
||||||
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
|
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
|
||||||
```
|
```
|
||||||
|
|
||||||
- On Mac OS X
|
- On Mac OS X
|
||||||
|
|
||||||
```
|
```
|
||||||
brew install sdl2
|
brew install sdl2
|
||||||
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
|
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
|
||||||
```
|
```
|
||||||
|
@ -30,7 +30,7 @@ int main(int, char**)
|
|||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
SDL_DisplayMode current;
|
SDL_DisplayMode current;
|
||||||
SDL_GetCurrentDisplayMode(0, ¤t);
|
SDL_GetCurrentDisplayMode(0, ¤t);
|
||||||
SDL_Window* window = SDL_CreateWindow("ImGui SDL2+OpenGL example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
|
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
|
||||||
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
||||||
SDL_GL_SetSwapInterval(1); // Enable vsync
|
SDL_GL_SetSwapInterval(1); // Enable vsync
|
||||||
|
|
||||||
@ -83,48 +83,48 @@ int main(int, char**)
|
|||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplOpenGL2_NewFrame();
|
ImGui_ImplOpenGL2_NewFrame();
|
||||||
ImGui_ImplSDL2_NewFrame(window);
|
ImGui_ImplSDL2_NewFrame(window);
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
|
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
|
||||||
|
@ -18,11 +18,29 @@ EXE = example_sdl_opengl3
|
|||||||
SOURCES = main.cpp
|
SOURCES = main.cpp
|
||||||
SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp
|
SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp
|
||||||
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
|
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
|
||||||
SOURCES += ../libs/gl3w/GL/gl3w.c
|
|
||||||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
||||||
|
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
|
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
## OPENGL LOADER
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Using OpenGL loader: gl3w [default]
|
||||||
|
SOURCES += ../libs/gl3w/GL/gl3w.c
|
||||||
|
CXXFLAGS = -I../libs/gl3w
|
||||||
|
|
||||||
|
## Using OpenGL loader: glew
|
||||||
|
## (This assumes a system-wide installation)
|
||||||
|
# CXXFLAGS = -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||||
|
|
||||||
|
## Using OpenGL loader: glad
|
||||||
|
## (You'll also need to change the rule at line ~77 of this Makefile to compile/link glad.c/.o)
|
||||||
|
# SOURCES += ../libs/glad/src/glad.c
|
||||||
|
# CXXFLAGS = -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
|
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
## BUILD FLAGS PER PLATFORM
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Linux) #LINUX
|
ifeq ($(UNAME_S), Linux) #LINUX
|
||||||
ECHO_MESSAGE = "Linux"
|
ECHO_MESSAGE = "Linux"
|
||||||
@ -51,6 +69,9 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
|||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
## BUILD RULES
|
||||||
|
##---------------------------------------------------------------------
|
||||||
|
|
||||||
%.o:%.cpp
|
%.o:%.cpp
|
||||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
@ -5,18 +5,18 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
set SDL2DIR=path_to_your_sdl2_folder
|
set SDL2DIR=path_to_your_sdl2_folder
|
||||||
cl /Zi /MD /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
cl /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||||
```
|
```
|
||||||
|
|
||||||
- On Linux and similar Unixes
|
- On Linux and similar Unixes
|
||||||
|
|
||||||
```
|
```
|
||||||
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl
|
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl
|
||||||
```
|
```
|
||||||
|
|
||||||
- On Mac OS X
|
- On Mac OS X
|
||||||
|
|
||||||
```
|
```
|
||||||
brew install sdl2
|
brew install sdl2
|
||||||
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation
|
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation
|
||||||
```
|
```
|
||||||
|
@ -7,10 +7,21 @@
|
|||||||
#include "imgui_impl_sdl.h"
|
#include "imgui_impl_sdl.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
|
|
||||||
//#include <glew.h>
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
// About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual function pointers to be loaded manually.
|
||||||
|
// Helper libraries are often used for this purpose! Here we are supporting a few common ones: gl3w, glew, glad.
|
||||||
|
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
|
||||||
|
#include <GL/gl3w.h> // Initialize with gl3wInit()
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
|
||||||
|
#include <GL/glew.h> // Initialize with glewInit()
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
|
#include <glad/glad.h> // Initialize with gladLoadGL()
|
||||||
|
#else
|
||||||
|
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
@ -20,20 +31,46 @@ int main(int, char**)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup window
|
// Decide GL+GLSL versions
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
|
#if __APPLE__
|
||||||
|
// GL 3.2 Core + GLSL 150
|
||||||
|
const char* glsl_version = "#version 150";
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
|
#else
|
||||||
|
// GL 3.0 + GLSL 130
|
||||||
|
const char* glsl_version = "#version 130";
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Create window with graphics context
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
|
||||||
SDL_DisplayMode current;
|
SDL_DisplayMode current;
|
||||||
SDL_GetCurrentDisplayMode(0, ¤t);
|
SDL_GetCurrentDisplayMode(0, ¤t);
|
||||||
SDL_Window* window = SDL_CreateWindow("ImGui SDL2+OpenGL3 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
|
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL3 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
|
||||||
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
||||||
SDL_GL_SetSwapInterval(1); // Enable vsync
|
SDL_GL_SetSwapInterval(1); // Enable vsync
|
||||||
gl3wInit();
|
|
||||||
|
// Initialize OpenGL loader
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
|
||||||
|
bool err = gl3wInit() != 0;
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
|
||||||
|
bool err = glewInit() != GLEW_OK;
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
|
bool err = gladLoadGL() != 0;
|
||||||
|
#endif
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to initialize OpenGL loader!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui binding
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
@ -42,7 +79,7 @@ int main(int, char**)
|
|||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
|
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
|
||||||
ImGui_ImplOpenGL3_Init();
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
@ -86,48 +123,48 @@ int main(int, char**)
|
|||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
ImGui_ImplSDL2_NewFrame(window);
|
ImGui_ImplSDL2_NewFrame(window);
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
SDL_GL_MakeCurrent(window, gl_context);
|
SDL_GL_MakeCurrent(window, gl_context);
|
||||||
|
@ -307,7 +307,7 @@ int main(int, char**)
|
|||||||
// Setup window
|
// Setup window
|
||||||
SDL_DisplayMode current;
|
SDL_DisplayMode current;
|
||||||
SDL_GetCurrentDisplayMode(0, ¤t);
|
SDL_GetCurrentDisplayMode(0, ¤t);
|
||||||
SDL_Window* window = SDL_CreateWindow("ImGui SDL2+Vulkan example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_VULKAN|SDL_WINDOW_RESIZABLE);
|
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+Vulkan example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_VULKAN|SDL_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
// Setup Vulkan
|
// Setup Vulkan
|
||||||
uint32_t extensions_count = 0;
|
uint32_t extensions_count = 0;
|
||||||
@ -425,48 +425,48 @@ int main(int, char**)
|
|||||||
ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, &g_WindowData, g_Allocator, (int)event.window.data1, (int)event.window.data2);
|
ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, &g_WindowData, g_Allocator, (int)event.window.data1, (int)event.window.data2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplVulkan_NewFrame();
|
ImGui_ImplVulkan_NewFrame();
|
||||||
ImGui_ImplSDL2_NewFrame(window);
|
ImGui_ImplSDL2_NewFrame(window);
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
|
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
|
||||||
|
@ -98,7 +98,7 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||||
|
|
||||||
// Initialize Direct3D
|
// Initialize Direct3D
|
||||||
if (CreateDeviceD3D(hwnd) < 0)
|
if (CreateDeviceD3D(hwnd) < 0)
|
||||||
@ -161,48 +161,48 @@ int main(int, char**)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplDX10_NewFrame();
|
ImGui_ImplDX10_NewFrame();
|
||||||
ImGui_ImplWin32_NewFrame();
|
ImGui_ImplWin32_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
g_pd3dDevice->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
|
g_pd3dDevice->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
|
||||||
|
@ -101,7 +101,7 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||||
|
|
||||||
// Initialize Direct3D
|
// Initialize Direct3D
|
||||||
if (CreateDeviceD3D(hwnd) < 0)
|
if (CreateDeviceD3D(hwnd) < 0)
|
||||||
@ -143,6 +143,7 @@ int main(int, char**)
|
|||||||
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||||
//IM_ASSERT(font != NULL);
|
//IM_ASSERT(font != NULL);
|
||||||
|
|
||||||
|
// Our state
|
||||||
bool show_demo_window = true;
|
bool show_demo_window = true;
|
||||||
bool show_another_window = false;
|
bool show_another_window = false;
|
||||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||||
@ -164,48 +165,48 @@ int main(int, char**)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplDX11_NewFrame();
|
ImGui_ImplDX11_NewFrame();
|
||||||
ImGui_ImplWin32_NewFrame();
|
ImGui_ImplWin32_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
g_pd3dDeviceContext->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
|
g_pd3dDeviceContext->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
|
||||||
|
@ -272,7 +272,7 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||||
|
|
||||||
// Initialize Direct3D
|
// Initialize Direct3D
|
||||||
if (CreateDeviceD3D(hwnd) < 0)
|
if (CreateDeviceD3D(hwnd) < 0)
|
||||||
@ -338,48 +338,48 @@ int main(int, char**)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplDX12_NewFrame();
|
ImGui_ImplDX12_NewFrame();
|
||||||
ImGui_ImplWin32_NewFrame();
|
ImGui_ImplWin32_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
FrameContext* frameCtxt = WaitForNextFrameResources();
|
FrameContext* frameCtxt = WaitForNextFrameResources();
|
||||||
UINT backBufferIdx = g_pSwapChain->GetCurrentBackBufferIndex();
|
UINT backBufferIdx = g_pSwapChain->GetCurrentBackBufferIndex();
|
||||||
|
@ -49,7 +49,7 @@ int main(int, char**)
|
|||||||
// Create application window
|
// Create application window
|
||||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||||
|
|
||||||
// Initialize Direct3D
|
// Initialize Direct3D
|
||||||
LPDIRECT3D9 pD3D;
|
LPDIRECT3D9 pD3D;
|
||||||
@ -125,48 +125,48 @@ int main(int, char**)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplDX9_NewFrame();
|
ImGui_ImplDX9_NewFrame();
|
||||||
ImGui_ImplWin32_NewFrame();
|
ImGui_ImplWin32_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window.
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
|
|
||||||
counter++;
|
counter++;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("counter = %d", counter);
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 3. Show another simple window.
|
||||||
if (show_another_window)
|
if (show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
if (ImGui::Button("Close Me"))
|
if (ImGui::Button("Close Me"))
|
||||||
show_another_window = false;
|
show_another_window = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
|
|
||||||
if (show_demo_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::EndFrame();
|
ImGui::EndFrame();
|
||||||
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, false);
|
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, false);
|
||||||
|
@ -10,9 +10,8 @@
|
|||||||
// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert the format of vertices.
|
// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert the format of vertices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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, Original Allegro 5 code by @birthggd
|
||||||
// https://github.com/ocornut/imgui, Original code by @birthggd
|
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
@ -9,9 +9,8 @@
|
|||||||
// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
|
// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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, Original Allegro 5 code by @birthggd
|
||||||
// https://github.com/ocornut/imgui, Original code by @birthggd
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (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-07-13: DirectX10: Fixed unreleased resources in Init and Shutdown functions.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_dx10.cpp/.h away from the old combined DX10+Win32 example.
|
// 2018-06-08: Misc: Extracted imgui_impl_dx10.cpp/.h away from the old combined DX10+Win32 example.
|
||||||
// 2018-06-08: DirectX10: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
// 2018-06-08: DirectX10: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||||
// 2018-04-09: Misc: Fixed erroneous call to io.Fonts->ClearInputData() + ClearTexData() that was left in DX10 example but removed in 1.47 (Nov 2015) on other back-ends.
|
// 2018-04-09: Misc: Fixed erroneous call to io.Fonts->ClearInputData() + ClearTexData() that was left in DX10 example but removed in 1.47 (Nov 2015) on other back-ends.
|
||||||
@ -32,11 +32,11 @@ static ID3D10Device* g_pd3dDevice = NULL;
|
|||||||
static IDXGIFactory* g_pFactory = NULL;
|
static IDXGIFactory* g_pFactory = NULL;
|
||||||
static ID3D10Buffer* g_pVB = NULL;
|
static ID3D10Buffer* g_pVB = NULL;
|
||||||
static ID3D10Buffer* g_pIB = NULL;
|
static ID3D10Buffer* g_pIB = NULL;
|
||||||
static ID3D10Blob * g_pVertexShaderBlob = NULL;
|
static ID3D10Blob* g_pVertexShaderBlob = NULL;
|
||||||
static ID3D10VertexShader* g_pVertexShader = NULL;
|
static ID3D10VertexShader* g_pVertexShader = NULL;
|
||||||
static ID3D10InputLayout* g_pInputLayout = NULL;
|
static ID3D10InputLayout* g_pInputLayout = NULL;
|
||||||
static ID3D10Buffer* g_pVertexConstantBuffer = NULL;
|
static ID3D10Buffer* g_pVertexConstantBuffer = NULL;
|
||||||
static ID3D10Blob * g_pPixelShaderBlob = NULL;
|
static ID3D10Blob* g_pPixelShaderBlob = NULL;
|
||||||
static ID3D10PixelShader* g_pPixelShader = NULL;
|
static ID3D10PixelShader* g_pPixelShader = NULL;
|
||||||
static ID3D10SamplerState* g_pFontSampler = NULL;
|
static ID3D10SamplerState* g_pFontSampler = NULL;
|
||||||
static ID3D10ShaderResourceView*g_pFontTextureView = NULL;
|
static ID3D10ShaderResourceView*g_pFontTextureView = NULL;
|
||||||
@ -213,7 +213,8 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
|
|||||||
ctx->RSSetScissorRects(1, &r);
|
ctx->RSSetScissorRects(1, &r);
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
ctx->PSSetShaderResources(0, 1, (ID3D10ShaderResourceView**)&pcmd->TextureId);
|
ID3D10ShaderResourceView* texture_srv = (ID3D10ShaderResourceView*)pcmd->TextureId;
|
||||||
|
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
||||||
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
idx_offset += pcmd->ElemCount;
|
||||||
@ -279,7 +280,7 @@ static void ImGui_ImplDX10_CreateFontsTexture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)g_pFontTextureView;
|
io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
|
||||||
|
|
||||||
// Create texture sampler
|
// Create texture sampler
|
||||||
{
|
{
|
||||||
@ -466,15 +467,16 @@ bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
|||||||
IDXGIDevice* pDXGIDevice = NULL;
|
IDXGIDevice* pDXGIDevice = NULL;
|
||||||
IDXGIAdapter* pDXGIAdapter = NULL;
|
IDXGIAdapter* pDXGIAdapter = NULL;
|
||||||
IDXGIFactory* pFactory = NULL;
|
IDXGIFactory* pFactory = NULL;
|
||||||
if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) != S_OK)
|
|
||||||
return false;
|
|
||||||
if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) != S_OK)
|
|
||||||
return false;
|
|
||||||
if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) != S_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
g_pd3dDevice = device;
|
if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) == S_OK)
|
||||||
g_pFactory = pFactory;
|
if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) == S_OK)
|
||||||
|
if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) == S_OK)
|
||||||
|
{
|
||||||
|
g_pd3dDevice = device;
|
||||||
|
g_pFactory = pFactory;
|
||||||
|
}
|
||||||
|
if (pDXGIDevice) pDXGIDevice->Release();
|
||||||
|
if (pDXGIAdapter) pDXGIAdapter->Release();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -482,6 +484,7 @@ bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
|||||||
void ImGui_ImplDX10_Shutdown()
|
void ImGui_ImplDX10_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX10_InvalidateDeviceObjects();
|
ImGui_ImplDX10_InvalidateDeviceObjects();
|
||||||
|
if (g_pFactory) { g_pFactory->Release(); g_pFactory = NULL; }
|
||||||
g_pd3dDevice = NULL;
|
g_pd3dDevice = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
struct ID3D10Device;
|
struct ID3D10Device;
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (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-08-01: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility.
|
||||||
|
// 2018-07-13: DirectX11: Fixed unreleased resources in Init and Shutdown functions.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_dx11.cpp/.h away from the old combined DX11+Win32 example.
|
// 2018-06-08: Misc: Extracted imgui_impl_dx11.cpp/.h away from the old combined DX11+Win32 example.
|
||||||
// 2018-06-08: DirectX11: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
// 2018-06-08: DirectX11: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX11_RenderDrawData() in the .h file so you can call it yourself.
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX11_RenderDrawData() in the .h file so you can call it yourself.
|
||||||
@ -28,14 +29,14 @@
|
|||||||
// DirectX data
|
// DirectX data
|
||||||
static ID3D11Device* g_pd3dDevice = NULL;
|
static ID3D11Device* g_pd3dDevice = NULL;
|
||||||
static ID3D11DeviceContext* g_pd3dDeviceContext = NULL;
|
static ID3D11DeviceContext* g_pd3dDeviceContext = NULL;
|
||||||
static IDXGIFactory1* g_pFactory = NULL;
|
static IDXGIFactory* g_pFactory = NULL;
|
||||||
static ID3D11Buffer* g_pVB = NULL;
|
static ID3D11Buffer* g_pVB = NULL;
|
||||||
static ID3D11Buffer* g_pIB = NULL;
|
static ID3D11Buffer* g_pIB = NULL;
|
||||||
static ID3D10Blob * g_pVertexShaderBlob = NULL;
|
static ID3D10Blob* g_pVertexShaderBlob = NULL;
|
||||||
static ID3D11VertexShader* g_pVertexShader = NULL;
|
static ID3D11VertexShader* g_pVertexShader = NULL;
|
||||||
static ID3D11InputLayout* g_pInputLayout = NULL;
|
static ID3D11InputLayout* g_pInputLayout = NULL;
|
||||||
static ID3D11Buffer* g_pVertexConstantBuffer = NULL;
|
static ID3D11Buffer* g_pVertexConstantBuffer = NULL;
|
||||||
static ID3D10Blob * g_pPixelShaderBlob = NULL;
|
static ID3D10Blob* g_pPixelShaderBlob = NULL;
|
||||||
static ID3D11PixelShader* g_pPixelShader = NULL;
|
static ID3D11PixelShader* g_pPixelShader = NULL;
|
||||||
static ID3D11SamplerState* g_pFontSampler = NULL;
|
static ID3D11SamplerState* g_pFontSampler = NULL;
|
||||||
static ID3D11ShaderResourceView*g_pFontTextureView = NULL;
|
static ID3D11ShaderResourceView*g_pFontTextureView = NULL;
|
||||||
@ -217,7 +218,8 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|||||||
ctx->RSSetScissorRects(1, &r);
|
ctx->RSSetScissorRects(1, &r);
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
ctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->TextureId);
|
ID3D11ShaderResourceView* texture_srv = (ID3D11ShaderResourceView*)pcmd->TextureId;
|
||||||
|
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
||||||
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
idx_offset += pcmd->ElemCount;
|
||||||
@ -285,7 +287,7 @@ static void ImGui_ImplDX11_CreateFontsTexture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)g_pFontTextureView;
|
io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
|
||||||
|
|
||||||
// Create texture sampler
|
// Create texture sampler
|
||||||
{
|
{
|
||||||
@ -471,17 +473,18 @@ bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co
|
|||||||
// Get factory from device
|
// Get factory from device
|
||||||
IDXGIDevice* pDXGIDevice = NULL;
|
IDXGIDevice* pDXGIDevice = NULL;
|
||||||
IDXGIAdapter* pDXGIAdapter = NULL;
|
IDXGIAdapter* pDXGIAdapter = NULL;
|
||||||
IDXGIFactory1* pFactory = NULL;
|
IDXGIFactory* pFactory = NULL;
|
||||||
if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) != S_OK)
|
|
||||||
return false;
|
|
||||||
if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) != S_OK)
|
|
||||||
return false;
|
|
||||||
if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) != S_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
g_pd3dDevice = device;
|
if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) == S_OK)
|
||||||
g_pd3dDeviceContext = device_context;
|
if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) == S_OK)
|
||||||
g_pFactory = pFactory;
|
if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) == S_OK)
|
||||||
|
{
|
||||||
|
g_pd3dDevice = device;
|
||||||
|
g_pd3dDeviceContext = device_context;
|
||||||
|
g_pFactory = pFactory;
|
||||||
|
}
|
||||||
|
if (pDXGIDevice) pDXGIDevice->Release();
|
||||||
|
if (pDXGIAdapter) pDXGIAdapter->Release();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -489,6 +492,7 @@ bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co
|
|||||||
void ImGui_ImplDX11_Shutdown()
|
void ImGui_ImplDX11_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||||
|
if (g_pFactory) { g_pFactory->Release(); g_pFactory = NULL; }
|
||||||
g_pd3dDevice = NULL;
|
g_pd3dDevice = NULL;
|
||||||
g_pd3dDeviceContext = NULL;
|
g_pd3dDeviceContext = NULL;
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
struct ID3D11Device;
|
struct ID3D11Device;
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
@ -365,8 +364,8 @@ static void ImGui_ImplDX12_CreateFontsTexture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
static_assert(sizeof(ImTextureID) >= sizeof(g_hFontSrvGpuDescHandle.ptr), "Can't pack descriptor handle into TexID");
|
static_assert(sizeof(ImTextureID) >= sizeof(g_hFontSrvGpuDescHandle.ptr), "Can't pack descriptor handle into TexID, 32-bit not supported yet.");
|
||||||
io.Fonts->TexID = (void *)g_hFontSrvGpuDescHandle.ptr;
|
io.Fonts->TexID = (ImTextureID)g_hFontSrvGpuDescHandle.ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplDX12_CreateDeviceObjects()
|
bool ImGui_ImplDX12_CreateDeviceObjects()
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
enum DXGI_FORMAT;
|
enum DXGI_FORMAT;
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
@ -178,7 +177,8 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const RECT r = { (LONG)(pcmd->ClipRect.x - pos.x), (LONG)(pcmd->ClipRect.y - pos.y), (LONG)(pcmd->ClipRect.z - pos.x), (LONG)(pcmd->ClipRect.w - pos.y) };
|
const RECT r = { (LONG)(pcmd->ClipRect.x - pos.x), (LONG)(pcmd->ClipRect.y - pos.y), (LONG)(pcmd->ClipRect.z - pos.x), (LONG)(pcmd->ClipRect.w - pos.y) };
|
||||||
g_pd3dDevice->SetTexture(0, (LPDIRECT3DTEXTURE9)pcmd->TextureId);
|
const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->TextureId;
|
||||||
|
g_pd3dDevice->SetTexture(0, texture);
|
||||||
g_pd3dDevice->SetScissorRect(&r);
|
g_pd3dDevice->SetScissorRect(&r);
|
||||||
g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, idx_offset, pcmd->ElemCount/3);
|
g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, idx_offset, pcmd->ElemCount/3);
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ static bool ImGui_ImplDX9_CreateFontsTexture()
|
|||||||
g_FontTexture->UnlockRect(0);
|
g_FontTexture->UnlockRect(0);
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)g_FontTexture;
|
io.Fonts->TexID = (ImTextureID)g_FontTexture;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
struct IDirect3DDevice9;
|
struct IDirect3DDevice9;
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplFreeGLUT_Init();
|
IMGUI_IMPL_API bool ImGui_ImplFreeGLUT_Init();
|
||||||
|
@ -6,14 +6,16 @@
|
|||||||
// [X] Platform: Clipboard support.
|
// [X] Platform: Clipboard support.
|
||||||
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||||
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
||||||
|
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (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-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||||
|
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
|
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
|
||||||
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
||||||
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
|
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
|
||||||
@ -155,7 +157,8 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
|||||||
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
||||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
|
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
|
||||||
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
|
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_Hand] = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
|
||||||
|
|
||||||
if (install_callbacks)
|
if (install_callbacks)
|
||||||
ImGui_ImplGlfw_InstallCallbacks(window);
|
ImGui_ImplGlfw_InstallCallbacks(window);
|
||||||
|
|
||||||
@ -197,7 +200,12 @@ static void ImGui_ImplGlfw_UpdateMousePosAndButtons()
|
|||||||
// Update mouse position
|
// Update mouse position
|
||||||
const ImVec2 mouse_pos_backup = io.MousePos;
|
const ImVec2 mouse_pos_backup = io.MousePos;
|
||||||
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||||||
if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED))
|
#ifdef __EMSCRIPTEN__
|
||||||
|
const bool focused = true; // Emscripten
|
||||||
|
#else
|
||||||
|
const bool focused = glfwGetWindowAttrib(g_Window, GLFW_FOCUSED) != 0;
|
||||||
|
#endif
|
||||||
|
if (focused)
|
||||||
{
|
{
|
||||||
if (io.WantSetMousePos)
|
if (io.WantSetMousePos)
|
||||||
{
|
{
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
// [X] Platform: Clipboard support.
|
// [X] Platform: Clipboard support.
|
||||||
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||||
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
||||||
|
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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:
|
// About GLSL version:
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
// ImGui Renderer + Platform Binding for: Marmalade + IwGx
|
// ImGui Renderer + Platform Binding for: Marmalade + IwGx
|
||||||
|
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of ImGui)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// Copyright (C) 2015 by Giovanni Zito
|
|
||||||
// This file is part of ImGui
|
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (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-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_Marmalade_RenderDrawData() in the .h file so you can call it yourself.
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_Marmalade_RenderDrawData() in the .h file so you can call it yourself.
|
||||||
@ -193,7 +190,7 @@ bool ImGui_Marmalade_CreateDeviceObjects()
|
|||||||
g_FontTexture->Upload();
|
g_FontTexture->Upload();
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)g_FontTexture;
|
io.Fonts->TexID = (ImTextureID)g_FontTexture;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// Copyright (C) 2015 by Giovanni Zito
|
// Copyright (C) 2015 by Giovanni Zito
|
||||||
|
25
examples/imgui_impl_metal.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// ImGui Renderer for: Metal
|
||||||
|
// This needs to be used along with a Platform Binding (e.g. OSX)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
@class MTLRenderPassDescriptor;
|
||||||
|
@protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder;
|
||||||
|
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplMetal_Init(id<MTLDevice> device);
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplMetal_Shutdown();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor *renderPassDescriptor);
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data,
|
||||||
|
id<MTLCommandBuffer> commandBuffer,
|
||||||
|
id<MTLRenderCommandEncoder> commandEncoder);
|
||||||
|
|
||||||
|
// Called by Init/NewFrame/Shutdown
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplMetal_CreateFontsTexture(id<MTLDevice> device);
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplMetal_DestroyFontsTexture();
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplMetal_CreateDeviceObjects(id<MTLDevice> device);
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplMetal_DestroyDeviceObjects();
|
517
examples/imgui_impl_metal.mm
Normal file
@ -0,0 +1,517 @@
|
|||||||
|
// ImGui Renderer for: Metal
|
||||||
|
// This needs to be used along with a Platform Binding (e.g. OSX)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
// CHANGELOG
|
||||||
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2018-07-05: Metal: Added new Metal backend implementation.
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_metal.h"
|
||||||
|
|
||||||
|
#import <Metal/Metal.h>
|
||||||
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
#import <simd/simd.h>
|
||||||
|
|
||||||
|
#pragma mark - Support classes
|
||||||
|
|
||||||
|
// A wrapper around a MTLBuffer object that knows the last time it was reused
|
||||||
|
@interface MetalBuffer : NSObject
|
||||||
|
@property (nonatomic, strong) id<MTLBuffer> buffer;
|
||||||
|
@property (nonatomic, assign) NSTimeInterval lastReuseTime;
|
||||||
|
- (instancetype)initWithBuffer:(id<MTLBuffer>)buffer;
|
||||||
|
@end
|
||||||
|
|
||||||
|
// An object that encapsulates the data necessary to uniquely identify a
|
||||||
|
// render pipeline state. These are used as cache keys.
|
||||||
|
@interface FramebufferDescriptor : NSObject<NSCopying>
|
||||||
|
@property (nonatomic, assign) unsigned long sampleCount;
|
||||||
|
@property (nonatomic, assign) MTLPixelFormat colorPixelFormat;
|
||||||
|
@property (nonatomic, assign) MTLPixelFormat depthPixelFormat;
|
||||||
|
@property (nonatomic, assign) MTLPixelFormat stencilPixelFormat;
|
||||||
|
- (instancetype)initWithRenderPassDescriptor:(MTLRenderPassDescriptor *)renderPassDescriptor;
|
||||||
|
@end
|
||||||
|
|
||||||
|
// A singleton that stores long-lived objects that are needed by the Metal
|
||||||
|
// renderer backend. Stores the render pipeline state cache and the default
|
||||||
|
// font texture, and manages the reusable buffer cache.
|
||||||
|
@interface MetalContext : NSObject
|
||||||
|
@property (nonatomic, strong) id<MTLDepthStencilState> depthStencilState;
|
||||||
|
@property (nonatomic, strong) FramebufferDescriptor *framebufferDescriptor; // framebuffer descriptor for current frame; transient
|
||||||
|
@property (nonatomic, strong) NSMutableDictionary *renderPipelineStateCache; // pipeline cache; keyed on framebuffer descriptors
|
||||||
|
@property (nonatomic, strong, nullable) id<MTLTexture> fontTexture;
|
||||||
|
@property (nonatomic, strong) NSMutableArray<MetalBuffer *> *bufferCache;
|
||||||
|
@property (nonatomic, assign) NSTimeInterval lastBufferCachePurge;
|
||||||
|
- (void)makeDeviceObjectsWithDevice:(id<MTLDevice>)device;
|
||||||
|
- (void)makeFontTextureWithDevice:(id<MTLDevice>)device;
|
||||||
|
- (MetalBuffer *)dequeueReusableBufferOfLength:(NSUInteger)length device:(id<MTLDevice>)device;
|
||||||
|
- (void)enqueueReusableBuffer:(MetalBuffer *)buffer;
|
||||||
|
- (id<MTLRenderPipelineState>)renderPipelineStateForFrameAndDevice:(id<MTLDevice>)device;
|
||||||
|
- (void)emptyRenderPipelineStateCache;
|
||||||
|
- (void)renderDrawData:(ImDrawData *)drawData
|
||||||
|
commandBuffer:(id<MTLCommandBuffer>)commandBuffer
|
||||||
|
commandEncoder:(id<MTLRenderCommandEncoder>)commandEncoder;
|
||||||
|
@end
|
||||||
|
|
||||||
|
static MetalContext *g_sharedMetalContext = nil;
|
||||||
|
|
||||||
|
#pragma mark - ImGui API implementation
|
||||||
|
|
||||||
|
bool ImGui_ImplMetal_Init(id<MTLDevice> device)
|
||||||
|
{
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
g_sharedMetalContext = [[MetalContext alloc] init];
|
||||||
|
});
|
||||||
|
|
||||||
|
ImGui_ImplMetal_CreateDeviceObjects(device);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplMetal_Shutdown()
|
||||||
|
{
|
||||||
|
ImGui_ImplMetal_DestroyDeviceObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor *renderPassDescriptor)
|
||||||
|
{
|
||||||
|
IM_ASSERT(g_sharedMetalContext != nil && "No Metal context. Did you call ImGui_ImplMetal_Init?");
|
||||||
|
|
||||||
|
g_sharedMetalContext.framebufferDescriptor = [[FramebufferDescriptor alloc] initWithRenderPassDescriptor:renderPassDescriptor];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metal Render function.
|
||||||
|
void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, id<MTLCommandBuffer> commandBuffer, id<MTLRenderCommandEncoder> commandEncoder)
|
||||||
|
{
|
||||||
|
[g_sharedMetalContext renderDrawData:draw_data commandBuffer:commandBuffer commandEncoder:commandEncoder];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplMetal_CreateFontsTexture(id<MTLDevice> device)
|
||||||
|
{
|
||||||
|
[g_sharedMetalContext makeFontTextureWithDevice:device];
|
||||||
|
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
io.Fonts->TexID = (__bridge void *)g_sharedMetalContext.fontTexture; // ImTextureID == void*
|
||||||
|
|
||||||
|
return (g_sharedMetalContext.fontTexture != nil);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplMetal_DestroyFontsTexture()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
g_sharedMetalContext.fontTexture = nil;
|
||||||
|
io.Fonts->TexID = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplMetal_CreateDeviceObjects(id<MTLDevice> device)
|
||||||
|
{
|
||||||
|
[g_sharedMetalContext makeDeviceObjectsWithDevice:device];
|
||||||
|
|
||||||
|
ImGui_ImplMetal_CreateFontsTexture(device);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplMetal_DestroyDeviceObjects()
|
||||||
|
{
|
||||||
|
ImGui_ImplMetal_DestroyFontsTexture();
|
||||||
|
[g_sharedMetalContext emptyRenderPipelineStateCache];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - MetalBuffer implementation
|
||||||
|
|
||||||
|
@implementation MetalBuffer
|
||||||
|
- (instancetype)initWithBuffer:(id<MTLBuffer>)buffer
|
||||||
|
{
|
||||||
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
|
_buffer = buffer;
|
||||||
|
_lastReuseTime = [NSDate date].timeIntervalSince1970;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark - FramebufferDescriptor implementation
|
||||||
|
|
||||||
|
@implementation FramebufferDescriptor
|
||||||
|
- (instancetype)initWithRenderPassDescriptor:(MTLRenderPassDescriptor *)renderPassDescriptor
|
||||||
|
{
|
||||||
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
|
_sampleCount = renderPassDescriptor.colorAttachments[0].texture.sampleCount;
|
||||||
|
_colorPixelFormat = renderPassDescriptor.colorAttachments[0].texture.pixelFormat;
|
||||||
|
_depthPixelFormat = renderPassDescriptor.depthAttachment.texture.pixelFormat;
|
||||||
|
_stencilPixelFormat = renderPassDescriptor.stencilAttachment.texture.pixelFormat;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nonnull id)copyWithZone:(nullable NSZone *)zone
|
||||||
|
{
|
||||||
|
FramebufferDescriptor *copy = [[FramebufferDescriptor allocWithZone:zone] init];
|
||||||
|
copy.sampleCount = self.sampleCount;
|
||||||
|
copy.colorPixelFormat = self.colorPixelFormat;
|
||||||
|
copy.depthPixelFormat = self.depthPixelFormat;
|
||||||
|
copy.stencilPixelFormat = self.stencilPixelFormat;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSUInteger)hash
|
||||||
|
{
|
||||||
|
NSUInteger sc = _sampleCount & 0x3;
|
||||||
|
NSUInteger cf = _colorPixelFormat & 0x3FF;
|
||||||
|
NSUInteger df = _depthPixelFormat & 0x3FF;
|
||||||
|
NSUInteger sf = _stencilPixelFormat & 0x3FF;
|
||||||
|
NSUInteger hash = (sf << 22) | (df << 12) | (cf << 2) | sc;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isEqual:(id)object
|
||||||
|
{
|
||||||
|
FramebufferDescriptor *other = object;
|
||||||
|
if (![other isKindOfClass:[FramebufferDescriptor class]])
|
||||||
|
return NO;
|
||||||
|
return other.sampleCount == self.sampleCount &&
|
||||||
|
other.colorPixelFormat == self.colorPixelFormat &&
|
||||||
|
other.depthPixelFormat == self.depthPixelFormat &&
|
||||||
|
other.stencilPixelFormat == self.stencilPixelFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark - MetalContext implementation
|
||||||
|
|
||||||
|
@implementation MetalContext
|
||||||
|
- (instancetype)init {
|
||||||
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
|
_renderPipelineStateCache = [NSMutableDictionary dictionary];
|
||||||
|
_bufferCache = [NSMutableArray array];
|
||||||
|
_lastBufferCachePurge = [NSDate date].timeIntervalSince1970;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)makeDeviceObjectsWithDevice:(id<MTLDevice>)device
|
||||||
|
{
|
||||||
|
MTLDepthStencilDescriptor *depthStencilDescriptor = [[MTLDepthStencilDescriptor alloc] init];
|
||||||
|
depthStencilDescriptor.depthWriteEnabled = NO;
|
||||||
|
depthStencilDescriptor.depthCompareFunction = MTLCompareFunctionAlways;
|
||||||
|
self.depthStencilState = [device newDepthStencilStateWithDescriptor:depthStencilDescriptor];
|
||||||
|
}
|
||||||
|
|
||||||
|
// We are retrieving and uploading the font atlas as a 4-channels RGBA texture here.
|
||||||
|
// In theory we could call GetTexDataAsAlpha8() and upload a 1-channel texture to save on memory access bandwidth.
|
||||||
|
// However, using a shader designed for 1-channel texture would make it less obvious to use the ImTextureID facility to render users own textures.
|
||||||
|
// You can make that change in your implementation.
|
||||||
|
- (void)makeFontTextureWithDevice:(id<MTLDevice>)device
|
||||||
|
{
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
unsigned char* pixels;
|
||||||
|
int width, height;
|
||||||
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
||||||
|
MTLTextureDescriptor *textureDescriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA8Unorm
|
||||||
|
width:width
|
||||||
|
height:height
|
||||||
|
mipmapped:NO];
|
||||||
|
textureDescriptor.usage = MTLTextureUsageShaderRead;
|
||||||
|
#if TARGET_OS_OSX
|
||||||
|
textureDescriptor.storageMode = MTLStorageModeManaged;
|
||||||
|
#else
|
||||||
|
textureDescriptor.storageMode = MTLStorageModeShared;
|
||||||
|
#endif
|
||||||
|
id <MTLTexture> texture = [device newTextureWithDescriptor:textureDescriptor];
|
||||||
|
[texture replaceRegion:MTLRegionMake2D(0, 0, width, height) mipmapLevel:0 withBytes:pixels bytesPerRow:width * 4];
|
||||||
|
self.fontTexture = texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (MetalBuffer *)dequeueReusableBufferOfLength:(NSUInteger)length device:(id<MTLDevice>)device
|
||||||
|
{
|
||||||
|
NSTimeInterval now = [NSDate date].timeIntervalSince1970;
|
||||||
|
|
||||||
|
// Purge old buffers that haven't been useful for a while
|
||||||
|
if (now - self.lastBufferCachePurge > 1.0)
|
||||||
|
{
|
||||||
|
NSMutableArray *survivors = [NSMutableArray array];
|
||||||
|
for (MetalBuffer *candidate in self.bufferCache)
|
||||||
|
{
|
||||||
|
if (candidate.lastReuseTime > self.lastBufferCachePurge)
|
||||||
|
{
|
||||||
|
[survivors addObject:candidate];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.bufferCache = [survivors mutableCopy];
|
||||||
|
self.lastBufferCachePurge = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if we have a buffer we can reuse
|
||||||
|
MetalBuffer *bestCandidate = nil;
|
||||||
|
for (MetalBuffer *candidate in self.bufferCache)
|
||||||
|
if (candidate.buffer.length >= length && (bestCandidate == nil || bestCandidate.lastReuseTime > candidate.lastReuseTime))
|
||||||
|
bestCandidate = candidate;
|
||||||
|
|
||||||
|
if (bestCandidate != nil)
|
||||||
|
{
|
||||||
|
[self.bufferCache removeObject:bestCandidate];
|
||||||
|
bestCandidate.lastReuseTime = now;
|
||||||
|
return bestCandidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No luck; make a new buffer
|
||||||
|
id<MTLBuffer> backing = [device newBufferWithLength:length options:MTLResourceStorageModeShared];
|
||||||
|
return [[MetalBuffer alloc] initWithBuffer:backing];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)enqueueReusableBuffer:(MetalBuffer *)buffer
|
||||||
|
{
|
||||||
|
[self.bufferCache addObject:buffer];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (_Nullable id<MTLRenderPipelineState>)renderPipelineStateForFrameAndDevice:(id<MTLDevice>)device
|
||||||
|
{
|
||||||
|
// Try to retrieve a render pipeline state that is compatible with the framebuffer config for this frame
|
||||||
|
// Thie hit rate for this cache should be very near 100%.
|
||||||
|
id<MTLRenderPipelineState> renderPipelineState = self.renderPipelineStateCache[self.framebufferDescriptor];
|
||||||
|
|
||||||
|
if (renderPipelineState == nil)
|
||||||
|
{
|
||||||
|
// No luck; make a new render pipeline state
|
||||||
|
renderPipelineState = [self _renderPipelineStateForFramebufferDescriptor:self.framebufferDescriptor device:device];
|
||||||
|
// Cache render pipeline state for later reuse
|
||||||
|
self.renderPipelineStateCache[self.framebufferDescriptor] = renderPipelineState;
|
||||||
|
}
|
||||||
|
|
||||||
|
return renderPipelineState;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id<MTLRenderPipelineState>)_renderPipelineStateForFramebufferDescriptor:(FramebufferDescriptor *)descriptor device:(id<MTLDevice>)device
|
||||||
|
{
|
||||||
|
NSError *error = nil;
|
||||||
|
|
||||||
|
NSString *shaderSource = @""
|
||||||
|
"#include <metal_stdlib>\n"
|
||||||
|
"using namespace metal;\n"
|
||||||
|
"\n"
|
||||||
|
"struct Uniforms {\n"
|
||||||
|
" float4x4 projectionMatrix;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"struct VertexIn {\n"
|
||||||
|
" float2 position [[attribute(0)]];\n"
|
||||||
|
" float2 texCoords [[attribute(1)]];\n"
|
||||||
|
" uchar4 color [[attribute(2)]];\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"struct VertexOut {\n"
|
||||||
|
" float4 position [[position]];\n"
|
||||||
|
" float2 texCoords;\n"
|
||||||
|
" float4 color;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"vertex VertexOut vertex_main(VertexIn in [[stage_in]],\n"
|
||||||
|
" constant Uniforms &uniforms [[buffer(1)]]) {\n"
|
||||||
|
" VertexOut out;\n"
|
||||||
|
" out.position = uniforms.projectionMatrix * float4(in.position, 0, 1);\n"
|
||||||
|
" out.texCoords = in.texCoords;\n"
|
||||||
|
" out.color = float4(in.color) / float4(255.0);\n"
|
||||||
|
" return out;\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"fragment half4 fragment_main(VertexOut in [[stage_in]],\n"
|
||||||
|
" texture2d<half, access::sample> texture [[texture(0)]]) {\n"
|
||||||
|
" constexpr sampler linearSampler(coord::normalized, min_filter::linear, mag_filter::linear, mip_filter::linear);\n"
|
||||||
|
" half4 texColor = texture.sample(linearSampler, in.texCoords);\n"
|
||||||
|
" return half4(in.color) * texColor;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
id<MTLLibrary> library = [device newLibraryWithSource:shaderSource options:nil error:&error];
|
||||||
|
if (library == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"Error: failed to create Metal library: %@", error);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
id<MTLFunction> vertexFunction = [library newFunctionWithName:@"vertex_main"];
|
||||||
|
id<MTLFunction> fragmentFunction = [library newFunctionWithName:@"fragment_main"];
|
||||||
|
|
||||||
|
if (vertexFunction == nil || fragmentFunction == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"Error: failed to find Metal shader functions in library: %@", error);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
MTLVertexDescriptor *vertexDescriptor = [MTLVertexDescriptor vertexDescriptor];
|
||||||
|
vertexDescriptor.attributes[0].offset = IM_OFFSETOF(ImDrawVert, pos);
|
||||||
|
vertexDescriptor.attributes[0].format = MTLVertexFormatFloat2; // position
|
||||||
|
vertexDescriptor.attributes[0].bufferIndex = 0;
|
||||||
|
vertexDescriptor.attributes[1].offset = IM_OFFSETOF(ImDrawVert, uv);
|
||||||
|
vertexDescriptor.attributes[1].format = MTLVertexFormatFloat2; // texCoords
|
||||||
|
vertexDescriptor.attributes[1].bufferIndex = 0;
|
||||||
|
vertexDescriptor.attributes[2].offset = IM_OFFSETOF(ImDrawVert, col);
|
||||||
|
vertexDescriptor.attributes[2].format = MTLVertexFormatUChar4; // color
|
||||||
|
vertexDescriptor.attributes[2].bufferIndex = 0;
|
||||||
|
vertexDescriptor.layouts[0].stepRate = 1;
|
||||||
|
vertexDescriptor.layouts[0].stepFunction = MTLVertexStepFunctionPerVertex;
|
||||||
|
vertexDescriptor.layouts[0].stride = sizeof(ImDrawVert);
|
||||||
|
|
||||||
|
MTLRenderPipelineDescriptor *pipelineDescriptor = [[MTLRenderPipelineDescriptor alloc] init];
|
||||||
|
pipelineDescriptor.vertexFunction = vertexFunction;
|
||||||
|
pipelineDescriptor.fragmentFunction = fragmentFunction;
|
||||||
|
pipelineDescriptor.vertexDescriptor = vertexDescriptor;
|
||||||
|
pipelineDescriptor.sampleCount = self.framebufferDescriptor.sampleCount;
|
||||||
|
pipelineDescriptor.colorAttachments[0].pixelFormat = self.framebufferDescriptor.colorPixelFormat;
|
||||||
|
pipelineDescriptor.colorAttachments[0].blendingEnabled = YES;
|
||||||
|
pipelineDescriptor.colorAttachments[0].rgbBlendOperation = MTLBlendOperationAdd;
|
||||||
|
pipelineDescriptor.colorAttachments[0].alphaBlendOperation = MTLBlendOperationAdd;
|
||||||
|
pipelineDescriptor.colorAttachments[0].sourceRGBBlendFactor = MTLBlendFactorSourceAlpha;
|
||||||
|
pipelineDescriptor.colorAttachments[0].sourceAlphaBlendFactor = MTLBlendFactorSourceAlpha;
|
||||||
|
pipelineDescriptor.colorAttachments[0].destinationRGBBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
|
||||||
|
pipelineDescriptor.colorAttachments[0].destinationAlphaBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
|
||||||
|
pipelineDescriptor.depthAttachmentPixelFormat = self.framebufferDescriptor.depthPixelFormat;
|
||||||
|
pipelineDescriptor.stencilAttachmentPixelFormat = self.framebufferDescriptor.stencilPixelFormat;
|
||||||
|
|
||||||
|
id<MTLRenderPipelineState> renderPipelineState = [device newRenderPipelineStateWithDescriptor:pipelineDescriptor error:&error];
|
||||||
|
if (error != nil)
|
||||||
|
{
|
||||||
|
NSLog(@"Error: failed to create Metal pipeline state: %@", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return renderPipelineState;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)emptyRenderPipelineStateCache
|
||||||
|
{
|
||||||
|
[self.renderPipelineStateCache removeAllObjects];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)renderDrawData:(ImDrawData *)drawData
|
||||||
|
commandBuffer:(id<MTLCommandBuffer>)commandBuffer
|
||||||
|
commandEncoder:(id<MTLRenderCommandEncoder>)commandEncoder
|
||||||
|
{
|
||||||
|
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
int fb_width = (int)(drawData->DisplaySize.x * io.DisplayFramebufferScale.x);
|
||||||
|
int fb_height = (int)(drawData->DisplaySize.y * io.DisplayFramebufferScale.y);
|
||||||
|
if (fb_width <= 0 || fb_height <= 0 || drawData->CmdListsCount == 0)
|
||||||
|
return;
|
||||||
|
drawData->ScaleClipRects(io.DisplayFramebufferScale);
|
||||||
|
|
||||||
|
[commandEncoder setCullMode:MTLCullModeNone];
|
||||||
|
[commandEncoder setDepthStencilState:g_sharedMetalContext.depthStencilState];
|
||||||
|
|
||||||
|
// Setup viewport, orthographic projection matrix
|
||||||
|
// Our visible imgui space lies from draw_data->DisplayPps (top left) to
|
||||||
|
// draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
||||||
|
MTLViewport viewport =
|
||||||
|
{
|
||||||
|
.originX = 0.0,
|
||||||
|
.originY = 0.0,
|
||||||
|
.width = double(fb_width),
|
||||||
|
.height = double(fb_height),
|
||||||
|
.znear = 0.0,
|
||||||
|
.zfar = 1.0
|
||||||
|
};
|
||||||
|
[commandEncoder setViewport:viewport];
|
||||||
|
float L = drawData->DisplayPos.x;
|
||||||
|
float R = drawData->DisplayPos.x + drawData->DisplaySize.x;
|
||||||
|
float T = drawData->DisplayPos.y;
|
||||||
|
float B = drawData->DisplayPos.y + drawData->DisplaySize.y;
|
||||||
|
float N = viewport.znear;
|
||||||
|
float F = viewport.zfar;
|
||||||
|
const float ortho_projection[4][4] =
|
||||||
|
{
|
||||||
|
{ 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
|
||||||
|
{ 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
|
||||||
|
{ 0.0f, 0.0f, 1/(F-N), 0.0f },
|
||||||
|
{ (R+L)/(L-R), (T+B)/(B-T), N/(F-N), 1.0f },
|
||||||
|
};
|
||||||
|
|
||||||
|
[commandEncoder setVertexBytes:&ortho_projection length:sizeof(ortho_projection) atIndex:1];
|
||||||
|
|
||||||
|
size_t vertexBufferLength = 0;
|
||||||
|
size_t indexBufferLength = 0;
|
||||||
|
for (int n = 0; n < drawData->CmdListsCount; n++)
|
||||||
|
{
|
||||||
|
const ImDrawList* cmd_list = drawData->CmdLists[n];
|
||||||
|
vertexBufferLength += cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
|
||||||
|
indexBufferLength += cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
MetalBuffer *vertexBuffer = [self dequeueReusableBufferOfLength:vertexBufferLength device:commandBuffer.device];
|
||||||
|
MetalBuffer *indexBuffer = [self dequeueReusableBufferOfLength:indexBufferLength device:commandBuffer.device];
|
||||||
|
|
||||||
|
id<MTLRenderPipelineState> renderPipelineState = [self renderPipelineStateForFrameAndDevice:commandBuffer.device];
|
||||||
|
[commandEncoder setRenderPipelineState:renderPipelineState];
|
||||||
|
|
||||||
|
[commandEncoder setVertexBuffer:vertexBuffer.buffer offset:0 atIndex:0];
|
||||||
|
|
||||||
|
size_t vertexBufferOffset = 0;
|
||||||
|
size_t indexBufferOffset = 0;
|
||||||
|
ImVec2 pos = drawData->DisplayPos;
|
||||||
|
for (int n = 0; n < drawData->CmdListsCount; n++)
|
||||||
|
{
|
||||||
|
const ImDrawList* cmd_list = drawData->CmdLists[n];
|
||||||
|
ImDrawIdx idx_buffer_offset = 0;
|
||||||
|
|
||||||
|
memcpy((char *)vertexBuffer.buffer.contents + vertexBufferOffset, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
||||||
|
memcpy((char *)indexBuffer.buffer.contents + indexBufferOffset, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
|
||||||
|
|
||||||
|
[commandEncoder setVertexBufferOffset:vertexBufferOffset atIndex:0];
|
||||||
|
|
||||||
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
|
if (pcmd->UserCallback)
|
||||||
|
{
|
||||||
|
// User callback (registered via ImDrawList::AddCallback)
|
||||||
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImVec4 clip_rect = ImVec4(pcmd->ClipRect.x - pos.x, pcmd->ClipRect.y - pos.y, pcmd->ClipRect.z - pos.x, pcmd->ClipRect.w - pos.y);
|
||||||
|
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||||
|
{
|
||||||
|
// Apply scissor/clipping rectangle
|
||||||
|
MTLScissorRect scissorRect = { .x = NSUInteger(clip_rect.x),
|
||||||
|
.y = NSUInteger(clip_rect.y),
|
||||||
|
.width = NSUInteger(clip_rect.z - clip_rect.x),
|
||||||
|
.height = NSUInteger(clip_rect.w - clip_rect.y) };
|
||||||
|
[commandEncoder setScissorRect:scissorRect];
|
||||||
|
|
||||||
|
|
||||||
|
// Bind texture, Draw
|
||||||
|
if (pcmd->TextureId != NULL)
|
||||||
|
[commandEncoder setFragmentTexture:(__bridge id<MTLTexture>)(pcmd->TextureId) atIndex:0];
|
||||||
|
[commandEncoder drawIndexedPrimitives:MTLPrimitiveTypeTriangle
|
||||||
|
indexCount:pcmd->ElemCount
|
||||||
|
indexType:sizeof(ImDrawIdx) == 2 ? MTLIndexTypeUInt16 : MTLIndexTypeUInt32
|
||||||
|
indexBuffer:indexBuffer.buffer
|
||||||
|
indexBufferOffset:indexBufferOffset + idx_buffer_offset];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idx_buffer_offset += pcmd->ElemCount * sizeof(ImDrawIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
vertexBufferOffset += cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
|
||||||
|
indexBufferOffset += cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak id weakSelf = self;
|
||||||
|
[commandBuffer addCompletedHandler:^(id<MTLCommandBuffer>)
|
||||||
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[weakSelf enqueueReusableBuffer:vertexBuffer];
|
||||||
|
[weakSelf enqueueReusableBuffer:indexBuffer];
|
||||||
|
});
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@ -4,6 +4,10 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
||||||
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
|
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
|
||||||
@ -14,6 +18,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (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-08-03: OpenGL: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_opengl2.cpp/.h away from the old combined GLFW/SDL+OpenGL2 examples.
|
// 2018-06-08: Misc: Extracted imgui_impl_opengl2.cpp/.h away from the old combined GLFW/SDL+OpenGL2 examples.
|
||||||
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplGlfwGL2_RenderDrawData() in the .h file so you can call it yourself.
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplGlfwGL2_RenderDrawData() in the .h file so you can call it yourself.
|
||||||
@ -23,6 +28,11 @@
|
|||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_opengl2.h"
|
#include "imgui_impl_opengl2.h"
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||||
|
#include <stddef.h> // intptr_t
|
||||||
|
#else
|
||||||
|
#include <stdint.h> // intptr_t
|
||||||
|
#endif
|
||||||
|
|
||||||
// Include OpenGL header (without an OpenGL loader) requires a bit of fiddling
|
// Include OpenGL header (without an OpenGL loader) requires a bit of fiddling
|
||||||
#if defined(_WIN32) && !defined(APIENTRY)
|
#if defined(_WIN32) && !defined(APIENTRY)
|
||||||
@ -81,6 +91,8 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glDisable(GL_COLOR_MATERIAL);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
@ -170,7 +182,7 @@ bool ImGui_ImplOpenGL2_CreateFontsTexture()
|
|||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
|
||||||
|
|
||||||
// Restore state
|
// Restore state
|
||||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
||||||
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
|
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
// ImGui Renderer for: OpenGL3 (modern OpenGL with shaders / programmatic pipeline)
|
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// CHANGELOG
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
// CHANGELOG
|
||||||
// (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-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used.
|
||||||
|
// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
|
||||||
|
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
||||||
|
// 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
|
// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
|
||||||
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||||
// 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state.
|
// 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state.
|
||||||
@ -21,19 +29,69 @@
|
|||||||
// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
|
// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
|
||||||
// 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
|
// 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
|
||||||
|
|
||||||
|
//----------------------------------------
|
||||||
|
// OpenGL GLSL GLSL
|
||||||
|
// version version string
|
||||||
|
//----------------------------------------
|
||||||
|
// 2.0 110 "#version 110"
|
||||||
|
// 2.1 120
|
||||||
|
// 3.0 130
|
||||||
|
// 3.1 140
|
||||||
|
// 3.2 150 "#version 150"
|
||||||
|
// 3.3 330
|
||||||
|
// 4.0 400
|
||||||
|
// 4.1 410 "#version 410 core"
|
||||||
|
// 4.2 420
|
||||||
|
// 4.3 430
|
||||||
|
// ES 2.0 100 "#version 100"
|
||||||
|
// ES 3.0 300 "#version 300 es"
|
||||||
|
//----------------------------------------
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
|
#include <stdio.h>
|
||||||
//#include <glew.h>
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||||
|
#include <stddef.h> // intptr_t
|
||||||
|
#else
|
||||||
|
#include <stdint.h> // intptr_t
|
||||||
|
#endif
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include "TargetConditionals.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// iOS, Android and Emscripten can use GL ES 3
|
||||||
|
// Call ImGui_ImplOpenGL3_Init() with "#version 300 es"
|
||||||
|
#if (defined(__APPLE__) && TARGET_OS_IOS) || (defined(__ANDROID__)) || (defined(__EMSCRIPTEN__))
|
||||||
|
#define USE_GL_ES3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_GL_ES3
|
||||||
|
// OpenGL ES 3
|
||||||
|
#include <GLES3/gl3.h> // Use GL ES 3
|
||||||
|
#else
|
||||||
|
// Regular OpenGL
|
||||||
|
// About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual function pointers to be loaded manually.
|
||||||
|
// Helper libraries are often used for this purpose! Here we are supporting a few common ones: gl3w, glew, glad.
|
||||||
|
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
|
||||||
|
#include <GL/gl3w.h>
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
|
||||||
|
#include <GL/glew.h>
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
|
#include <glad/glad.h>
|
||||||
|
#else
|
||||||
|
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// OpenGL Data
|
// OpenGL Data
|
||||||
static char g_GlslVersion[32] = "#version 150";
|
static char g_GlslVersionString[32] = "";
|
||||||
static GLuint g_FontTexture = 0;
|
static GLuint g_FontTexture = 0;
|
||||||
static int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
static GLuint g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
||||||
static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0;
|
static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0;
|
||||||
static int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0;
|
static int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0;
|
||||||
static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
|
static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
|
||||||
@ -42,11 +100,16 @@ static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
|
|||||||
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||||
{
|
{
|
||||||
// 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.
|
// 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.
|
||||||
|
#ifdef USE_GL_ES3
|
||||||
if (glsl_version == NULL)
|
if (glsl_version == NULL)
|
||||||
glsl_version = "#version 150";
|
glsl_version = "#version 300 es";
|
||||||
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersion));
|
#else
|
||||||
strcpy(g_GlslVersion, glsl_version);
|
if (glsl_version == NULL)
|
||||||
strcat(g_GlslVersion, "\n");
|
glsl_version = "#version 130";
|
||||||
|
#endif
|
||||||
|
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString));
|
||||||
|
strcpy(g_GlslVersionString, glsl_version);
|
||||||
|
strcat(g_GlslVersionString, "\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +126,7 @@ void ImGui_ImplOpenGL3_NewFrame()
|
|||||||
|
|
||||||
// OpenGL3 Render function.
|
// OpenGL3 Render function.
|
||||||
// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
|
// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
|
||||||
// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly, in order to be able to run within any OpenGL engine that doesn't do so.
|
// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly, in order to be able to run within any OpenGL engine that doesn't do so.
|
||||||
void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
||||||
{
|
{
|
||||||
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||||
@ -79,10 +142,14 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
||||||
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
|
#ifdef GL_SAMPLER_BINDING
|
||||||
GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
|
GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
|
||||||
|
#endif
|
||||||
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_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||||
|
#ifdef GL_POLYGON_MODE
|
||||||
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||||
|
#endif
|
||||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||||
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||||
GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb);
|
GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb);
|
||||||
@ -103,7 +170,9 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
#ifdef GL_POLYGON_MODE
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Setup viewport, orthographic projection matrix
|
// Setup viewport, orthographic projection matrix
|
||||||
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
||||||
@ -122,9 +191,10 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
glUseProgram(g_ShaderHandle);
|
glUseProgram(g_ShaderHandle);
|
||||||
glUniform1i(g_AttribLocationTex, 0);
|
glUniform1i(g_AttribLocationTex, 0);
|
||||||
glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||||
if (glBindSampler) glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
#ifdef GL_SAMPLER_BINDING
|
||||||
|
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
||||||
// Recreate the VAO every time
|
#endif
|
||||||
|
// Recreate the VAO every time
|
||||||
// (This is to easily allow multiple GL contexts. VAO are not shared among GL contexts, and we don't track creation/deletion of windows so we don't have an obvious key to use to cache them.)
|
// (This is to easily allow multiple GL contexts. VAO are not shared among GL contexts, and we don't track creation/deletion of windows so we don't have an obvious key to use to cache them.)
|
||||||
GLuint vao_handle = 0;
|
GLuint vao_handle = 0;
|
||||||
glGenVertexArrays(1, &vao_handle);
|
glGenVertexArrays(1, &vao_handle);
|
||||||
@ -179,7 +249,9 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
// Restore modified GL state
|
// Restore modified GL state
|
||||||
glUseProgram(last_program);
|
glUseProgram(last_program);
|
||||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
if (glBindSampler) glBindSampler(0, last_sampler);
|
#ifdef GL_SAMPLER_BINDING
|
||||||
|
glBindSampler(0, last_sampler);
|
||||||
|
#endif
|
||||||
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);
|
||||||
@ -189,7 +261,9 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
|
if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
|
||||||
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
||||||
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
||||||
|
#ifdef GL_POLYGON_MODE
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
|
glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
|
||||||
|
#endif
|
||||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||||
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||||
}
|
}
|
||||||
@ -213,7 +287,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture()
|
|||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
|
||||||
|
|
||||||
// Restore state
|
// Restore state
|
||||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
@ -232,6 +306,42 @@ void ImGui_ImplOpenGL3_DestroyFontsTexture()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If you get an error please report on github. You may try different GL context version or GLSL version.
|
||||||
|
static bool CheckShader(GLuint handle, const char* desc)
|
||||||
|
{
|
||||||
|
GLint status = 0, log_length = 0;
|
||||||
|
glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
|
||||||
|
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
|
if (status == GL_FALSE)
|
||||||
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc);
|
||||||
|
if (log_length > 0)
|
||||||
|
{
|
||||||
|
ImVector<char> buf;
|
||||||
|
buf.resize((int)(log_length + 1));
|
||||||
|
glGetShaderInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
||||||
|
fprintf(stderr, "%s\n", buf.begin());
|
||||||
|
}
|
||||||
|
return status == GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you get an error please report on github. You may try different GL context version or GLSL version.
|
||||||
|
static bool CheckProgram(GLuint handle, const char* desc)
|
||||||
|
{
|
||||||
|
GLint status = 0, log_length = 0;
|
||||||
|
glGetProgramiv(handle, GL_LINK_STATUS, &status);
|
||||||
|
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
|
if (status == GL_FALSE)
|
||||||
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s!\n", desc);
|
||||||
|
if (log_length > 0)
|
||||||
|
{
|
||||||
|
ImVector<char> buf;
|
||||||
|
buf.resize((int)(log_length + 1));
|
||||||
|
glGetProgramInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
||||||
|
fprintf(stderr, "%s\n", buf.begin());
|
||||||
|
}
|
||||||
|
return status == GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
||||||
{
|
{
|
||||||
// Backup GL state
|
// Backup GL state
|
||||||
@ -240,8 +350,25 @@ bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
|||||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||||
|
|
||||||
// Create shaders
|
// Parse GLSL version string
|
||||||
const GLchar *vertex_shader =
|
int glsl_version = 130;
|
||||||
|
sscanf(g_GlslVersionString, "#version %d", &glsl_version);
|
||||||
|
|
||||||
|
const GLchar* vertex_shader_glsl_120 =
|
||||||
|
"uniform mat4 ProjMtx;\n"
|
||||||
|
"attribute vec2 Position;\n"
|
||||||
|
"attribute vec2 UV;\n"
|
||||||
|
"attribute vec4 Color;\n"
|
||||||
|
"varying vec2 Frag_UV;\n"
|
||||||
|
"varying vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Frag_UV = UV;\n"
|
||||||
|
" Frag_Color = Color;\n"
|
||||||
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* vertex_shader_glsl_130 =
|
||||||
"uniform mat4 ProjMtx;\n"
|
"uniform mat4 ProjMtx;\n"
|
||||||
"in vec2 Position;\n"
|
"in vec2 Position;\n"
|
||||||
"in vec2 UV;\n"
|
"in vec2 UV;\n"
|
||||||
@ -250,34 +377,125 @@ bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
|||||||
"out vec4 Frag_Color;\n"
|
"out vec4 Frag_Color;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" Frag_UV = UV;\n"
|
" Frag_UV = UV;\n"
|
||||||
" Frag_Color = Color;\n"
|
" Frag_Color = Color;\n"
|
||||||
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const GLchar* fragment_shader =
|
const GLchar* vertex_shader_glsl_300_es =
|
||||||
|
"precision mediump float;\n"
|
||||||
|
"layout (location = 0) in vec2 Position;\n"
|
||||||
|
"layout (location = 1) in vec2 UV;\n"
|
||||||
|
"layout (location = 2) in vec4 Color;\n"
|
||||||
|
"uniform mat4 ProjMtx;\n"
|
||||||
|
"out vec2 Frag_UV;\n"
|
||||||
|
"out vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Frag_UV = UV;\n"
|
||||||
|
" Frag_Color = Color;\n"
|
||||||
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* vertex_shader_glsl_410_core =
|
||||||
|
"layout (location = 0) in vec2 Position;\n"
|
||||||
|
"layout (location = 1) in vec2 UV;\n"
|
||||||
|
"layout (location = 2) in vec4 Color;\n"
|
||||||
|
"uniform mat4 ProjMtx;\n"
|
||||||
|
"out vec2 Frag_UV;\n"
|
||||||
|
"out vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Frag_UV = UV;\n"
|
||||||
|
" Frag_Color = Color;\n"
|
||||||
|
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_glsl_120 =
|
||||||
|
"#ifdef GL_ES\n"
|
||||||
|
" precision mediump float;\n"
|
||||||
|
"#endif\n"
|
||||||
|
"uniform sampler2D Texture;\n"
|
||||||
|
"varying vec2 Frag_UV;\n"
|
||||||
|
"varying vec4 Frag_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_glsl_130 =
|
||||||
"uniform sampler2D Texture;\n"
|
"uniform sampler2D Texture;\n"
|
||||||
"in vec2 Frag_UV;\n"
|
"in vec2 Frag_UV;\n"
|
||||||
"in vec4 Frag_Color;\n"
|
"in vec4 Frag_Color;\n"
|
||||||
"out vec4 Out_Color;\n"
|
"out vec4 Out_Color;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n"
|
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const GLchar* vertex_shader_with_version[2] = { g_GlslVersion, vertex_shader };
|
const GLchar* fragment_shader_glsl_300_es =
|
||||||
const GLchar* fragment_shader_with_version[2] = { g_GlslVersion, fragment_shader };
|
"precision mediump float;\n"
|
||||||
|
"uniform sampler2D Texture;\n"
|
||||||
|
"in vec2 Frag_UV;\n"
|
||||||
|
"in vec4 Frag_Color;\n"
|
||||||
|
"layout (location = 0) out vec4 Out_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_glsl_410_core =
|
||||||
|
"in vec2 Frag_UV;\n"
|
||||||
|
"in vec4 Frag_Color;\n"
|
||||||
|
"uniform sampler2D Texture;\n"
|
||||||
|
"layout (location = 0) out vec4 Out_Color;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
// Select shaders matching our GLSL versions
|
||||||
|
const GLchar* vertex_shader = NULL;
|
||||||
|
const GLchar* fragment_shader = NULL;
|
||||||
|
if (glsl_version < 130)
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_120;
|
||||||
|
fragment_shader = fragment_shader_glsl_120;
|
||||||
|
}
|
||||||
|
else if (glsl_version == 410)
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_410_core;
|
||||||
|
fragment_shader = fragment_shader_glsl_410_core;
|
||||||
|
}
|
||||||
|
else if (glsl_version == 300)
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_300_es;
|
||||||
|
fragment_shader = fragment_shader_glsl_300_es;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vertex_shader = vertex_shader_glsl_130;
|
||||||
|
fragment_shader = fragment_shader_glsl_130;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create shaders
|
||||||
|
const GLchar* vertex_shader_with_version[2] = { g_GlslVersionString, vertex_shader };
|
||||||
|
g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
|
||||||
|
glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL);
|
||||||
|
glCompileShader(g_VertHandle);
|
||||||
|
CheckShader(g_VertHandle, "vertex shader");
|
||||||
|
|
||||||
|
const GLchar* fragment_shader_with_version[2] = { g_GlslVersionString, fragment_shader };
|
||||||
|
g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
|
glShaderSource(g_FragHandle, 2, fragment_shader_with_version, NULL);
|
||||||
|
glCompileShader(g_FragHandle);
|
||||||
|
CheckShader(g_FragHandle, "fragment shader");
|
||||||
|
|
||||||
g_ShaderHandle = glCreateProgram();
|
g_ShaderHandle = glCreateProgram();
|
||||||
g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
|
|
||||||
g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
|
||||||
glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL);
|
|
||||||
glShaderSource(g_FragHandle, 2, fragment_shader_with_version, NULL);
|
|
||||||
glCompileShader(g_VertHandle);
|
|
||||||
glCompileShader(g_FragHandle);
|
|
||||||
glAttachShader(g_ShaderHandle, g_VertHandle);
|
glAttachShader(g_ShaderHandle, g_VertHandle);
|
||||||
glAttachShader(g_ShaderHandle, g_FragHandle);
|
glAttachShader(g_ShaderHandle, g_FragHandle);
|
||||||
glLinkProgram(g_ShaderHandle);
|
glLinkProgram(g_ShaderHandle);
|
||||||
|
CheckProgram(g_ShaderHandle, "shader program");
|
||||||
|
|
||||||
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
|
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
|
||||||
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
|
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
|
||||||
@ -285,6 +503,7 @@ bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
|||||||
g_AttribLocationUV = glGetAttribLocation(g_ShaderHandle, "UV");
|
g_AttribLocationUV = glGetAttribLocation(g_ShaderHandle, "UV");
|
||||||
g_AttribLocationColor = glGetAttribLocation(g_ShaderHandle, "Color");
|
g_AttribLocationColor = glGetAttribLocation(g_ShaderHandle, "Color");
|
||||||
|
|
||||||
|
// Create buffers
|
||||||
glGenBuffers(1, &g_VboHandle);
|
glGenBuffers(1, &g_VboHandle);
|
||||||
glGenBuffers(1, &g_ElementsHandle);
|
glGenBuffers(1, &g_ElementsHandle);
|
||||||
|
|
||||||
|
@ -1,15 +1,33 @@
|
|||||||
// ImGui Renderer for: OpenGL3 (modern OpenGL with shaders / programmatic pipeline)
|
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
|
||||||
// About GLSL version:
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// The 'glsl_version' initialization parameter defaults to "#version 150" if NULL.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = "#version 150");
|
// About OpenGL function loaders:
|
||||||
|
// About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual function pointers to be loaded manually.
|
||||||
|
// Helper libraries are often used for this purpose! Here we are supporting a few common ones: gl3w, glew, glad.
|
||||||
|
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
|
||||||
|
|
||||||
|
// About GLSL version:
|
||||||
|
// The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string.
|
||||||
|
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||||
|
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||||
|
|
||||||
|
// Set default OpenGL loader to be gl3w
|
||||||
|
#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
||||||
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
||||||
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
||||||
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||||
|
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
||||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
||||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
15
examples/imgui_impl_osx.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// ImGui Platform Binding for: OSX / Cocoa
|
||||||
|
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
||||||
|
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
||||||
|
|
||||||
|
// Issues:
|
||||||
|
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
||||||
|
// [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
|
||||||
|
|
||||||
|
@class NSEvent;
|
||||||
|
@class NSView;
|
||||||
|
|
||||||
|
IMGUI_API bool ImGui_ImplOSX_Init();
|
||||||
|
IMGUI_API void ImGui_ImplOSX_Shutdown();
|
||||||
|
IMGUI_API void ImGui_ImplOSX_NewFrame(NSView *_Nonnull view);
|
||||||
|
IMGUI_API bool ImGui_ImplOSX_HandleEvent(NSEvent *_Nonnull event, NSView *_Nullable view);
|
238
examples/imgui_impl_osx.mm
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
// ImGui Platform Binding for: OSX / Cocoa
|
||||||
|
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
||||||
|
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
||||||
|
|
||||||
|
// Issues:
|
||||||
|
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
||||||
|
// [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_osx.h"
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
// CHANGELOG
|
||||||
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2018-07-07: Initial version.
|
||||||
|
|
||||||
|
// Data
|
||||||
|
static CFAbsoluteTime g_Time = 0.0;
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
bool ImGui_ImplOSX_Init()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
// Setup back-end capabilities flags
|
||||||
|
//io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||||
|
//io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||||
|
//io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional)
|
||||||
|
//io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can set io.MouseHoveredViewport correctly (optional, not easy)
|
||||||
|
|
||||||
|
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
|
||||||
|
const int offset_for_function_keys = 256 - 0xF700;
|
||||||
|
io.KeyMap[ImGuiKey_Tab] = '\t';
|
||||||
|
io.KeyMap[ImGuiKey_LeftArrow] = NSLeftArrowFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_RightArrow] = NSRightArrowFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_UpArrow] = NSUpArrowFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_DownArrow] = NSDownArrowFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_PageUp] = NSPageUpFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_PageDown] = NSPageDownFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_Home] = NSHomeFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_End] = NSEndFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_Insert] = NSInsertFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_Delete] = NSDeleteFunctionKey + offset_for_function_keys;
|
||||||
|
io.KeyMap[ImGuiKey_Backspace] = 127;
|
||||||
|
io.KeyMap[ImGuiKey_Space] = 32;
|
||||||
|
io.KeyMap[ImGuiKey_Enter] = 13;
|
||||||
|
io.KeyMap[ImGuiKey_Escape] = 27;
|
||||||
|
io.KeyMap[ImGuiKey_A] = 'A';
|
||||||
|
io.KeyMap[ImGuiKey_C] = 'C';
|
||||||
|
io.KeyMap[ImGuiKey_V] = 'V';
|
||||||
|
io.KeyMap[ImGuiKey_X] = 'X';
|
||||||
|
io.KeyMap[ImGuiKey_Y] = 'Y';
|
||||||
|
io.KeyMap[ImGuiKey_Z] = 'Z';
|
||||||
|
|
||||||
|
io.SetClipboardTextFn = [](void*, const char* str) -> void
|
||||||
|
{
|
||||||
|
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
||||||
|
[pasteboard declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil];
|
||||||
|
[pasteboard setString:[NSString stringWithUTF8String:str] forType:NSPasteboardTypeString];
|
||||||
|
};
|
||||||
|
|
||||||
|
io.GetClipboardTextFn = [](void*) -> const char*
|
||||||
|
{
|
||||||
|
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
||||||
|
NSString* available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:NSPasteboardTypeString]];
|
||||||
|
if (![available isEqualToString:NSPasteboardTypeString])
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
NSString* string = [pasteboard stringForType:NSPasteboardTypeString];
|
||||||
|
if (string == nil)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
const char* string_c = (const char*)[string UTF8String];
|
||||||
|
size_t string_len = strlen(string_c);
|
||||||
|
static ImVector<char> s_clipboard;
|
||||||
|
s_clipboard.resize((int)string_len + 1);
|
||||||
|
strcpy(s_clipboard.Data, string_c);
|
||||||
|
return s_clipboard.Data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplOSX_Shutdown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_ImplOSX_NewFrame(NSView* view)
|
||||||
|
{
|
||||||
|
// Setup display size
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
const float dpi = [view.window backingScaleFactor];
|
||||||
|
io.DisplaySize = ImVec2((float)view.bounds.size.width, (float)view.bounds.size.height);
|
||||||
|
io.DisplayFramebufferScale = ImVec2(dpi, dpi);
|
||||||
|
|
||||||
|
// Setup time step
|
||||||
|
if (g_Time == 0.0)
|
||||||
|
g_Time = CFAbsoluteTimeGetCurrent();
|
||||||
|
CFAbsoluteTime current_time = CFAbsoluteTimeGetCurrent();
|
||||||
|
io.DeltaTime = current_time - g_Time;
|
||||||
|
g_Time = current_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mapCharacterToKey(int c)
|
||||||
|
{
|
||||||
|
if (c >= 'a' && c <= 'z')
|
||||||
|
return c - 'a' + 'A';
|
||||||
|
if (c == 25) // SHIFT+TAB -> TAB
|
||||||
|
return 9;
|
||||||
|
if (c >= 0 && c < 256)
|
||||||
|
return c;
|
||||||
|
if (c >= 0xF700 && c < 0xF700 + 256)
|
||||||
|
return c - 0xF700 + 256;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void resetKeys()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
for (int n = 0; n < IM_ARRAYSIZE(io.KeysDown); n++)
|
||||||
|
io.KeysDown[n] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
if (event.type == NSEventTypeLeftMouseDown || event.type == NSEventTypeRightMouseDown || event.type == NSEventTypeOtherMouseDown)
|
||||||
|
{
|
||||||
|
int button = (int)[event buttonNumber];
|
||||||
|
if (button >= 0 && button < IM_ARRAYSIZE(io.MouseDown))
|
||||||
|
io.MouseDown[button] = true;
|
||||||
|
return io.WantCaptureMouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type == NSEventTypeLeftMouseUp || event.type == NSEventTypeRightMouseUp || event.type == NSEventTypeOtherMouseUp)
|
||||||
|
{
|
||||||
|
int button = (int)[event buttonNumber];
|
||||||
|
if (button >= 0 && button < IM_ARRAYSIZE(io.MouseDown))
|
||||||
|
io.MouseDown[button] = false;
|
||||||
|
return io.WantCaptureMouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type == NSEventTypeMouseMoved || event.type == NSEventTypeLeftMouseDragged)
|
||||||
|
{
|
||||||
|
NSPoint mousePoint = event.locationInWindow;
|
||||||
|
mousePoint = [view convertPoint:mousePoint fromView:nil];
|
||||||
|
mousePoint = NSMakePoint(mousePoint.x, view.bounds.size.height - mousePoint.y);
|
||||||
|
io.MousePos = ImVec2(mousePoint.x, mousePoint.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type == NSEventTypeScrollWheel)
|
||||||
|
{
|
||||||
|
double wheel_dx = 0.0;
|
||||||
|
double wheel_dy = 0.0;
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
|
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||||
|
{
|
||||||
|
wheel_dx = [event scrollingDeltaX];
|
||||||
|
wheel_dy = [event scrollingDeltaY];
|
||||||
|
if ([event hasPreciseScrollingDeltas])
|
||||||
|
{
|
||||||
|
wheel_dx *= 0.1;
|
||||||
|
wheel_dy *= 0.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
|
{
|
||||||
|
wheel_dx = [event deltaX];
|
||||||
|
wheel_dy = [event deltaY];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fabs(wheel_dx) > 0.0)
|
||||||
|
io.MouseWheelH += wheel_dx * 0.1f;
|
||||||
|
if (fabs(wheel_dy) > 0.0)
|
||||||
|
io.MouseWheel += wheel_dy * 0.1f;
|
||||||
|
return io.WantCaptureMouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: All the key handling is wrong and broken. Refer to GLFW's cocoa_init.mm and cocoa_window.mm.
|
||||||
|
if (event.type == NSEventTypeKeyDown)
|
||||||
|
{
|
||||||
|
NSString* str = [event characters];
|
||||||
|
int len = (int)[str length];
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
int c = [str characterAtIndex:i];
|
||||||
|
if (c < 0xF700 && !io.KeyCtrl)
|
||||||
|
io.AddInputCharacter(c);
|
||||||
|
|
||||||
|
// We must reset in case we're pressing a sequence of special keys while keeping the command pressed
|
||||||
|
int key = mapCharacterToKey(c);
|
||||||
|
if (key != -1 && key < 256 && !io.KeyCtrl)
|
||||||
|
resetKeys();
|
||||||
|
if (key != -1)
|
||||||
|
io.KeysDown[key] = true;
|
||||||
|
}
|
||||||
|
return io.WantCaptureKeyboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type == NSEventTypeKeyUp)
|
||||||
|
{
|
||||||
|
NSString* str = [event characters];
|
||||||
|
int len = (int)[str length];
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
int c = [str characterAtIndex:i];
|
||||||
|
int key = mapCharacterToKey(c);
|
||||||
|
if (key != -1)
|
||||||
|
io.KeysDown[key] = false;
|
||||||
|
}
|
||||||
|
return io.WantCaptureKeyboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type == NSEventTypeFlagsChanged)
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
unsigned int flags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
|
||||||
|
|
||||||
|
bool oldKeyCtrl = io.KeyCtrl;
|
||||||
|
bool oldKeyShift = io.KeyShift;
|
||||||
|
bool oldKeyAlt = io.KeyAlt;
|
||||||
|
bool oldKeySuper = io.KeySuper;
|
||||||
|
io.KeyCtrl = flags & NSEventModifierFlagControl;
|
||||||
|
io.KeyShift = flags & NSEventModifierFlagShift;
|
||||||
|
io.KeyAlt = flags & NSEventModifierFlagOption;
|
||||||
|
io.KeySuper = flags & NSEventModifierFlagCommand;
|
||||||
|
|
||||||
|
// We must reset them as we will not receive any keyUp event if they where pressed with a modifier
|
||||||
|
if ((oldKeyShift && !io.KeyShift) || (oldKeyCtrl && !io.KeyCtrl) || (oldKeyAlt && !io.KeyAlt) || (oldKeySuper && !io.KeySuper))
|
||||||
|
resetKeys();
|
||||||
|
return io.WantCaptureKeyboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
@ -5,16 +5,18 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
// [X] Platform: Clipboard support.
|
// [X] Platform: Clipboard support.
|
||||||
|
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
||||||
// Missing features:
|
// Missing features:
|
||||||
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (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-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||||
|
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_sdl.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples.
|
// 2018-06-08: Misc: Extracted imgui_impl_sdl.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples.
|
||||||
// 2018-06-08: Misc: ImGui_ImplSDL2_InitForOpenGL() now takes a SDL_GLContext parameter.
|
// 2018-06-08: Misc: ImGui_ImplSDL2_InitForOpenGL() now takes a SDL_GLContext parameter.
|
||||||
// 2018-05-09: Misc: Fixed clipboard paste memory leak (we didn't call SDL_FreeMemory on the data returned by SDL_GetClipboardText).
|
// 2018-05-09: Misc: Fixed clipboard paste memory leak (we didn't call SDL_FreeMemory on the data returned by SDL_GetClipboardText).
|
||||||
@ -37,7 +39,6 @@
|
|||||||
// (the multi-viewports feature requires SDL features supported from SDL 2.0.5+)
|
// (the multi-viewports feature requires SDL features supported from SDL 2.0.5+)
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
#define SDL_HAS_WARP_MOUSE_GLOBAL SDL_VERSION_ATLEAST(2,0,4)
|
|
||||||
|
|
||||||
#define SDL_HAS_CAPTURE_MOUSE SDL_VERSION_ATLEAST(2,0,4)
|
#define SDL_HAS_CAPTURE_MOUSE SDL_VERSION_ATLEAST(2,0,4)
|
||||||
#define SDL_HAS_VULKAN SDL_VERSION_ATLEAST(2,0,6)
|
#define SDL_HAS_VULKAN SDL_VERSION_ATLEAST(2,0,6)
|
||||||
@ -118,9 +119,7 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window)
|
|||||||
// Setup back-end capabilities flags
|
// Setup back-end capabilities flags
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||||
#if SDL_HAS_WARP_MOUSE_GLOBAL
|
|
||||||
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||||
#endif
|
|
||||||
|
|
||||||
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
|
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
|
||||||
io.KeyMap[ImGuiKey_Tab] = SDL_SCANCODE_TAB;
|
io.KeyMap[ImGuiKey_Tab] = SDL_SCANCODE_TAB;
|
||||||
@ -156,6 +155,7 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window)
|
|||||||
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
|
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
|
||||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
|
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
|
||||||
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
|
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_Hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SDL_SysWMinfo wmInfo;
|
SDL_SysWMinfo wmInfo;
|
||||||
@ -201,15 +201,12 @@ void ImGui_ImplSDL2_Shutdown()
|
|||||||
static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
const ImVec2 mouse_pos_backup = io.MousePos;
|
|
||||||
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
|
||||||
|
|
||||||
// Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
|
// Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
|
||||||
// (When multi-viewports are enabled, all imgui positions are same as OS positions.)
|
|
||||||
#if SDL_HAS_WARP_MOUSE_GLOBAL
|
|
||||||
if (io.WantSetMousePos)
|
if (io.WantSetMousePos)
|
||||||
SDL_WarpMouseGlobal((int)mouse_pos_backup.x, (int)mouse_pos_backup.y);
|
SDL_WarpMouseInWindow(g_Window, (int)io.MousePos.x, (int)io.MousePos.y);
|
||||||
#endif
|
else
|
||||||
|
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||||||
|
|
||||||
int mx, my;
|
int mx, my;
|
||||||
Uint32 mouse_buttons = SDL_GetMouseState(&mx, &my);
|
Uint32 mouse_buttons = SDL_GetMouseState(&mx, &my);
|
||||||
@ -218,7 +215,7 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
|||||||
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
||||||
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
||||||
|
|
||||||
#if SDL_HAS_CAPTURE_MOUSE
|
#if SDL_HAS_CAPTURE_MOUSE && !defined(__EMSCRIPTEN__)
|
||||||
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
||||||
if (g_Window == focused_window)
|
if (g_Window == focused_window)
|
||||||
{
|
{
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
// [X] Platform: Clipboard support.
|
// [X] Platform: Clipboard support.
|
||||||
|
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
||||||
// Missing features:
|
// Missing features:
|
||||||
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
struct SDL_Window;
|
struct SDL_Window;
|
||||||
|
@ -5,12 +5,15 @@
|
|||||||
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
|
// The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
|
||||||
|
// IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (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-08-25: Vulkan: Fixed mishandled VkSurfaceCapabilitiesKHR::maxImageCount=0 case.
|
||||||
// 2018-06-22: Inverted the parameters to ImGui_ImplVulkan_RenderDrawData() to be consistent with other bindings.
|
// 2018-06-22: Inverted the parameters to ImGui_ImplVulkan_RenderDrawData() to be consistent with other bindings.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_vulkan.cpp/.h away from the old combined GLFW+Vulkan example.
|
// 2018-06-08: Misc: Extracted imgui_impl_vulkan.cpp/.h away from the old combined GLFW+Vulkan example.
|
||||||
// 2018-06-08: Vulkan: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
// 2018-06-08: Vulkan: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||||
@ -165,7 +168,7 @@ static void check_vk_result(VkResult err)
|
|||||||
static void CreateOrResizeBuffer(VkBuffer& buffer, VkDeviceMemory& buffer_memory, VkDeviceSize& p_buffer_size, size_t new_size, VkBufferUsageFlagBits usage)
|
static void CreateOrResizeBuffer(VkBuffer& buffer, VkDeviceMemory& buffer_memory, VkDeviceSize& p_buffer_size, size_t new_size, VkBufferUsageFlagBits usage)
|
||||||
{
|
{
|
||||||
VkResult err;
|
VkResult err;
|
||||||
if (buffer != NULL)
|
if (buffer != VK_NULL_HANDLE)
|
||||||
vkDestroyBuffer(g_Device, buffer, g_Allocator);
|
vkDestroyBuffer(g_Device, buffer, g_Allocator);
|
||||||
if (buffer_memory)
|
if (buffer_memory)
|
||||||
vkFreeMemory(g_Device, buffer_memory, g_Allocator);
|
vkFreeMemory(g_Device, buffer_memory, g_Allocator);
|
||||||
@ -215,8 +218,8 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
|
|||||||
|
|
||||||
// Upload Vertex and index Data:
|
// Upload Vertex and index Data:
|
||||||
{
|
{
|
||||||
ImDrawVert* vtx_dst;
|
ImDrawVert* vtx_dst = NULL;
|
||||||
ImDrawIdx* idx_dst;
|
ImDrawIdx* idx_dst = NULL;
|
||||||
err = vkMapMemory(g_Device, fd->VertexBufferMemory, 0, vertex_size, 0, (void**)(&vtx_dst));
|
err = vkMapMemory(g_Device, fd->VertexBufferMemory, 0, vertex_size, 0, (void**)(&vtx_dst));
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
err = vkMapMemory(g_Device, fd->IndexBufferMemory, 0, index_size, 0, (void**)(&idx_dst));
|
err = vkMapMemory(g_Device, fd->IndexBufferMemory, 0, index_size, 0, (void**)(&idx_dst));
|
||||||
@ -462,7 +465,7 @@ bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)(intptr_t)g_FontImage;
|
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontImage;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -692,12 +695,12 @@ void ImGui_ImplVulkan_InvalidateDeviceObjects()
|
|||||||
|
|
||||||
bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass)
|
bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass)
|
||||||
{
|
{
|
||||||
IM_ASSERT(info->Instance != NULL);
|
IM_ASSERT(info->Instance != VK_NULL_HANDLE);
|
||||||
IM_ASSERT(info->PhysicalDevice != NULL);
|
IM_ASSERT(info->PhysicalDevice != VK_NULL_HANDLE);
|
||||||
IM_ASSERT(info->Device != NULL);
|
IM_ASSERT(info->Device != VK_NULL_HANDLE);
|
||||||
IM_ASSERT(info->Queue != NULL);
|
IM_ASSERT(info->Queue != VK_NULL_HANDLE);
|
||||||
IM_ASSERT(info->DescriptorPool != NULL);
|
IM_ASSERT(info->DescriptorPool != VK_NULL_HANDLE);
|
||||||
IM_ASSERT(render_pass != NULL);
|
IM_ASSERT(render_pass != VK_NULL_HANDLE);
|
||||||
|
|
||||||
g_Instance = info->Instance;
|
g_Instance = info->Instance;
|
||||||
g_PhysicalDevice = info->PhysicalDevice;
|
g_PhysicalDevice = info->PhysicalDevice;
|
||||||
@ -724,8 +727,19 @@ void ImGui_ImplVulkan_NewFrame()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// Miscellaneous Vulkan Helpers
|
// Internal / Miscellaneous Vulkan Helpers
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// You probably do NOT need to use or care about those functions.
|
||||||
|
// Those functions only exist because:
|
||||||
|
// 1) they facilitate the readability and maintenance of the multiple main.cpp examples files.
|
||||||
|
// 2) the upcoming multi-viewport feature will need them internally.
|
||||||
|
// Generally we avoid exposing any kind of superfluous high-level helpers in the bindings,
|
||||||
|
// but it is too much code to duplicate everywhere so we exceptionally expose them.
|
||||||
|
// Your application/engine will likely already have code to setup all that stuff (swap chain, render pass, frame buffers, etc.).
|
||||||
|
// You may read this code to learn about Vulkan, but it is recommended you use you own custom tailored code to do equivalent work.
|
||||||
|
// (those functions do not interact with any of the state used by the regular ImGui_ImplVulkan_XXX functions)
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <stdlib.h> // malloc
|
#include <stdlib.h> // malloc
|
||||||
@ -812,6 +826,9 @@ VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_d
|
|||||||
ImVector<VkPresentModeKHR> avail_modes;
|
ImVector<VkPresentModeKHR> avail_modes;
|
||||||
avail_modes.resize((int)avail_count);
|
avail_modes.resize((int)avail_count);
|
||||||
vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &avail_count, avail_modes.Data);
|
vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &avail_count, avail_modes.Data);
|
||||||
|
//for (uint32_t avail_i = 0; avail_i < avail_count; avail_i++)
|
||||||
|
// printf("[vulkan] avail_modes[%d] = %d\n", avail_i, avail_modes[avail_i]);
|
||||||
|
|
||||||
for (int request_i = 0; request_i < request_modes_count; request_i++)
|
for (int request_i = 0; request_i < request_modes_count; request_i++)
|
||||||
for (uint32_t avail_i = 0; avail_i < avail_count; avail_i++)
|
for (uint32_t avail_i = 0; avail_i < avail_count; avail_i++)
|
||||||
if (request_modes[request_i] == avail_modes[avail_i])
|
if (request_modes[request_i] == avail_modes[avail_i])
|
||||||
@ -822,7 +839,7 @@ VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_d
|
|||||||
|
|
||||||
void ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator)
|
void ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator)
|
||||||
{
|
{
|
||||||
IM_ASSERT(physical_device != NULL && device != NULL);
|
IM_ASSERT(physical_device != VK_NULL_HANDLE && device != VK_NULL_HANDLE);
|
||||||
(void)allocator;
|
(void)allocator;
|
||||||
|
|
||||||
// Create Command Buffers
|
// Create Command Buffers
|
||||||
@ -921,9 +938,9 @@ void ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(VkPhysicalDevice
|
|||||||
VkSurfaceCapabilitiesKHR cap;
|
VkSurfaceCapabilitiesKHR cap;
|
||||||
err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, wd->Surface, &cap);
|
err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, wd->Surface, &cap);
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
if (info.minImageCount < cap.minImageCount)
|
if (info.minImageCount < cap.minImageCount)
|
||||||
info.minImageCount = cap.minImageCount;
|
info.minImageCount = cap.minImageCount;
|
||||||
else if (info.minImageCount > cap.maxImageCount)
|
else if (cap.maxImageCount != 0 && info.minImageCount > cap.maxImageCount)
|
||||||
info.minImageCount = cap.maxImageCount;
|
info.minImageCount = cap.maxImageCount;
|
||||||
|
|
||||||
if (cap.currentExtent.width == 0xffffffff)
|
if (cap.currentExtent.width == 0xffffffff)
|
||||||
|
@ -5,14 +5,17 @@
|
|||||||
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
|
// If you are new to dear imgui, read examples/README.txt and read the 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
|
||||||
|
|
||||||
|
// The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
|
||||||
|
// IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
#define IMGUI_VK_QUEUED_FRAMES 2
|
#define IMGUI_VK_QUEUED_FRAMES 2
|
||||||
|
|
||||||
|
// Please zero-clear before use.
|
||||||
struct ImGui_ImplVulkan_InitInfo
|
struct ImGui_ImplVulkan_InitInfo
|
||||||
{
|
{
|
||||||
VkInstance Instance;
|
VkInstance Instance;
|
||||||
@ -26,24 +29,31 @@ struct ImGui_ImplVulkan_InitInfo
|
|||||||
void (*CheckVkResultFn)(VkResult err);
|
void (*CheckVkResultFn)(VkResult err);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Called by user code
|
||||||
IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass);
|
IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass);
|
||||||
IMGUI_IMPL_API void ImGui_ImplVulkan_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplVulkan_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplVulkan_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplVulkan_NewFrame();
|
||||||
IMGUI_IMPL_API void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer);
|
IMGUI_IMPL_API void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer);
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateFontUploadObjects();
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateDeviceObjects();
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer);
|
IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer);
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateFontUploadObjects();
|
||||||
|
|
||||||
|
// Called by ImGui_ImplVulkan_Init() might be useful elsewhere.
|
||||||
IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateDeviceObjects();
|
IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateDeviceObjects();
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateDeviceObjects();
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// Miscellaneous Vulkan Helpers
|
// Internal / Miscellaneous Vulkan Helpers
|
||||||
// Generally we try to NOT provide any kind of superfluous high-level helpers in the examples.
|
|
||||||
// But for the upcoming multi-viewport feature, the Vulkan will need this code anyway, so we decided to shared it and use it in the examples' main.cpp
|
|
||||||
// If your application/engine already has code to create all that data (swap chain, render pass, frame buffers, etc.) you can ignore all of this.
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// NB: Those functions do NOT use any of the state used/affected by the regular ImGui_ImplVulkan_XXX functions.
|
// You probably do NOT need to use or care about those functions.
|
||||||
|
// Those functions only exist because:
|
||||||
|
// 1) they facilitate the readability and maintenance of the multiple main.cpp examples files.
|
||||||
|
// 2) the upcoming multi-viewport feature will need them internally.
|
||||||
|
// Generally we avoid exposing any kind of superfluous high-level helpers in the bindings,
|
||||||
|
// but it is too much code to duplicate everywhere so we exceptionally expose them.
|
||||||
|
// Your application/engine will likely already have code to setup all that stuff (swap chain, render pass, frame buffers, etc.).
|
||||||
|
// You may read this code to learn about Vulkan, but it is recommended you use you own custom tailored code to do equivalent work.
|
||||||
|
// (those functions do not interact with any of the state used by the regular ImGui_ImplVulkan_XXX functions)
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ImGui_ImplVulkanH_FrameData;
|
struct ImGui_ImplVulkanH_FrameData;
|
||||||
@ -56,9 +66,10 @@ IMGUI_IMPL_API VkSurfaceFormatKHR ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhys
|
|||||||
IMGUI_IMPL_API VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count);
|
IMGUI_IMPL_API VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count);
|
||||||
IMGUI_IMPL_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKHR present_mode);
|
IMGUI_IMPL_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKHR present_mode);
|
||||||
|
|
||||||
|
// Helper structure to hold the data needed by one rendering frame
|
||||||
struct ImGui_ImplVulkanH_FrameData
|
struct ImGui_ImplVulkanH_FrameData
|
||||||
{
|
{
|
||||||
uint32_t BackbufferIndex; // keep track of recently rendered swapchain frame indices
|
uint32_t BackbufferIndex; // Keep track of recently rendered swapchain frame indices
|
||||||
VkCommandPool CommandPool;
|
VkCommandPool CommandPool;
|
||||||
VkCommandBuffer CommandBuffer;
|
VkCommandBuffer CommandBuffer;
|
||||||
VkFence Fence;
|
VkFence Fence;
|
||||||
@ -68,6 +79,7 @@ struct ImGui_ImplVulkanH_FrameData
|
|||||||
IMGUI_IMPL_API ImGui_ImplVulkanH_FrameData();
|
IMGUI_IMPL_API ImGui_ImplVulkanH_FrameData();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper structure to hold the data needed by one rendering context into one OS window
|
||||||
struct ImGui_ImplVulkanH_WindowData
|
struct ImGui_ImplVulkanH_WindowData
|
||||||
{
|
{
|
||||||
int Width;
|
int Width;
|
||||||
|