Skip to content

Commit

Permalink
Update Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed Nov 11, 2023
1 parent 015ffff commit 866878b
Show file tree
Hide file tree
Showing 15 changed files with 881 additions and 135 deletions.
102 changes: 69 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ DESCRIPTION = Timed Petri Net Editor
STANDARD = --std=c++14
BUILD_TYPE = debug

###################################################
# Select backend for dear im gui: RayLib or GLFW3
#
BACKEND ?= RayLib
# BACKEND ?= GLFW3

###################################################
# Location of the project directory and Makefiles
#
Expand All @@ -15,20 +21,16 @@ M := $(P)/.makefile
include $(M)/Makefile.header

###################################################
# Linkage
# Inform Makefile where to find *.cpp files
#
LINKER_FLAGS += -ldl -lpthread
VPATH += $(P)/src $(P)/src/Utils $(P)/src/Net
VPATH += $(P)/src/Net/Formats $(P)/src/Renderer $(P)/include

###################################################
# Inform Makefile where to find header files
#
INCLUDES += -I$(P)/include -I$(P)/src -I$(P)/src/Net/Formats -I$(P)/src/Renderer

###################################################
# Inform Makefile where to find *.cpp and *.o files
#
VPATH += $(P)/src $(P)/src/Net $(P)/src/Net/Formats $(P)/src/Renderer $(P)/include

###################################################
# Project defines
#
Expand All @@ -41,18 +43,14 @@ CCFLAGS += -Wno-sign-conversion -Wno-float-equal
CXXFLAGS += -Wno-undef -Wno-switch-enum -Wno-enum-compare

###################################################
# Embed assets for web version. Assets shall be
# present inside $(BUILD) folder.
# Linkage
#
ifeq ($(ARCHI),Emscripten)
LINKER_FLAGS += --preload-file imgui.ini
LINKER_FLAGS += --preload-file examples
LINKER_FLAGS += -s FORCE_FILESYSTEM=1
endif
LINKER_FLAGS += -ldl -lpthread

###################################################
# Set thirdpart Raylib
#
ifeq ($(BACKEND),RayLib)
INCLUDES += -I$(THIRDPART)/raylib/src
THIRDPART_LIBS += $(abspath $(THIRDPART)/raylib/src/$(ARCHI)/libraylib.a)

Expand All @@ -68,35 +66,49 @@ LINKER_FLAGS += -s ASYNCIFY
# our own.
LINKER_FLAGS += --shell-file $(THIRDPART)/raylib/src/shell.html
endif
endif

###################################################
# Dear ImGui backends: Raylib
#
ifeq ($(BACKEND),RayLib)
VPATH += $(THIRDPART)/rlImGui
VPATH += $(P)/src/Renderer/Backends/RayLib
INCLUDES += -I$(THIRDPART)/rlImGui
INCLUDES += -I$(P)/src/Renderer/Backends/RayLib
DEARIMGUI_BACKEND_OBJS += rlImGui.o
endif

###################################################
# Dear ImGui backends: OpenGL/GLFW3
#
ifeq ($(BACKEND),GLFW3)
VPATH += $(P)/src/Renderer/Backends/GLFW3
INCLUDES += -I$(P)/src/Renderer/Backends/GLFW3
DEARIMGUI_BACKEND_OBJS += imgui_impl_glfw.o imgui_impl_opengl3.o
endif

###################################################
# Set thirdpart Dear ImGui
#
INCLUDES += -I$(THIRDPART)/imgui -I$(THIRDPART)/imgui/backends -I$(THIRDPART)/imgui/misc/cpp
VPATH += $(THIRDPART)/imgui $(THIRDPART)/imgui/backends $(THIRDPART)/imgui/misc/cpp
DEARIMGUI_OBJS += imgui_widgets.o imgui_draw.o imgui_tables.o imgui.o imgui_stdlib.o
# DEARIMGUI_OBJS += imgui_impl_glfw.o imgui_impl_opengl3.o
DEARIMGUI_OBJS += imgui_demo.o

###################################################
# Set thirdpart Dear ImGui Plot
#
INCLUDES += -I$(THIRDPART)/implot
VPATH += $(THIRDPART)/implot
INCLUDES += -I$(THIRDPART)/implot
DEARIMGUI_OBJS += implot_items.o implot.o

###################################################
# Set thirdpart file dialog
INCLUDES += -I$(THIRDPART)/ImGuiFileDialog
VPATH += $(THIRDPART)/ImGuiFileDialog
INCLUDES += -I$(THIRDPART)/ImGuiFileDialog
DEARIMGUI_OBJS += ImGuiFileDialog.o

###################################################
# Set thirdpart Raylib with Dear ImGui
#
INCLUDES += -I$(THIRDPART)/rlImGui
VPATH += $(THIRDPART)/rlImGui
DEARIMGUI_OBJS += rlImGui.o

###################################################
# Set MQTT Library.
#
Expand All @@ -120,17 +132,30 @@ LINKER_FLAGS += -framework OpenGL -framework Cocoa
LINKER_FLAGS += -framework IOKit -framework CoreVideo
LINKER_FLAGS += -L/usr/local/lib -L/opt/local/lib
LINKER_FLAGS += -lGLEW -lglfw
else ifeq ($(ARCHI),Linux)
LINKER_FLAGS += -lGL
PKG_LIBS += --static glfw3
else ifneq ($(ARCHI),Emscripten)
$(error Unknown architecture $(ARCHI) for OpenGL)
endif

###################################################
# Make the list of compiled files for the application
# Check if Dear im gui backend has been set
#
#DEARIMGUI_OBJS += imgui_demo.o
OBJS += $(DEARIMGUI_OBJS)
OBJS += Application.o PetriNet.o PetriEditor.o Howard.o Algorithms.o main.o
OBJS += ImportJSON.o ExportJSON.o ExportSymfony.o ExportPnEditor.o
OBJS += ExportPetriLaTeX.o ExportJulia.o ExportGraphviz.o ExportDrawIO.o
OBJS += ExportGrafcetCpp.o
ifeq ($(DEARIMGUI_BACKEND_OBJS),)
$(error "Define BACKEND either as RayLib or GLFW3")
endif

###################################################
# Embed assets for web version. Assets shall be
# present inside $(BUILD) folder.
#
ifeq ($(ARCHI),Emscripten)
LINKER_FLAGS += --preload-file imgui.ini
LINKER_FLAGS += --preload-file examples
LINKER_FLAGS += --preload-file data
LINKER_FLAGS += -s FORCE_FILESYSTEM=1
endif

###################################################
# MacOS X
Expand All @@ -142,6 +167,15 @@ MACOS_BUNDLE_ICON = data/TimedPetriNetEditor.icns
LINKER_FLAGS += -framework CoreFoundation
endif

###################################################
# Make the list of compiled files for the application
#
OBJS += $(DEARIMGUI_BACKEND_OBJS) $(DEARIMGUI_OBJS)
OBJS += Path.o Application.o PetriNet.o PetriEditor.o Howard.o Algorithms.o main.o
OBJS += ImportJSON.o ExportJSON.o ExportSymfony.o ExportPnEditor.o
OBJS += ExportPetriLaTeX.o ExportJulia.o ExportGraphviz.o ExportDrawIO.o
OBJS += ExportGrafcetCpp.o

###################################################
# Compile the project, the static and shared libraries
.PHONY: all
Expand All @@ -153,9 +187,11 @@ all: copy-emscripten-assets $(TARGET)
copy-emscripten-assets: | $(BUILD)
ifeq ($(ARCHI),Emscripten)
@$(call print-to,"Copying assets","$(TARGET)","$(BUILD)","")
@cp -r $(P)/data/examples $(BUILD)
@mkdir -p $(BUILD)/data
@mkdir -p $(BUILD)/examples
@cp $(P)/data/examples/*.json $(BUILD)/examples
@cp $(P)/data/font.ttf $(BUILD)/data
@cp $(P)/imgui.ini $(BUILD)
@rm -fr $(BUILD)/examples/pics
endif

###################################################
Expand Down
Binary file modified data/font.ttf
Binary file not shown.
67 changes: 27 additions & 40 deletions imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ Size=664,636
Collapsed=0

[Window][Dear ImGui Demo]
Pos=0,19
Size=780,671
Pos=0,20
Size=693,670
Collapsed=0
DockId=0x00000008,2
DockId=0x00000002,2

[Window][DockSpace]
Size=1920,1080
Collapsed=0

[Window][DockSpaceViewport_11111111]
Pos=0,19
Size=1024,749
Pos=0,20
Size=1024,748
Collapsed=0

[Window][Delete?]
Expand Down Expand Up @@ -53,44 +53,41 @@ Size=500,440
Collapsed=0

[Window][Example: Custom rendering]
Pos=1,2
Size=1920,1080
Collapsed=0
DockId=0x00000003,0

[Window][Petri net: foo bar]
Pos=0,19
Size=780,671
Pos=0,20
Size=693,670
Collapsed=0
DockId=0x00000008,0
DockId=0x00000002,0

[Window][Example: Custom Node Graph]
Size=1920,1080
Collapsed=0
DockId=0x00000003,0

[Window][Help]
Pos=505,19
Size=295,581
Collapsed=0
DockId=0x00000003,2

[Window][About]
Pos=505,19
Size=295,581
Collapsed=0
DockId=0x00000003,2

[Window][Console]
Pos=0,19
Size=780,671
Pos=0,20
Size=693,670
Collapsed=0
DockId=0x00000008,1
DockId=0x00000002,1

[Window][Message]
Pos=0,692
Size=1024,76
Collapsed=0
DockId=0x0000000E,0
DockId=0x00000004,0

[Window][Choose the Petri file to load##ChooseFileDlgKey]
Pos=62,98
Expand Down Expand Up @@ -138,22 +135,22 @@ Size=353,144
Collapsed=0

[Window][Arcs]
Pos=782,19
Size=242,671
Pos=695,20
Size=329,670
Collapsed=0
DockId=0x0000000C,2
DockId=0x00000001,2

[Window][Places]
Pos=782,19
Size=242,671
Pos=695,20
Size=329,670
Collapsed=0
DockId=0x0000000C,0
DockId=0x00000001,0

[Window][Transitions]
Pos=782,19
Size=242,671
Pos=695,20
Size=329,670
Collapsed=0
DockId=0x0000000C,1
DockId=0x00000001,1

[Table][0x5CB1E615,4]
RefScale=13
Expand Down Expand Up @@ -276,19 +273,9 @@ RefScale=13
Column 0 Sort=0v

[Docking][Data]
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=1024,749 Split=Y Selected=0x313AEB1D
DockNode ID=0x0000000D Parent=0x8B93E3BD SizeRef=1920,932 Split=X
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=838,1010 Split=Y
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=1920,935 Split=X
DockNode ID=0x00000005 Parent=0x00000007 SizeRef=1732,1010 Split=X
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=1732,1010 Split=Y
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=0,0 Split=Y Selected=0x313AEB1D
DockNode ID=0x00000008 Parent=0x00000003 SizeRef=1732,957 CentralNode=1 Selected=0xE87781F4
DockNode ID=0x00000009 Parent=0x00000003 SizeRef=1732,51 Selected=0x6B041B99
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=800,32 HiddenTabBar=1 Selected=0x6B041B99
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=186,1010 Selected=0x081FB661
DockNode ID=0x00000006 Parent=0x00000007 SizeRef=186,1010 Selected=0x081FB661
DockNode ID=0x0000000A Parent=0x0000000B SizeRef=1920,73 Selected=0x6B041B99
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=242,1010 Selected=0x6372E3B7
DockNode ID=0x0000000E Parent=0x8B93E3BD SizeRef=1920,76 Selected=0x6B041B99
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,20 Size=1024,748 Split=Y
DockNode ID=0x00000003 Parent=0x8B93E3BD SizeRef=1920,931 Split=X
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1589,1009 CentralNode=1 Selected=0x313AEB1D
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=329,1009 Selected=0x081FB661
DockNode ID=0x00000004 Parent=0x8B93E3BD SizeRef=1920,76 Selected=0x6B041B99

34 changes: 0 additions & 34 deletions src/Renderer/Application.hpp

This file was deleted.

Loading

0 comments on commit 866878b

Please sign in to comment.