瀏覽代碼

various todos

vlod 3 年之前
父節點
當前提交
0e3b2e5bf8

+ 13 - 17
Pika/core/coreConfig/pikaConfig.h

@@ -7,8 +7,6 @@
 
 
 
-//////////////////////////////////////////
-//All macros
 //////////////////////////////////////////
 //
 //constants
@@ -20,21 +18,7 @@
 // 
 //  
 //////////////////////////////////////////
-//
-//macros
-// 
-//PIKA_API
-// 
-//////////////////////////////////////////
-// 
-// 
-//functions
-//
-// PIKA_PERMA_ASSERT
-// PIKA_DEVELOPMENT_ONLY_ASSERT
-//
-//
-//////////////////////////////////////////
+
 
 
 
@@ -48,4 +32,16 @@
 
 
 
+
+#define PIKA_REMOVE_PUSH_NOTIFICATIONS_IN_PRODUCTION 0
+
+
+#define PIKA_REMOVE_LOGS_TO_FILE_IN_PRODUCTION 0
+#define PIKA_REMOVE_LOGS_TO_NOTIFICATIONS_IN_PRODUCTION 0
+
+
+#define PIKA_REMOVE_OPTIONAL_NOVALUE_CHECKS_IN_PRODUCTION 1
+
+
+
 #include <pikaConfigInternal.h>

+ 5 - 1
Pika/core/pikaEditor/editShortcuts/editShortcuts.cpp

@@ -1,5 +1,6 @@
 #include "editShortcuts.h"
 #include <imgui.h>
+#include <pikaImgui/pikaImgui.h>
 
 void pika::EditShortcutsWindow::init()
 {
@@ -8,10 +9,11 @@ void pika::EditShortcutsWindow::init()
 void pika::EditShortcutsWindow::update(pika::ShortcutManager &shortcutManager, bool &open)
 {
 
-	//todo push pop id
 
 	ImGui::SetNextWindowSize({400, 500});
 
+	ImGui::PushID(pika::EditorImguiIds::editShortcutWindow);
+
 	if (ImGui::Begin(ICON_NAME, &open,
 		ImGuiWindowFlags_NoDocking | 
 		ImGuiWindowFlags_NoResize |
@@ -67,5 +69,7 @@ void pika::EditShortcutsWindow::update(pika::ShortcutManager &shortcutManager, b
 	}
 	ImGui::End();
 
+	ImGui::PopID();
+
 }
 

+ 2 - 6
Pika/core/pikaEditor/editor/editor.cpp

@@ -69,8 +69,8 @@ void pika::Editor::update(const pika::Input &input,
 		//ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.2f, 0.2f, 0.3f, 1.0f));
 	
 	
+		ImGui::PushID(pika::EditorImguiIds::mainEditorWindow);
 
-		//todo imgui push pop id for main window
 		if (ImGui::Begin(
 			"Main window",
 			/*p_open=*/nullptr,
@@ -78,7 +78,6 @@ void pika::Editor::update(const pika::Input &input,
 			)
 			)
 		{
-			//ImGui::PopStyleColor();
 
 
 			//if (optionsFlags.dockMainWindow)
@@ -133,13 +132,10 @@ void pika::Editor::update(const pika::Input &input,
 			}
 		#pragma endregion
 
-		}
-		else
-		{
-			//ImGui::PopStyleColor();
 		}
 		ImGui::End();
 
+		ImGui::PopID();
 
 	#pragma endregion
 

+ 50 - 2
Pika/core/pikaEditor/logs/logWindow.cpp

@@ -12,17 +12,65 @@ void pika::LogWindow::update(pika::LogManager &logManager, bool &open)
 {
 	//todo push pop id
 
+	if (!ImGui::Begin(ICON_NAME, &open))
+	{
+		ImGui::End();
+		return;
+	}
 
-	if (ImGui::Begin(ICON_NAME, &open))
+	
+	if (ImGui::BeginPopup("Options"))
 	{
+		ImGui::Checkbox("Auto-scroll", &autoScroll);
+		ImGui::EndPopup();
+	}
 
+	
+	if (ImGui::Button("Options"))
+		ImGui::OpenPopup("Options");
+	ImGui::SameLine();
+	if (ImGui::Button("Clear"))
+		{logManager.internalLogs.clear();}
+	ImGui::SameLine();
+	
+	if(ImGui::Button("Copy"))
+		{ImGui::LogToClipboard();}
+	ImGui::SameLine();
 
-		ImGui::Text("log");
+	filter.Draw("Filter", -100.0f);
 
+	ImGui::Separator();
+	ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
 
 
+	ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
+	if (filter.IsActive())
+	{
+
+		for (auto i : logManager.internalLogs)
+		{
+			if (filter.PassFilter(i.c_str()))
+				ImGui::TextUnformatted(i.c_str());
+		}
+
 	}
+	else
+	{
+		for (auto i : logManager.internalLogs)
+		{
+			ImGui::TextUnformatted(i.c_str());
+		}
+	}
+	ImGui::PopStyleVar();
+
+	if (autoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
+		ImGui::SetScrollHereY(1.0f);
+
+	ImGui::EndChild();
 	ImGui::End();
 
 
 }
+
+
+

+ 3 - 1
Pika/core/pikaEditor/logs/logWindow.h

@@ -1,6 +1,7 @@
 #pragma once
 #include <logs/log.h>
 #include <IconsForkAwesome.h>
+#include <imgui.h>
 
 namespace pika
 {
@@ -16,7 +17,8 @@ namespace pika
 		static constexpr char *ICON = ICON_FK_COMMENT_O;
 		static constexpr char *NAME = "logs";
 		static constexpr char *ICON_NAME = ICON_FK_COMMENT_O " logs";
-
+		bool autoScroll = true;
+		ImGuiTextFilter filter;
 	};
 
 }

+ 22 - 18
Pika/core/pikaRuntime/containerManager/containerManager.cpp

@@ -4,33 +4,34 @@
 #include <globalAllocator/globalAllocator.h>
 
 bool pika::ContainerManager::createContainer
-(std::string name, pika::ContainerInformation containerInformation, pika::DllLoader &dllLoader)
+(std::string name, pika::ContainerInformation containerInformation,
+	pika::DllLoader &dllLoader, pika::LogManager &logManager)
 {
 
 	if (runningContainers.find(name) != runningContainers.end())
 	{
-		//todo log error
+		logManager.log((std::string("Container name already exists: ") + name).c_str(), pika::LogManager::logError);
 		return false;
 	}
 
 
-	pika::RuntimeContainer container;
-	container.arena.allocateStaticMemory(containerInformation); //this just allocates the memory
+	pika::RuntimeContainer container = {};
+	container.arena.allocateStaticMemory(containerInformation); //this just allocates the staic memory
 
-	container.allocator.init(malloc(10000), 10000); //todo 
+	container.allocator.init(malloc(containerInformation.containerStaticInfo.defaultHeapMemorySize),
+		containerInformation.containerStaticInfo.defaultHeapMemorySize);
 
 	dllLoader.bindAllocatorDllRealm(&container.allocator);
-	 //this calls the constructors (from the dll realm)
+	
+	//this calls the constructors (from the dll realm)
 	if (!dllLoader.constructRuntimeContainer(container, containerInformation.containerName.c_str()))
 	{
 		dllLoader.resetAllocatorDllRealm();
 
+		logManager.log((std::string("Couldn't construct container: ") + name).c_str(), pika::LogManager::logError);
 
-		//todo log error
-
-		container.arena.dealocateStaticMemory();
-
-		free(container.allocator.originalBaseMemory);
+		container.arena.dealocateStaticMemory(); //static memory
+		free(container.allocator.originalBaseMemory); //heap memory
 
 		return false;
 	}
@@ -41,7 +42,6 @@ bool pika::ContainerManager::createContainer
 	container.pointer->create(); //this calls create() (from the dll realm)
 	dllLoader.resetAllocatorDllRealm();//sets the global allocator back to standard (used for runtime realm)
 
-
 	runningContainers[name] = container;
 
 	return true;
@@ -63,12 +63,14 @@ void pika::ContainerManager::update(pika::DllLoader &dllLoader, pika::Input inpu
 
 }
 
-bool pika::ContainerManager::destroyContainer(std::string name, pika::DllLoader &dllLoader)
+bool pika::ContainerManager::destroyContainer(std::string name, pika::DllLoader &dllLoader,
+	pika::LogManager &logManager)
 {
 	auto c = runningContainers.find(name);
 	if (c == runningContainers.end())
 	{
-		//todo log error
+		logManager.log((std::string("Couldn't find container for destruction: ") + name).c_str(),
+			pika::LogManager::logError);
 		return false;
 	}
 
@@ -76,17 +78,19 @@ bool pika::ContainerManager::destroyContainer(std::string name, pika::DllLoader
 	dllLoader.destructContainer_(&(c->second.pointer), &c->second.arena);
 	dllLoader.resetAllocatorDllRealm();
 
-	c->second.arena.dealocateStaticMemory();
+	c->second.arena.dealocateStaticMemory(); //static memory
+	free(c->second.allocator.originalBaseMemory); //heap memory
 
-	free(c->second.allocator.originalBaseMemory);
+	runningContainers.erase(c);
 
 	return true;
 }
 
-void pika::ContainerManager::destroyAllContainers(pika::DllLoader &dllLoader)
+void pika::ContainerManager::destroyAllContainers(pika::DllLoader &dllLoader,
+	pika::LogManager &logManager)
 {
 	for (auto &c : runningContainers)
 	{
-		destroyContainer(c.first, dllLoader);
+		destroyContainer(c.first, dllLoader, logManager);
 	}
 }

+ 5 - 3
Pika/core/pikaRuntime/containerManager/containerManager.h

@@ -21,7 +21,7 @@ namespace pika
 
 		bool createContainer(
 			std::string name, pika::ContainerInformation containerInformation,
-			pika::DllLoader &dllLoader);
+			pika::DllLoader &dllLoader, pika::LogManager &logManager);
 
 		void init();
 
@@ -31,9 +31,11 @@ namespace pika
 			float deltaTime,
 			pika::WindowState windowState);
 
-		bool destroyContainer(std::string name, pika::DllLoader &dllLoader);
+		bool destroyContainer(std::string name, pika::DllLoader &dllLoader,
+			pika::LogManager &logManager);
 
-		void destroyAllContainers(pika::DllLoader &dllLoader);
+		void destroyAllContainers(pika::DllLoader &dllLoader,
+			pika::LogManager &logManager);
 	};
 
 

+ 44 - 1
Pika/core/pikaRuntime/dllLoader/dllLoader.cpp

@@ -1,6 +1,7 @@
 #include "dllLoader.h"
 #include "pikaConfig.h"
 #include <logs/assert.h>
+#include <unordered_set>
 
 #ifdef PIKA_DEVELOPMENT
 
@@ -29,7 +30,7 @@
 		return(time);
 	}
 
-	//todo error reporting with strings
+	
 	bool pika::DllLoader::loadDll(std::filesystem::path path)
 	{
 		p = path;
@@ -151,4 +152,46 @@ void pika::DllLoader::resetAllocatorDllRealm()
 	resetAllocator_();
 }
 
+void pika::DllLoader::getContainerInfoAndCheck(std::vector<pika::ContainerInformation> &info, pika::LogManager &logs)
+{
+
+	
+	getContainersInfo_(info);
+	
+	//todo check for valid containers
+
+	std::unordered_set<std::string> uniqueNames = {};
+
+	for (int i = 0; i < info.size(); i++)
+	{
+		if (uniqueNames.find(info[i].containerName) == uniqueNames.end())
+		{
+			uniqueNames.insert(info[i].containerName);
+		}
+		else
+		{
+			std::string l = "Duplicate container name: " + info[i].containerName;
+			logs.log(l.c_str(), logs.logError);
+
+			info.erase(info.begin() + i);
+			i--;
+			continue;
+		}
+
+		if (info[i].containerStaticInfo.defaultHeapMemorySize < 100)
+		{
+			std::string l = "Too little heap memory for container: " + info[i].containerName;
+			logs.log(l.c_str(), logs.logError);
+
+			info.erase(info.begin() + i);
+			i--;
+			continue;
+		}
+
+	}
+
+
+
+}
+
 	

+ 3 - 0
Pika/core/pikaRuntime/dllLoader/dllLoader.h

@@ -8,6 +8,7 @@
 #include <baseContainer.h>
 #include <memoryArena/memoryArena.h>
 #include <runtimeContainer/runtimeContainer.h>
+#include <logs/log.h>
 
 #define GAMEPLAYSTART(x) void x(pika::PikaContext pikaContext)
 typedef GAMEPLAYSTART(gameplayStart_t);
@@ -65,6 +66,8 @@ struct DllLoader
 	void bindAllocatorDllRealm(pika::memory::FreeListAllocator *allocator);
 	void resetAllocatorDllRealm();
 
+	void getContainerInfoAndCheck(std::vector<pika::ContainerInformation> &info, pika::LogManager &logs);
+
 	void unloadDll();
 
 	//will check if the dll reloaded and reload it

+ 25 - 11
Pika/core/pikaRuntime/pikaMain.cpp

@@ -22,7 +22,6 @@
 
 #include <containerManager/containerManager.h>
 
-extern int n;
 
 int main()
 {
@@ -31,10 +30,9 @@ int main()
 	pika::initShortcutApi();
 #pragma endregion
 
-
 #pragma region log
 	pika::LogManager logs;
-	logs.init("logs.txt");
+	logs.init(pika::LogManager::DefaultLogFile);
 
 #pragma endregion
 
@@ -62,8 +60,8 @@ int main()
 
 	std::vector<pika::ContainerInformation> loadedContainers;
 	loadedContainers.reserve(100);
-	//todo validate stuff
-	dllLoader.getContainersInfo_(loadedContainers);
+	
+	dllLoader.getContainerInfoAndCheck(loadedContainers, logs);
 #pragma endregion
 
 #pragma region container manager
@@ -80,23 +78,26 @@ int main()
 #pragma endregion
 
 #pragma region editor
-	pika::Editor editor;
+	pika::Editor editor; //todo remove editor in production
 	editor.init(shortcutManager);
 
 	logs.pushNotificationManager = &editor.pushNotificationManager;
 #pragma endregion
 
 	
-	logs.log("test");
+	logs.log("test log");
 
 
 	containerManager.createContainer("Main level",
-		loadedContainers[0], dllLoader);
+		loadedContainers[0], dllLoader, logs);
 
+	containerManager.createContainer("Main level",
+		loadedContainers[0], dllLoader, logs);
 
 	while (!window.shouldClose())
 	{
 
+		//todo move this in container manager so we can check for collisions
 	#pragma region reload dll
 		if (dllLoader.reloadDll())
 		{
@@ -119,20 +120,33 @@ int main()
 
 	#pragma endregion
 
+	#pragma region container manager
 		containerManager.update(dllLoader, window.input, window.deltaTime, window.windowState);
-
+	#pragma endregion
 
 	#pragma region end imgui frame
 		pika::imguiEndFrame(window.context);
 	#pragma endregion
 
-
+	#pragma region window update
 		window.update();
+	#pragma endregion
+
+	#pragma region shortcut manager update
 		shortcutManager.update(window.input);
+	#pragma endregion
+	
+		if (window.input.buttons[pika::Button::Q].released())
+		{
+			static int i = 0;
+			i++;
+			logs.log((std::string("test log: ") + std::to_string(i)).c_str());
+		}
+
 
 	}
 
-	containerManager.destroyAllContainers(dllLoader);
+	containerManager.destroyAllContainers(dllLoader, logs);
 
 	return 0;
 }

+ 48 - 0
Pika/core/pikaSTD/compilerIntrinsics.h

@@ -0,0 +1,48 @@
+#pragma once
+
+//todo debug release configurations cmake
+
+//compiler
+//
+#ifdef _MSC_VER
+	#define PIKA_MSVC
+#endif
+
+#ifdef __GNUC__
+	#define PIKA_GCC
+#endif
+
+#ifdef __clang__
+	#define PIKA_CLANG
+#endif
+//
+
+
+//assume
+#ifdef PIKA_MSVC
+	#define PIKA_ASSUME(x) __assume((x))
+#else
+	#define PIKA_ASSUME(x)
+#endif
+
+
+
+//optimize off
+#ifdef PIKA_MSVC
+	#define PIKA_OPTIMIZE_OFF() __pragma(optimize( "", off ))
+#else
+	#define PIKA_OPTIMIZE_OFF()
+#endif
+
+
+
+//optimize on
+#ifdef PIKA_MSVC
+	#define PIKA_OPTIMIZE_ON() __pragma(optimize( "", on ))
+#else
+	#define PIKA_OPTIMIZE_ON()
+#endif
+
+
+
+

+ 3 - 3
Pika/core/pikaSTD/logs/assert.cpp

@@ -3,7 +3,7 @@
 #include <cstdlib>
 #include <cstdio>
 #include <assert.h>
-
+#include <logs/log.h>
 
 
 namespace pika
@@ -14,7 +14,7 @@ namespace pika
 
 		inline void terminate(...)
 		{
-			std::exit(1);
+			std::abort();
 			__assume(0); //optimize code after the exit
 		}
 
@@ -141,7 +141,7 @@ namespace pika
 				, comment
 			);
 
-			//todo(vlod): log to a file
+			pika::logToFile(pika::LogManager::DefaultLogFile, buffer);
 
 		}
 

+ 26 - 11
Pika/core/pikaSTD/logs/log.cpp

@@ -5,14 +5,10 @@
 
 void pika::LogManager::init(std::string name)
 {
-	if (name == "")
-	{
-		internalLogs.reserve(10);
-	}
 
 	this->name = name;
 	bool firstLog = 0;
-	//this might do some other things in the future
+	
 }
 
 void pika::LogManager::log(const char *l, int type)
@@ -25,13 +21,20 @@ void pika::LogManager::log(const char *l, int type)
 #endif
 
 #ifdef PIKA_PRODUCTION
-	logToFile(l, type); //todo enum settings flags (what to keep to logs)
+
+	#if !PIKA_REMOVE_LOGS_TO_FILE_IN_PRODUCTION
+	logToFile(l, type);
+	#endif
+
+	#if !PIKA_REMOVE_LOGS_TO_NOTIFICATIONS_IN_PRODUCTION
 	logToPushNotification(l, type);
+	#endif
+
 #endif
 
 }
 
-std::stringstream pika::LogManager::formatLog(const char *l, int type)
+std::stringstream formatLog(const char *l, int type)
 {
 	auto time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
 	std::stringstream s;
@@ -46,17 +49,20 @@ void pika::LogManager::logToFile(const char *l, int type)
 	if (!firstLog)
 	{
 		firstLog = 1;
-		std::ofstream file(name);
+		std::ofstream file(name);	//no need to check here
 		file.close(); //clear the file content
 	}
 
-	std::ofstream file(name, std::ofstream::app);
-	file << formatLog(l, type).rdbuf();
-	file.close();
+	pika::logToFile(name.c_str(), l, type);
 }
 
 void pika::LogManager::logInternally(const char *l, int type)
 {
+	if (internalLogs.size() >= maxInternalLogCount)
+	{
+		internalLogs.pop_front();
+	}
+
 	internalLogs.push_back(formatLog(l, type).str());
 }
 
@@ -68,3 +74,12 @@ void pika::LogManager::logToPushNotification(const char *l, int type)
 	}
 
 }
+
+void pika::logToFile(const char *fileName, const char *l, int type)
+{
+	std::ofstream file(fileName, std::ofstream::app);
+	if (!file.is_open()) { return; }
+
+	file << formatLog(l, type).rdbuf();
+	file.close();
+}

+ 7 - 5
Pika/core/pikaSTD/logs/log.h

@@ -1,6 +1,6 @@
 #pragma once
 #include <string>
-#include <vector>
+#include <deque>
 #include <sstream>
 #include <pushNotification/pushNotification.h>
 
@@ -11,6 +11,8 @@ namespace pika
 	struct LogManager
 	{
 
+		static constexpr const char *DefaultLogFile = "logs.txt";
+
 		//a null name will just log to a internal structure
 		void init(std::string name);
 
@@ -28,13 +30,13 @@ namespace pika
 		std::string name = "";
 		bool firstLog = 0;
 
-		std::vector<std::string> internalLogs; //todo ring buffer here
+		std::deque<std::string> internalLogs;
+		static constexpr int maxInternalLogCount = 200;
 
-		//todo flag to remove this in release build
+		
 		PushNotificationManager *pushNotificationManager = 0;
 	private:
 		//used only interally.
-		std::stringstream formatLog(const char *l, int type = logNormal);
 		void logToFile(const char *l, int type = logNormal);
 		void logInternally(const char *l, int type = logNormal);
 		void logToPushNotification(const char *l, int type = logNormal);
@@ -42,7 +44,7 @@ namespace pika
 	};
 
 
-
+	void logToFile(const char *fileName, const char *l, int type = LogManager::logNormal);
 
 
 }

+ 85 - 0
Pika/core/pikaSTD/pikaOptional.h

@@ -0,0 +1,85 @@
+#pragma once
+#include <type_traits>
+#include <pikaConfig.h>
+#include <logs/assert.h>
+
+namespace pika
+{
+
+	struct Nullopt_t
+	{
+		constexpr explicit Nullopt_t() {};
+	};
+
+	inline constexpr Nullopt_t nullopt{Nullopt_t{}};
+
+
+	template<class T>
+	struct Optional
+	{
+
+		Optional() {};
+
+		Optional(T &other)
+		{
+			data = other;
+			hasValue_ = true;
+		}
+
+		Optional(T &&other)
+		{
+			data = std::forward<T>(other);
+			hasValue_ = true;
+		}
+
+		Optional(const Nullopt_t &nullopt)
+		{
+			data = {};
+			hasValue_ = false;
+		}
+
+		Optional &operator=(const Optional &other)
+		{
+			data = other.data;
+			hasValue_ = true;
+			return *this;
+		}
+
+		Optional &operator=(const T &other)
+		{
+			data = other;
+			hasValue_ = true;
+			return *this;
+		}
+
+		Optional &operator=(const Nullopt_t &nullopt)
+		{
+			data = {};
+			hasValue_ = false;
+			return *this;
+		}
+
+		T &value()
+		{
+			
+			#if !PIKA_REMOVE_OPTIONAL_NOVALUE_CHECKS_IN_PRODUCTION || !PIKA_PRODUCTION
+				PIKA_PERMA_ASSERT(hasValue_, "Invalid value acces in optional")
+			#endif
+
+			return data;
+		}
+
+		operator T& () const
+		{
+			return value();
+		}
+
+		bool hasValue() { return hasValue_; }
+
+	private:
+		bool hasValue_ = false;
+		T data = {};
+
+	};
+
+}

+ 6 - 3
Pika/core/pikaSTD/pikaSizes.h

@@ -1,5 +1,8 @@
 #pragma once
 
-inline size_t KB(size_t x) { return x * 1024ull; }
-inline size_t MB(size_t x) { return KB(x) * 1024ull; }
-inline size_t GB(size_t x) { return MB(x) * 1024ull; }
+namespace pika
+{
+	inline size_t KB(size_t x) { return x * 1024ull; }
+	inline size_t MB(size_t x) { return KB(x) * 1024ull; }
+	inline size_t GB(size_t x) { return MB(x) * 1024ull; }
+};

+ 18 - 0
Pika/core/sharedRuntime/baseContainer.h

@@ -1,9 +1,27 @@
 #pragma once
 #include <windowSystemm/window.h>
+#include <iostream>
+#include <pikaOptional.h>
+#include <string>
+
+struct ContainerStaticInfo
+{
+
+	//this is the main allocator memory size
+	size_t defaultHeapMemorySize = 0;
+
+
+};
+
 
 struct Container
 {
 
+	//this is used to give to the engine basic information about your container.
+	//this function should be pure
+	//this function should not allocate memory
+	static ContainerStaticInfo containerInfo() {}; //todo not implemented check
+
 	virtual void create() = 0;
 
 	virtual void update(

+ 7 - 3
Pika/core/sharedRuntime/containerInformation.h

@@ -1,5 +1,6 @@
 #pragma once
 #include <string>
+#include <baseContainer.h>
 
 namespace pika
 {
@@ -9,13 +10,16 @@ struct ContainerInformation
 	ContainerInformation() {};
 	ContainerInformation(
 		size_t containerStructBaseSize,
-		const char *containerName):containerStructBaseSize(containerStructBaseSize), containerName(containerName)
+		const char *containerName,
+		const ContainerStaticInfo& containerStaticInfo):
+		containerStructBaseSize(containerStructBaseSize), containerName(containerName),
+		containerStaticInfo(containerStaticInfo)
 	{
 	};
 
-	size_t containerStructBaseSize = 0;
+	size_t containerStructBaseSize = 0; //static memory
 	std::string containerName = "";
-
+	ContainerStaticInfo containerStaticInfo = {};
 };
 
 }

+ 1 - 1
Pika/core/sharedRuntime/memoryArena/memoryArena.h

@@ -20,7 +20,7 @@ namespace memory
 		//this is used to allocate the static memory of the container (struct member data)
 		MemoryBlock containerStructMemory = {};
 
-		//todo this will request an allocator probably in the future
+		//just malloc now probably an allocator in the future?
 		void allocateStaticMemory(const ContainerInformation &containerInfo);
 		void dealocateStaticMemory();
 	};

+ 11 - 0
Pika/core/sharedRuntime/pikaImgui/pikaImgui.h

@@ -19,5 +19,16 @@ namespace pika
 	void imguiStartFrame(PikaContext pikaContext);
 	void imguiEndFrame(PikaContext pikaContext);
 
+	namespace EditorImguiIds
+	{
+		enum
+		{
+			mainEditorWindow = 100,
+			editShortcutWindow = 200,
+			
+			
+			idsCount = 4000
+		};
+	}
 
 };

+ 38 - 15
Pika/core/sharedRuntime/pushNotification/pushNotification.cpp

@@ -1,8 +1,29 @@
 #include "pushNotification.h"
 #include <imgui.h>
 #include <iostream>
+#include <pikaConfig.h>
 
 
+#ifdef PIKA_PRODUCTION and 
+#if PIKA_REMOVE_PUSH_NOTIFICATIONS_IN_PRODUCTION
+
+#define PIKA_NOT_IMPLEMENT
+
+
+void pika::PushNotificationManager::init()
+{}
+
+void pika::PushNotificationManager::update(bool &open)
+{}
+
+void pika::PushNotificationManager::pushNotification(const char *content)
+{}
+
+#endif
+#endif
+
+#ifndef PIKA_NOT_IMPLEMENT
+
 void pika::PushNotificationManager::init()
 {
 }
@@ -20,7 +41,7 @@ void pika::PushNotificationManager::update(bool &open)
 	ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoDocking
 		| ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav
 		| ImGuiWindowFlags_AlwaysAutoResize;
-	
+
 	//set popup pos
 	{
 		const float PADX = 10.0f;
@@ -37,29 +58,23 @@ void pika::PushNotificationManager::update(bool &open)
 		ImGui::SetNextWindowViewport(viewport->ID);
 		window_flags |= ImGuiWindowFlags_NoMove;
 	}
-	
-	ImGui::SetNextWindowBgAlpha(0.30f); // Transparent background
-	if (ImGui::Begin("Example: Simple overlay", &open, window_flags))
+
+	ImGui::SetNextWindowBgAlpha(0.30f);
+	if (ImGui::Begin("Notification content", &open, window_flags))
 	{
 
 		for (auto i = 0; i < notificationQue.size(); i++)
 		{
-			if (i!=0)
+			if (i != 0)
 			{
 				ImGui::Separator();
 			}
+
 			
-			//ImGui::PushID(i);
 			ImGui::Text(notificationQue[i].content.c_str(), i);
-			//ImGui::PopID();
+			
 		}
 
-		//ImGui::Text("adfgh");
-		//ImGui::Separator();
-		//ImGui::Text("adfgh");
-		//ImGui::Separator();
-		//ImGui::Text("adfgh");
-
 
 
 		if (ImGui::BeginPopupContextWindow())
@@ -74,7 +89,7 @@ void pika::PushNotificationManager::update(bool &open)
 	}
 	ImGui::End();
 
-	
+
 	while (!notificationQue.empty() && notificationQue.front().startTime +
 		std::chrono::seconds(5) < std::chrono::steady_clock::now())
 	{
@@ -87,5 +102,13 @@ void pika::PushNotificationManager::update(bool &open)
 void pika::PushNotificationManager::pushNotification(const char *content)
 {
 	notificationQue.push_back
-		(Notification(std::string(content), std::chrono::steady_clock::now()));
+	(Notification(std::string(content), std::chrono::steady_clock::now()));
 }
+
+#endif
+ 
+
+
+
+
+

+ 1 - 1
Pika/core/sharedRuntime/pushNotification/pushNotification.h

@@ -17,7 +17,7 @@ namespace pika
 		Notification() {};
 	};
 
-	//todo flag to remove this in release build
+
 	struct PushNotificationManager
 	{
 

+ 6 - 2
Pika/gameplay/containers.cpp

@@ -7,13 +7,17 @@ Container *getContainer(const char *name, pika::memory::MemoryArena *memoryArena
 
 	if (std::strcmp(name, "Gameplay") == 0)
 	{
-		PIKA_PERMA_ASSERT(sizeof(Gameplay) == memoryArena->containerStructMemory.size, "invalid memory size for static data");
+		if (sizeof(Gameplay) != memoryArena->containerStructMemory.size)
+		{
+			//"invalid memory size for static data"
+			return nullptr;
+		}
 
 		return new(memoryArena->containerStructMemory.block)  Gameplay();
 	}
 	else
 	{
-		PIKA_PERMA_ASSERT(0, (std::string("invalid container name: ") + name).c_str());
+		//"invalid container name: "
 		return nullptr;
 	}
 

+ 12 - 0
Pika/gameplay/containers/pikaGameplay.h

@@ -5,6 +5,7 @@
 #include <imgui.h>
 #include <baseContainer.h>
 #include <shortcutApi/shortcutApi.h>
+#include <pikaSizes.h>
 
 struct Test
 {
@@ -20,11 +21,22 @@ struct Gameplay : public Container
 	float *r =0;
 
 
+	static ContainerStaticInfo containerInfo()
+	{
+		ContainerStaticInfo info = {};
+		info.defaultHeapMemorySize = pika::MB(10);
+
+		return info;
+	}
+
+
 	void create()
 	{
 		renderer.create();
 		//pika::initShortcutApi();
 		r = new float(0);
+
+		//void *test = new char[pika::MB(10)]; //todo let the allocator tell the engine somehow that it is out of memory
 	}
 
 

+ 4 - 2
Pika/gameplay/dll/dllMain.cpp

@@ -13,11 +13,13 @@
 #include <memoryArena/memoryArena.h>
 #include <globalAllocator/globalAllocator.h>
 
-#define PIKA_MAKE_CONTAINER_INFO(x) pika::ContainerInformation(sizeof(x), #x)
+//todo use a global static array that can be accessed from other cpps and the macro will create an instance of a struct 
+//that will push that container
+#define PIKA_MAKE_CONTAINER_INFO(x) pika::ContainerInformation(sizeof(x), #x, x::containerInfo())
 
 PIKA_API void getContainersInfo(std::vector<pika::ContainerInformation> &info)
 {
-	info.clear();//todo reserve before or use static buffer????
+	info.clear();
 	info.push_back(PIKA_MAKE_CONTAINER_INFO(Gameplay));
 }