浏览代码

added more pike configure flags

vlod 3 年之前
父节点
当前提交
d03c355d2e

+ 4 - 0
Pika/CMakeLists.txt

@@ -39,6 +39,10 @@ file(GLOB_RECURSE PIKA_SOURCES_CORE_STD				CONFIGURE_DEPENDS "${CMAKE_CURRENT_SO
 file(GLOB_RECURSE PIKA_SOURCES_GAMEPLAY				CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/gameplay/*.cpp")
 file(GLOB_RECURSE PIKA_SOURCES_CORE_SHARED_RUNTIME	CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/core/sharedRuntime/*.cpp")
 
+add_compile_definitions(PIKA_RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/") 
+#add_compile_definitions(PIKA_RESOURCES_PATH="./resources/")
+
+
 
 
 #pikaCore ############################################

+ 2 - 0
Pika/core/coreConfig/pikaConfig.h

@@ -42,6 +42,8 @@
 
 #define PIKA_REMOVE_OPTIONAL_NOVALUE_CHECKS_IN_PRODUCTION 1
 
+#define PIKA_REMOVE_EDITOR_IN_PRODUCATION 1
 
+#define PIKA_REMOVE_PUSH_NOTIFICATION_IN_PRODUCTION 0
 
 #include <pikaConfigInternal.h>

+ 5 - 0
Pika/core/coreConfig/pikaConfigInternal.h

@@ -1,4 +1,9 @@
 #pragma once
+//////////////////////////////////////////
+//pikaConfigInternal.h
+//Luta Vlad(c) 2022
+//https://github.com/meemknight/PikaEngine
+//////////////////////////////////////////
 
 #pragma region Platform
 

+ 11 - 8
Pika/core/pikaEditor/editor/editor.cpp

@@ -1,3 +1,9 @@
+//////////////////////////////////////////
+//editor.cpp
+//Luta Vlad(c) 2022
+//https://github.com/meemknight/PikaEngine
+//////////////////////////////////////////
+
 #include "editor.h"
 #include <iostream>
 #include "IconsForkAwesome.h"
@@ -5,8 +11,8 @@
 #include <editShortcuts/editShortcuts.h>
 
 #define DOCK_MAIN_WINDOW_SHORTCUT ICON_FK_EYE_SLASH " Hide main window"
-#define LOGS_SHORTCUT "Logs window"
-#define EDIT_SHORTCUTS "Edit shortcuts window"
+#define LOGS_SHORTCUT ICON_FK_COMMENT_O " Logs window"
+#define EDIT_SHORTCUTS ICON_FK_PENCIL_SQUARE " Edit shortcuts window"
 
 void pika::Editor::init(pika::ShortcutManager &shortcutManager)
 {
@@ -18,13 +24,13 @@ void pika::Editor::init(pika::ShortcutManager &shortcutManager)
 
 	logWindow.init();
 	editShortcutsWindow.init();
-	pushNotificationManager.init();
 }
 
 
 
 void pika::Editor::update(const pika::Input &input,
-	pika::ShortcutManager &shortcutManager, pika::LogManager &logs)
+	pika::ShortcutManager &shortcutManager, pika::LogManager &logs, 
+	pika::PushNotificationManager &pushNotificationManager)
 {
 
 #pragma region push notification if hide window
@@ -156,10 +162,7 @@ void pika::Editor::update(const pika::Input &input,
 
 #pragma endregion
 
-#pragma region push notification
-	static bool open = true;
-	pushNotificationManager.update(open);
-#pragma endregion
+
 
 
 }

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

@@ -1,4 +1,9 @@
 #pragma once
+//////////////////////////////////////////
+//editor.h
+//Luta Vlad(c) 2022
+//https://github.com/meemknight/PikaEngine
+//////////////////////////////////////////
 
 #include <pikaImgui/pikaImgui.h>
 #include <logs/logWindow.h>
@@ -16,7 +21,7 @@ namespace pika
 		void init(pika::ShortcutManager &shortcutManager);
 
 		void update(const pika::Input &input, pika::ShortcutManager &shortcutManager
-			,pika::LogManager &logs);
+			,pika::LogManager &logs, pika::PushNotificationManager &pushNotificationManager);
 
 		struct
 		{
@@ -31,7 +36,6 @@ namespace pika
 
 		pika::LogWindow logWindow;
 		pika::EditShortcutsWindow editShortcutsWindow;
-		pika::PushNotificationManager pushNotificationManager; //todo move this from editor so we can have it in the game without the editor
 	
 		bool lastHideWindowState = optionsFlags.hideMainWindow;
 	};

+ 5 - 3
Pika/core/pikaEditor/logs/logWindow.cpp

@@ -1,6 +1,7 @@
 #include "logWindow.h"
 #include <imgui.h>
 #include <IconsForkAwesome.h>
+#include <pikaImgui/pikaImgui.h>
 
 void pika::LogWindow::init()
 {
@@ -10,7 +11,7 @@ void pika::LogWindow::init()
 
 void pika::LogWindow::update(pika::LogManager &logManager, bool &open)
 {
-	//todo push pop id
+	ImGui::PushID(EditorImguiIds::logWindow);
 
 	if (!ImGui::Begin(ICON_NAME, &open))
 	{
@@ -46,11 +47,12 @@ void pika::LogWindow::update(pika::LogManager &logManager, bool &open)
 	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());
+			}
 		}
 
 	}
@@ -69,7 +71,7 @@ void pika::LogWindow::update(pika::LogManager &logManager, bool &open)
 	ImGui::EndChild();
 	ImGui::End();
 
-
+	ImGui::PopID();
 }
 
 

+ 15 - 7
Pika/core/pikaRuntime/containerManager/containerManager.cpp

@@ -7,10 +7,10 @@ bool pika::ContainerManager::createContainer
 (std::string name, pika::ContainerInformation containerInformation,
 	pika::DllLoader &dllLoader, pika::LogManager &logManager)
 {
-
+	//todo containers should have an id rather than name
 	if (runningContainers.find(name) != runningContainers.end())
 	{
-		logManager.log((std::string("Container name already exists: ") + name).c_str(), pika::LogManager::logError);
+		logManager.log((std::string("Container name already exists: ") + name).c_str(), pika::logError);
 		return false;
 	}
 
@@ -28,7 +28,7 @@ bool pika::ContainerManager::createContainer
 	{
 		dllLoader.resetAllocatorDllRealm();
 
-		logManager.log((std::string("Couldn't construct container: ") + name).c_str(), pika::LogManager::logError);
+		logManager.log((std::string("Couldn't construct container: ") + name).c_str(), pika::logError);
 
 		container.arena.dealocateStaticMemory(); //static memory
 		free(container.allocator.originalBaseMemory); //heap memory
@@ -37,9 +37,16 @@ bool pika::ContainerManager::createContainer
 	}
 	dllLoader.resetAllocatorDllRealm();
 
+
+#pragma region setup requested container info
+
+	container.requestedContainerInfo.mainAllocator = &container.allocator;
+
+#pragma endregion
+
 	
 	dllLoader.bindAllocatorDllRealm(&container.allocator);
-	container.pointer->create(); //this calls create() (from the dll realm)
+	container.pointer->create(container.requestedContainerInfo); //this calls create() (from the dll realm)
 	dllLoader.resetAllocatorDllRealm();//sets the global allocator back to standard (used for runtime realm)
 
 	runningContainers[name] = container;
@@ -51,12 +58,13 @@ void pika::ContainerManager::init()
 {
 }
 
-void pika::ContainerManager::update(pika::DllLoader &dllLoader, pika::Input input, float deltaTime, pika::WindowState windowState)
+void pika::ContainerManager::update(pika::DllLoader &dllLoader,
+	pika::Input input, float deltaTime, pika::WindowState windowState)
 {
 	for (auto &c : runningContainers)
 	{
 		dllLoader.bindAllocatorDllRealm(&c.second.allocator);
-		c.second.pointer->update(input, deltaTime, windowState);
+		c.second.pointer->update(input, deltaTime, windowState, c.second.requestedContainerInfo);
 		dllLoader.resetAllocatorDllRealm();
 
 	}
@@ -70,7 +78,7 @@ bool pika::ContainerManager::destroyContainer(std::string name, pika::DllLoader
 	if (c == runningContainers.end())
 	{
 		logManager.log((std::string("Couldn't find container for destruction: ") + name).c_str(),
-			pika::LogManager::logError);
+			pika::logError);
 		return false;
 	}
 

+ 17 - 11
Pika/core/pikaRuntime/dllLoader/dllLoader.cpp

@@ -103,7 +103,7 @@
 	}
 	
 	#else
-	#error "pika load dll works only on windows."
+	#error "pika load dll works only on windows, change configuration to pikaProduction"
 	#endif
 
 
@@ -155,7 +155,6 @@ void pika::DllLoader::resetAllocatorDllRealm()
 void pika::DllLoader::getContainerInfoAndCheck(std::vector<pika::ContainerInformation> &info, pika::LogManager &logs)
 {
 
-	
 	getContainersInfo_(info);
 	
 	//todo check for valid containers
@@ -164,27 +163,34 @@ void pika::DllLoader::getContainerInfoAndCheck(std::vector<pika::ContainerInform
 
 	for (int i = 0; i < info.size(); i++)
 	{
+		auto signalError = [&](const char *e)
+		{
+			std::string l = e + info[i].containerName;
+			logs.log(l.c_str(), pika::logError);
+
+			info.erase(info.begin() + i);
+			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);
+			signalError("Duplicate container name: ");
+			continue;
+		}
 
-			info.erase(info.begin() + i);
-			i--;
+		if (info[i].containerStaticInfo._internalNotImplemented)
+		{
+			signalError("Container did not implement containerInfo function: ");
 			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--;
+			signalError("Too little heap memory for container: ");
 			continue;
 		}
 

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

@@ -39,9 +39,11 @@ typedef RESETALLOCATOR(resetAllocator_t)
 #undef RESETALLOCATOR
 
 //todo remove windows include 
+#ifdef PIKA_WINDOWS
 #define NOMINMAX
 #define WIN32_LEAN_AND_MEAN
 #include <Windows.h>
+#endif
 
 namespace pika
 {
@@ -58,8 +60,11 @@ struct DllLoader
 	resetAllocator_t *resetAllocator_ = {};
 
 	std::filesystem::path p = {};
+
+#ifdef PIKA_WINDOWS
 	FILETIME filetime = {};
 	HMODULE dllHand = {};
+#endif
 
 	bool loadDll(std::filesystem::path path);
 	bool constructRuntimeContainer(pika::RuntimeContainer &c, const char *name);

+ 28 - 18
Pika/core/pikaRuntime/pikaMain.cpp

@@ -21,7 +21,7 @@
 #include <globalAllocator/globalAllocator.h>
 
 #include <containerManager/containerManager.h>
-
+#include <staticVector.h>
 
 int main()
 {
@@ -42,6 +42,19 @@ int main()
 	PIKA_PERMA_ASSERT(dllLoader.loadDll(currentPath), "Couldn't load dll");
 #pragma endregion
 	
+#pragma region pika imgui id manager
+	pika::ImGuiIdsManager imguiIdsManager;
+#pragma endregion
+
+#pragma region push notification manager
+#if !(defined(PIKA_PRODUCTION) && PIKA_REMOVE_PUSH_NOTIFICATION_IN_PRODUCTION)
+	pika::PushNotificationManager pushNotificationManager; 
+	pushNotificationManager.init();
+	logs.pushNotificationManager = &pushNotificationManager;
+#endif
+#pragma endregion
+
+
 #pragma region init window opengl imgui and context
 	PIKA_PERMA_ASSERT(glfwInit(), "Problem initializing glfw");
 	//glfwSetErrorCallback(error_callback); todo
@@ -78,18 +91,16 @@ int main()
 #pragma endregion
 
 #pragma region editor
+#if !(defined(PIKA_PRODUCTION) && PIKA_REMOVE_EDITOR_IN_PRODUCATION)
 	pika::Editor editor; //todo remove editor in production
 	editor.init(shortcutManager);
-
-	logs.pushNotificationManager = &editor.pushNotificationManager;
+#endif
 #pragma endregion
 
 	
 	logs.log("test log");
-
-
-	containerManager.createContainer("Main level",
-		loadedContainers[0], dllLoader, logs);
+	logs.log("warning log", pika::logWarning);
+	logs.log("error log", pika::logError);
 
 	containerManager.createContainer("Main level",
 		loadedContainers[0], dllLoader, logs);
@@ -114,10 +125,17 @@ int main()
 	#pragma endregion
 
 	#pragma region editor stuff
+	#if !(defined(PIKA_PRODUCTION) && PIKA_REMOVE_EDITOR_IN_PRODUCATION)
+		editor.update(window.input, shortcutManager, logs, 
+			pushNotificationManager);
+	#endif
+	#pragma endregion
 
-		editor.update(window.input, shortcutManager, logs);
-
-
+	#pragma region push notification
+	#if !(defined(PIKA_PRODUCTION) && PIKA_REMOVE_PUSH_NOTIFICATION_IN_PRODUCTION)
+		static bool pushNoticicationOpen = true;
+		pushNotificationManager.update(pushNoticicationOpen);
+	#endif
 	#pragma endregion
 
 	#pragma region container manager
@@ -136,14 +154,6 @@ int main()
 		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, logs);

+ 2 - 0
Pika/core/pikaRuntime/runtimeContainer/runtimeContainer.h

@@ -22,6 +22,8 @@ struct RuntimeContainer
 
 	//this is the allocator of the arena.
 	pika::memory::FreeListAllocator allocator = {};
+
+	RequestedContainerInfo requestedContainerInfo = {};
 };
 
 

+ 1 - 1
Pika/core/pikaSTD/logs/assert.h

@@ -39,7 +39,7 @@ namespace pika
 
 #define PIKA_PERMA_ASSERT(expression, comment) (void)(			\
 			(!!(expression)) ||									\
-			(PIKA_INTERNAL_CURRENT_ASSERT_FUNCTION(#expression,			\
+			(PIKA_INTERNAL_CURRENT_ASSERT_FUNCTION(#expression,	\
 				__FILE__, __LINE__, comment), 0)				\
 )
 

+ 13 - 2
Pika/core/pikaSTD/logs/log.cpp

@@ -38,7 +38,18 @@ 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;
-	s << "#" << std::put_time(std::localtime(&time), "%Y-%m-%d %X") << ": ";
+	s << "#" << std::put_time(std::localtime(&time), "%Y-%m-%d %X");
+	
+	if (type == pika::logWarning)
+	{
+		s << "[warning]";
+	}
+	else if (type == pika::logError)
+	{
+		s << "[error]";
+	}
+	
+	s << ": ";
 	s << l << "\n";
 	return s;
 }
@@ -70,7 +81,7 @@ void pika::LogManager::logToPushNotification(const char *l, int type)
 {
 	if (pushNotificationManager)
 	{
-		pushNotificationManager->pushNotification(l);
+		pushNotificationManager->pushNotification(l, type);
 	}
 
 }

+ 8 - 13
Pika/core/pikaSTD/logs/log.h

@@ -11,20 +11,15 @@ namespace pika
 	struct LogManager
 	{
 
-		static constexpr const char *DefaultLogFile = "logs.txt";
+		static constexpr const char *DefaultLogFile = PIKA_RESOURCES_PATH "logs.txt";
 
 		//a null name will just log to a internal structure
 		void init(std::string name);
 
-		enum : int
-		{
-			logNormal = 0,
-			logWarning,
-			logError
-		};
+		
 
 		//this will be dependent on the configuration of the project. 
-		void log(const char *l, int type = logNormal);
+		void log(const char *l, int type = pika::logNormal);
 		
 
 		std::string name = "";
@@ -34,17 +29,17 @@ namespace pika
 		static constexpr int maxInternalLogCount = 200;
 
 		
-		PushNotificationManager *pushNotificationManager = 0;
+		pika::PushNotificationManager *pushNotificationManager = 0;
 	private:
 		//used only interally.
-		void logToFile(const char *l, int type = logNormal);
-		void logInternally(const char *l, int type = logNormal);
-		void logToPushNotification(const char *l, int type = logNormal);
+		void logToFile(const char *l, int type = pika::logNormal);
+		void logInternally(const char *l, int type = pika::logNormal);
+		void logToPushNotification(const char *l, int type = pika::logNormal);
 
 	};
 
 
-	void logToFile(const char *fileName, const char *l, int type = LogManager::logNormal);
+	void logToFile(const char *fileName, const char *l, int type = pika::logNormal);
 
 
 }

+ 5 - 0
Pika/core/pikaSTD/pikaSizes.h

@@ -1,4 +1,9 @@
 #pragma once
+//////////////////////////////////////////
+//pikaSizes.h
+//Luta Vlad(c) 2022
+//https://github.com/meemknight/PikaEngine
+//////////////////////////////////////////
 
 namespace pika
 {

+ 151 - 0
Pika/core/pikaSTD/staticVector.h

@@ -0,0 +1,151 @@
+#pragma once
+//////////////////////////////////////////
+//staticVector.h
+//Luta Vlad(c) 2022
+//https://github.com/meemknight/PikaEngine
+//////////////////////////////////////////
+
+#include <logs/assert.h>
+
+
+namespace pika
+{
+
+
+	template<class T, size_t N>
+	struct StaticVector
+	{
+		typedef T *iterator;
+		typedef const T *constIterator;
+
+		iterator begin() { return &((T *)beg_)[0]; }
+		constIterator begin() const { return &((T *)beg_)[0]; }
+		iterator end() { return &((T *)beg_)[size_]; }
+		constIterator end() const { return &((T *)beg_)[size_]; }
+
+		static constexpr unsigned int MAX_SIZE = N;
+
+
+		StaticVector() {};
+
+		StaticVector(StaticVector &&other)
+		{
+			for (size_t i = 0; i < other.size_; i++)
+			{
+				beg_[i] = std::move(other.beg_[i]);
+			}
+			
+			this->size_ = other.size_;
+			other.size_ = 0;
+		}
+
+		StaticVector(StaticVector &other)
+		{
+			for (size_t i = 0; i < other.size_; i++)
+			{
+				beg_[i] = other.beg_[i];
+			}
+
+			this->size_ = other.size_;
+		}
+
+		size_t size()const { return size_; }
+
+		bool empty() const
+		{
+			return (size_ == 0);
+		}
+
+		T *data()
+		{
+			return beg_;
+		}
+
+		StaticVector &operator= (const StaticVector &other)
+		{
+			if (this == &other)
+			{
+				return *this;
+			}
+
+			for (size_t i = 0; i < other.size_; i++)
+			{
+				beg_[i] = other.beg_[i];
+			}
+			this->size_ = other.size_;
+
+			return *this;
+		}
+
+		StaticVector &operator= (const StaticVector &&other)
+		{
+			if (this == &other)
+			{
+				return *this;
+			}
+
+			for (size_t i = 0; i < other.size_; i++)
+			{
+				beg_[i] = std::move(other.beg_[i]);
+			}
+
+			this->size_ = other.size_;
+			other.size_ = 0;
+
+			return *this;
+		}
+
+		T &operator[] (size_t index)
+		{
+			PIKA_PERMA_ASSERT(index < size_);
+			return static_cast<T *>(beg_)[index];
+		}
+
+		T operator[] (size_t index) const
+		{
+			PIKA_PERMA_ASSERT(index < size_);
+			return static_cast<T *>(beg_)[index];
+		}
+
+		T &back()
+		{
+			return (*this)[size_ - 1];
+		}
+
+		const T &back() const
+		{
+			return (*this)[size_ - 1];
+		}
+
+		void clear() { size_ = 0; }
+
+		void push_back(const T &el)
+		{
+			PIKA_PERMA_ASSERT(size_ < MAX_SIZE);
+			beg_[size_] = std::forward<T>(el);
+			size_++;
+		}
+
+		void push_back(T &&el)
+		{
+			PIKA_PERMA_ASSERT(size_ < MAX_SIZE);
+			beg_[size_] = std::forward<T>(el);
+			size_++;
+		}
+
+		void pop_back()
+		{
+			PIKA_PERMA_ASSERT(size_ > 0);
+			size_--;
+		}
+
+	private:
+
+		size_t size_ = 0;
+		T beg_[N];
+
+	};
+
+
+
+}

+ 19 - 3
Pika/core/sharedRuntime/baseContainer.h

@@ -3,14 +3,28 @@
 #include <iostream>
 #include <pikaOptional.h>
 #include <string>
+#include <pikaAllocator/freeListAllocator.h>
+
+//this is passed by the engine. You should not modify the data
+struct RequestedContainerInfo
+{
+	pika::memory::FreeListAllocator *mainAllocator = {};
+
+
+};
 
 struct ContainerStaticInfo
 {
+	static constexpr size_t MaxAllocatorsCount = 128;
+
 
 	//this is the main allocator memory size
 	size_t defaultHeapMemorySize = 0;
+	
+	size_t bonusAllocators[MaxAllocatorsCount] = {}; //todo static vector here
 
 
+	bool _internalNotImplemented = 0;
 };
 
 
@@ -20,14 +34,16 @@ 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
+	static ContainerStaticInfo containerInfo() { ContainerStaticInfo c; c._internalNotImplemented = true; return c; };
+	
 
-	virtual void create() = 0;
+	virtual void create(RequestedContainerInfo &requestedInfo) = 0;
 
 	virtual void update(
 		pika::Input input, 
 		float deltaTime, 
-		pika::WindowState windowState) = 0;
+		pika::WindowState windowState,
+		RequestedContainerInfo &requestedInfo) = 0;
 
 	virtual ~Container() {};
 

+ 14 - 0
Pika/core/sharedRuntime/pikaImgui/pikaImgui.cpp

@@ -96,3 +96,17 @@ void pika::imguiEndFrame(PikaContext pikaContext)
 	
 	}
 }
+
+void pika::addErrorSymbol()
+{
+	ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 0, 0, 255));
+	ImGui::Text(ICON_FK_TIMES_CIRCLE " ");
+	ImGui::PopStyleColor();
+}
+
+void pika::addWarningSymbol()
+{
+	ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 0, 255));
+	ImGui::Text(ICON_FK_EXCLAMATION_TRIANGLE " ");
+	ImGui::PopStyleColor();
+}

+ 17 - 1
Pika/core/sharedRuntime/pikaImgui/pikaImgui.h

@@ -6,6 +6,7 @@
 #include "backends/imgui_impl_glfw.h"
 #include "backends/imgui_impl_opengl3.h"
 #include "imguiThemes.h"
+#include <IconsForkAwesome.h>
 
 
 #include <pikaContext.h>
@@ -25,10 +26,25 @@ namespace pika
 		{
 			mainEditorWindow = 100,
 			editShortcutWindow = 200,
-			
+			logWindow = 300,
 			
 			idsCount = 4000
 		};
 	}
 
+	struct ImGuiIdsManager
+	{
+		int counter = EditorImguiIds::idsCount + 1;
+
+		//returns the first id. (count) ids will be reserved.
+		//if you want 5 ids and the function returns 10, then ids 10 11 12 13 14 will be reserved.
+		int getImguiIds(unsigned int count = 1)
+		{
+			return counter + count;
+		}
+	};
+
+	void addErrorSymbol();
+	void addWarningSymbol();
+
 };

+ 18 - 5
Pika/core/sharedRuntime/pushNotification/pushNotification.cpp

@@ -2,7 +2,8 @@
 #include <imgui.h>
 #include <iostream>
 #include <pikaConfig.h>
-
+#include <IconsForkAwesome.h>
+#include <pikaImgui/pikaImgui.h>
 
 #ifdef PIKA_PRODUCTION and 
 #if PIKA_REMOVE_PUSH_NOTIFICATIONS_IN_PRODUCTION
@@ -16,7 +17,7 @@ void pika::PushNotificationManager::init()
 void pika::PushNotificationManager::update(bool &open)
 {}
 
-void pika::PushNotificationManager::pushNotification(const char *content)
+void pika::PushNotificationManager::pushNotification(const char *content, int logType)
 {}
 
 #endif
@@ -70,9 +71,21 @@ void pika::PushNotificationManager::update(bool &open)
 				ImGui::Separator();
 			}
 
+			if (notificationQue[i].notificationType == pika::logError)
+			{
+				pika::addErrorSymbol();
+				ImGui::SameLine();
+			}
+
+			if (notificationQue[i].notificationType == pika::logWarning)
+			{
+				pika::addWarningSymbol();
+				ImGui::SameLine();
+			}
 			
 			ImGui::Text(notificationQue[i].content.c_str(), i);
-			
+		
+
 		}
 
 
@@ -99,10 +112,10 @@ void pika::PushNotificationManager::update(bool &open)
 
 }
 
-void pika::PushNotificationManager::pushNotification(const char *content)
+void pika::PushNotificationManager::pushNotification(const char *content, int logType)
 {
 	notificationQue.push_back
-	(Notification(std::string(content), std::chrono::steady_clock::now()));
+	( Notification(std::string(content), std::chrono::steady_clock::now(), logType) );
 }
 
 #endif

+ 13 - 4
Pika/core/sharedRuntime/pushNotification/pushNotification.h

@@ -5,14 +5,23 @@
 
 namespace pika
 {
+	enum: int
+	{
+		logNormal = 0,
+		logWarning,
+		logError
+	};
 
 	struct Notification
 	{
 		std::string content = "";
 		std::chrono::steady_clock::time_point startTime = {};
+		int notificationType = pika::logNormal;
 
-		Notification(std::string content, std::chrono::steady_clock::time_point startTime):
-			content(content), startTime(startTime){};
+		Notification(std::string content, std::chrono::steady_clock::time_point startTime, int notificationType):
+			content(content), startTime(startTime), notificationType(notificationType)
+		{
+		};
 
 		Notification() {};
 	};
@@ -25,7 +34,7 @@ namespace pika
 
 		void update(bool &open);
 
-		void pushNotification(const char *content);
+		void pushNotification(const char *content, int logType = pika::logNormal);
 
 		std::deque<Notification> notificationQue;
 	};
@@ -33,4 +42,4 @@ namespace pika
 
 
 
-}
+};

+ 11 - 11
Pika/gameplay/containers.cpp

@@ -1,21 +1,21 @@
 #include <containers.h>
 #include <logs/assert.h>
 
+
+
+#define PIKA_MAKE_CONTAINER_GET(x)	if (std::strcmp(name, #x ) == 0)						\
+{																							\
+if (sizeof(x) != memoryArena->containerStructMemory.size) { return nullptr; }				\
+	return new(memoryArena->containerStructMemory.block)  x ();								\
+}																							\
+else
+
+
 //this should not allocate memory
 Container *getContainer(const char *name, pika::memory::MemoryArena *memoryArena)
 {
 
-	if (std::strcmp(name, "Gameplay") == 0)
-	{
-		if (sizeof(Gameplay) != memoryArena->containerStructMemory.size)
-		{
-			//"invalid memory size for static data"
-			return nullptr;
-		}
-
-		return new(memoryArena->containerStructMemory.block)  Gameplay();
-	}
-	else
+	PIKA_MAKE_CONTAINER_GET(Gameplay)
 	{
 		//"invalid container name: "
 		return nullptr;

+ 9 - 4
Pika/gameplay/containers/pikaGameplay.h

@@ -20,7 +20,7 @@ struct Gameplay : public Container
 
 	float *r =0;
 
-
+	//todo user can request imgui ids; shortcut manager context; allocators
 	static ContainerStaticInfo containerInfo()
 	{
 		ContainerStaticInfo info = {};
@@ -30,7 +30,7 @@ struct Gameplay : public Container
 	}
 
 
-	void create()
+	void create(RequestedContainerInfo &requestedInfo)
 	{
 		renderer.create();
 		//pika::initShortcutApi();
@@ -39,8 +39,8 @@ struct Gameplay : public Container
 		//void *test = new char[pika::MB(10)]; //todo let the allocator tell the engine somehow that it is out of memory
 	}
 
-
-	void update(pika::Input input, float deltaTime, pika::WindowState windowState)
+	void update(pika::Input input, float deltaTime, pika::WindowState windowState,
+		RequestedContainerInfo &requestedInfo)
 	{
 
 		if (pika::shortcut(input, "Ctrl + S"))
@@ -70,6 +70,11 @@ struct Gameplay : public Container
 			std::cout << "typed\n";
 		}
 
+		if (input.buttons[pika::Button::E].doublePressed())
+		{
+			std::cout << "double pressed\n";
+		}
+
 		//std::cout << state.deltaTime << "\n";
 
 		renderer.flush();

+ 6 - 0
Pika/gameplay/dll/dllMain.h

@@ -1,4 +1,10 @@
 #pragma once
+//////////////////////////////////////////
+//dllMain.h
+//Luta Vlad(c) 2022
+//https://github.com/meemknight/PikaEngine
+//////////////////////////////////////////
+
 #include <pikaConfig.h>
 #include <imgui.h>
 #include <pikaImgui/pikaImgui.h>

+ 3 - 0
Pika/resources/logs.txt

@@ -0,0 +1,3 @@
+#2022-09-24 16:30:37: test log
+#2022-09-24 16:30:37[warning]: warning log
+#2022-09-24 16:30:37[error]: error log