Skip to content

Commit

Permalink
cimplot_template: revert last changes and add include cimgui.h to cim…
Browse files Browse the repository at this point in the history
…plot.h (issue #5)
  • Loading branch information
sonoro1234 committed Mar 31, 2021
1 parent d65d6c7 commit 299d29f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
3 changes: 2 additions & 1 deletion generator/cimplot_template.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@


#include "./implot/implot.h"
#include "./implot/implot_internal.h"
#include "cimplot.h"


Expand Down
39 changes: 1 addition & 38 deletions generator/cimplot_template.h
Original file line number Diff line number Diff line change
@@ -1,44 +1,7 @@
#ifndef CIMGUIPLOT_INCLUDED
#define CIMGUIPLOT_INCLUDED
#include <stdio.h>
#include <stdint.h>
#if defined _WIN32 || defined __CYGWIN__
#ifdef CIMGUI_NO_EXPORT
#define API
#else
#define API __declspec(dllexport)
#endif
#ifndef __GNUC__
#define snprintf sprintf_s
#endif
#else
#ifdef __GNUC__
#define API __attribute__((__visibility__("default")))
#else
#define API
#endif
#endif

#if defined __cplusplus
#define EXTERN extern "C"
#else
#include <stdarg.h>
#include <stdbool.h>
#define EXTERN extern
#endif

#define CIMGUI_API EXTERN API
#define CONST const


#ifdef _MSC_VER
typedef unsigned __int64 ImU64;
#else
//typedef unsigned long long ImU64;
#endif

#include "./implot/implot.h"
#include "./implot/implot_internal.h"
#include "cimgui.h"

This comment has been minimized.

Copy link
@Gnimuc

Gnimuc Apr 1, 2021

@sonoro1234 I think we should add a new #ifdef. Types like ImVec2 are defined in both cimgui.h and imgui.h, there will be a name collision if we put the #include "cimgui.h" here.

This comment has been minimized.

Copy link
@sonoro1234

sonoro1234 Apr 1, 2021

Author Collaborator

ImVec2 in cimgui.h is only defined if CIMGUI_DEFINE_ENUMS_AND_STRUCTS is defined.
When compiling cimgui.cpp or cimplot.cpp, CIMGUI_DEFINE_ENUMS_AND_STRUCTS it is not defined so there is no duplication.
When CIMGUI_DEFINE_ENUMS_AND_STRUCTS is defined (for getting C definitions) cimgui.cpp and cimplot.cpp are not compiled so that imgui.h is not included (so there is no duplication)

Did you get any duplication warning?

This comment has been minimized.

Copy link
@Gnimuc

Gnimuc Apr 1, 2021

Oops! I missed that CIMGUI_DEFINE_ENUMS_AND_STRUCTS in "cimgui.h" and you're totally right.


#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "imgui_structs.h"
Expand Down

0 comments on commit 299d29f

Please sign in to comment.