Backends: Include imgui.h in implementation headers. (#3105)

Currently, the implementation headers don't include the imgui.h header.
Which means that the compilation will fail if the implementation header
was included before the imgui.h header in the compilation unit. For
instance, a compilation unit with the following will work:

  #include "imgui.h"
  #include "imgui_impl_glfw.h"
  #include "imgui_impl_opengl3.h"

But a compilation unit with the following will fail because IMGUI_IMPL_API
and possibly other symbols will not be defined:

  #include "imgui_impl_glfw.h"
  #include "imgui_impl_opengl3.h"
  #include "imgui.h"

This patch includes imgui.h in the implementation headers to make
inclusions order-invariant, which is a recommended practice.
This commit is contained in:
OmarEmaraDev 2020-04-06 20:23:57 +02:00 committed by omar
parent 752436219d
commit 00927105ba
15 changed files with 29 additions and 0 deletions

View File

@ -15,6 +15,8 @@
#pragma once #pragma once
#include "imgui.h"
struct ALLEGRO_DISPLAY; struct ALLEGRO_DISPLAY;
union ALLEGRO_EVENT; union ALLEGRO_EVENT;

View File

@ -11,6 +11,8 @@
#pragma once #pragma once
#include "imgui.h"
struct ID3D10Device; struct ID3D10Device;
IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device);

View File

@ -11,6 +11,8 @@
#pragma once #pragma once
#include "imgui.h"
struct ID3D11Device; struct ID3D11Device;
struct ID3D11DeviceContext; struct ID3D11DeviceContext;

View File

@ -13,6 +13,8 @@
#pragma once #pragma once
#include "imgui.h"
enum DXGI_FORMAT; enum DXGI_FORMAT;
struct ID3D12Device; struct ID3D12Device;
struct ID3D12DescriptorHeap; struct ID3D12DescriptorHeap;

View File

@ -11,6 +11,8 @@
#pragma once #pragma once
#include "imgui.h"
struct IDirect3DDevice9; struct IDirect3DDevice9;
IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device);

View File

@ -18,6 +18,8 @@
#pragma once #pragma once
#include "imgui.h"
struct GLFWwindow; struct GLFWwindow;
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);

View File

@ -17,6 +17,8 @@
#pragma once #pragma once
#include "imgui.h"
IMGUI_IMPL_API bool ImGui_ImplGLUT_Init(); IMGUI_IMPL_API bool ImGui_ImplGLUT_Init();
IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs(); IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs();
IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown(); IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown();

View File

@ -10,6 +10,8 @@
#pragma once #pragma once
#include "imgui.h"
IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks); IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks);
IMGUI_IMPL_API void ImGui_Marmalade_Shutdown(); IMGUI_IMPL_API void ImGui_Marmalade_Shutdown();
IMGUI_IMPL_API void ImGui_Marmalade_NewFrame(); IMGUI_IMPL_API void ImGui_Marmalade_NewFrame();

View File

@ -9,6 +9,8 @@
// 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 dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
// https://github.com/ocornut/imgui // https://github.com/ocornut/imgui
#include "imgui.h"
@class MTLRenderPassDescriptor; @class MTLRenderPassDescriptor;
@protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder;

View File

@ -18,6 +18,8 @@
#pragma once #pragma once
#include "imgui.h"
IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame(); IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame();

View File

@ -23,6 +23,8 @@
#pragma once #pragma once
#include "imgui.h"
// Backend API // Backend API
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); 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();

View File

@ -8,6 +8,8 @@
// Issues: // Issues:
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
#include "imgui.h"
@class NSEvent; @class NSEvent;
@class NSView; @class NSView;

View File

@ -16,6 +16,8 @@
#pragma once #pragma once
#include "imgui.h"
struct SDL_Window; struct SDL_Window;
typedef union SDL_Event SDL_Event; typedef union SDL_Event SDL_Event;

View File

@ -22,6 +22,7 @@
#pragma once #pragma once
#include "imgui.h"
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
// Initialization data, for ImGui_ImplVulkan_Init() // Initialization data, for ImGui_ImplVulkan_Init()

View File

@ -9,6 +9,8 @@
#pragma once #pragma once
#include "imgui.h"
IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();