Should have commited sooner...

dev
anulax1225 ago%!(EXTRA string=11 months)
parent a212843021
commit 6cf95572d5
  1. 10
      bakara/src/bakara.h
  2. 7
      bakara/src/bakara/core/application.cpp
  3. 9
      bakara/src/bakara/core/application.h
  4. 4
      bakara/src/bakara/core/entry.cpp
  5. 33
      bakara/src/bakara/imgui/imgui_layer.cpp
  6. 23
      bakara/src/bakara/imgui/imgui_layer.h
  7. 4
      bakara/src/bakara/io/window.h
  8. 8
      bakara/src/bakara/plaforms/window/glfw/win_glfw.cpp
  9. 2
      bakara/src/bakara/plaforms/window/glfw/win_glfw.h
  10. 10
      build.sh

@ -4,6 +4,16 @@
Precompiled headers for external pragrams.
*/
/*! \namespace Bk
Global namespace doc
*/
namespace Bk {}
/*! \namespace Bk::Plaform
Plaform namespace doc
*/
namespace Bk::Plaform {}
#include <bakara/math/type.h>
#include <bakara/core/log.h>
#include <bakara/core/assert.h>

@ -1,10 +1,15 @@
#include "application.h"
namespace Bk {
Application* Application::p_instance = nullptr;
Application::Application()
{
h_window = Window::create_window();
BK_CORE_MSG_ASSERT(p_instance == nullptr, "Application already exists, can not create two application.")
Application::p_instance = this;
h_window = std::shared_ptr<Window>(Window::create_window());
h_window->set_event_callback(BK_BIND_EVENT_FN(on_event));
p_running = true;
}
Application::~Application() { }

@ -69,12 +69,17 @@ namespace Bk {
*/
void run();
std::shared_ptr<Window> get_window() { return std::shared_ptr<Window>(h_window); }
static Application& get() { return *p_instance; }
protected:
std::unique_ptr<Window> h_window; //!< Pointer to the main window
std::shared_ptr<Window> h_window; //!< Pointer to the main window
private:
LayerStack p_layer_stack; //!< Layer stack of the application
bool p_running = true; //!< Flag that indicates if the update loop should stop or not
bool p_running; //!< Flag that indicates if the update loop should stop or not
static Application* p_instance;
};
/*! \fn std::unique_ptr<Application> Bk::create_app()
Is used to retrive the user app class instance, made from inheritance.

@ -2,6 +2,10 @@
#include "log.h"
#include "application.h"
/*! \file entry.cpp
This file contains the entry point of the program.
*/
/*! \fn std::unique_ptr<Bk::Application> Bk::create_app()
External function implemented client side.
*/

@ -1 +1,32 @@
#include "imgui_layer.h"
#include "imgui_layer.h"
namespace Bk {
void ImguiLayer::on_attach()
{
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
Application& app = Application::get();
GLFWwindow* window = static_cast<GLFWwindow*>(app.get_window()->get_native_window());
// Setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 410");
}
void ImguiLayer::on_detach()
{
}
void ImguiLayer::on_event(Bk::Event& e)
{
}
void ImguiLayer::on_update()
{
}
}

@ -1,2 +1,23 @@
#pragma once
#include <imgui.h>
#include <backends/imgui_impl_opengl3.h>
#include <backends/imgui_impl_glfw.h>
#include <backends/imgui_impl_glfw.h>
#include <bakara/core/application.h>
#include <bakara/core/layer.h>
namespace Bk {
class ImguiLayer : public Layer
{
public:
ImguiLayer()
: Layer("Imgui") {}
~ImguiLayer() = default;
void on_attach() override;
void on_detach() override;
void on_event(Bk::Event& e) override;
void on_update() override;
};
}

@ -91,12 +91,14 @@ namespace Bk {
*/
bool is_open() { return h_is_open; }
virtual void* get_native_window() = 0;
/*! \fn Bk::Window::create_window()
Static function implemented in the api window class to get a window specifique api.
If no parameter is specified, creates the window with the default settings.
@param props : Window information
*/
static std::unique_ptr<Window> create_window(const WindowProps& props = WindowProps());
static Window* create_window(const WindowProps& props = WindowProps());
protected:
bool h_is_open; //!< indicaste if the window is opened or not
};

@ -2,9 +2,9 @@
#include "win_glfw.h"
namespace Bk {
std::unique_ptr<Window> Window::create_window(const WindowProps& props)
Window* Window::create_window(const WindowProps& props)
{
return std::unique_ptr<Window>(new Plaform::WinGLFW(props));
return new Plaform::WinGLFW(props);
}
namespace Plaform {
@ -42,9 +42,9 @@ namespace Bk {
glfwMakeContextCurrent(p_window);
int success = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
BK_CORE_ASSERT(success)
BK_CORE_MSG_ASSERT(success, "Couldn't load glad!")
BK_CORE_TRACE("Opengl Raw Version : {0}",GL_VERSION);
BK_CORE_INFO("Opengl Raw Version : {0}",GL_VERSION);
glfwSetWindowUserPointer(p_window, &p_data);
set_vsync(true);

@ -23,6 +23,8 @@ namespace Bk::Plaform {
void close() override;
void open() override;
void* get_native_window() override { return p_window; }
private:
GLFWwindow* p_window;

@ -2,12 +2,17 @@ clear
echo ==================
echo [BUILDING PROJECT]
echo ==================
echo number of lines :
find ./bakara/src -name *.cpp -or -name *.h -exec cat {} \; | wc -l
if [ -z ${clear} ]; then
clear=0
else
clear=1
fi
if [ -z ${exec} ]; then
exec=0
else
exec=1
fi
if [ 1 -eq ${clear} ]; then
@ -16,8 +21,9 @@ if [ 1 -eq ${clear} ]; then
else
echo Caching bin/bin-int dirs
fi
echo
premake5 gmake
echo
make $1
if [ $? -eq 0 ]; then
echo Compilation Success

Loading…
Cancel
Save