almost first rendering, fixing renderer issues

This commit is contained in:
Kbz-8
2022-12-19 00:59:45 +01:00
parent 4a67aab716
commit f1e0499564
417 changed files with 60861 additions and 298 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
/* Updated: 2022/12/18 02:49:45 by maldavid ### ########.fr */
/* Updated: 2022/12/19 00:40:17 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,8 +19,14 @@ namespace mlx::core
while(_in.is_running())
{
_in.update();
for(auto win : _wins)
win->beginFrame();
if(_loop_hook)
_loop_hook(_param);
for(auto win : _wins)
win->endFrame();
}
}
}

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2022/12/18 03:45:13 by maldavid ### ########.fr */
/* Updated: 2022/12/18 23:10:17 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -28,7 +28,7 @@ namespace mlx::core
class Application
{
public:
Application() : _in(_wins) {}
Application() : _in() {}
inline void* new_window(std::size_t w, std::size_t h, std::string title)
{

View File

@@ -6,19 +6,20 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
/* Updated: 2022/12/18 03:42:18 by maldavid ### ########.fr */
/* Updated: 2022/12/18 22:24:25 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#include <iostream>
#include <SDL2/SDL.h>
#include "errors.h"
#include "application.h"
#include <renderer/core/render_core.h>
extern "C"
{
void* mlx_init()
{
mlx::Render_Core::get().init();
return new mlx::core::Application();
}
@@ -78,6 +79,7 @@ extern "C"
int mlx_destroy_display(void* mlx)
{
delete static_cast<mlx::core::Application*>(mlx);
mlx::Render_Core::get().destroy();
return 0;
}
}

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:48:06 by maldavid #+# #+# */
/* Updated: 2022/12/17 23:28:22 by maldavid ### ########.fr */
/* Updated: 2022/12/18 17:47:51 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -21,21 +21,21 @@ namespace mlx::core::error
{
void report(e_kind kind, std::string msg, ...)
{
char buffer[1024];
char buffer[4096];
va_list al;
va_start(al, msg);
std::vsprintf(buffer, std::move(msg).c_str(), al);
std::vsprintf(buffer, msg.c_str(), al);
va_end(al);
switch(kind)
{
case e_kind::message: std::cout << "[MicroLibX] Message : " << buffer << std::endl; break;
case e_kind::warning: std::cout << "[MicroLibX] Warning : " << buffer << std::endl; break;
case e_kind::error: std::cerr << "[MicroLibX] Error : " << buffer << std::endl; break;
case e_kind::message: std::cout << "[MacroLibX] Message : " << buffer << std::endl; break;
case e_kind::warning: std::cout << "[MacroLibX] Warning : " << buffer << std::endl; break;
case e_kind::error: std::cerr << "[MacroLibX] Error : " << buffer << std::endl; break;
case e_kind::fatal_error:
std::cerr << "[MicroLibX] Fatal Error : " << buffer << std::endl;
std::exit(EXIT_SUCCESS);
std::cerr << "[MacroLibX] Fatal Error : " << buffer << std::endl;
std::exit(EXIT_FAILURE);
break;
}
}