Skip to content

Commit

Permalink
Merge branch 'Development_Hekbas'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hekbas committed Dec 21, 2023
2 parents 878b923 + 655129d commit 03d2797
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 55 deletions.
2 changes: 1 addition & 1 deletion TheOneEditor/PanelProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool PanelProject::Draw()

// Directory Tree View ----------------------------
ImGui::TableNextColumn();
if (ImGui::CollapsingHeader("Assets"))
if (ImGui::CollapsingHeader("Assets", ImGuiTreeNodeFlags_DefaultOpen))
{
uint32_t count = 0;
for (const auto& entry : fs::recursive_directory_iterator(directoryPath))
Expand Down
5 changes: 4 additions & 1 deletion TheOneEditor/PanelScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "..\TheOneEngine\EngineCore.h"

PanelScene::PanelScene(PanelType type, std::string name) : Panel(type, name) {}
PanelScene::PanelScene(PanelType type, std::string name) : Panel(type, name), isHovered(false) {}

PanelScene::~PanelScene() {}

Expand All @@ -27,6 +27,9 @@ bool PanelScene::Draw()
ImGui::SetNextWindowBgAlpha(.0f);
if (ImGui::Begin("Scene", &enabled, settingsFlags))
{
if (ImGui::IsWindowHovered())
isHovered = true;

// Top Bar --------------------------
if (ImGui::BeginMenuBar())
{
Expand Down
3 changes: 3 additions & 0 deletions TheOneEditor/PanelScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class PanelScene : public Panel
~PanelScene();

bool Draw();

public:
bool isHovered;
};

#endif // !__PANEL_SCENE_H__
12 changes: 9 additions & 3 deletions TheOneEditor/Renderer3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Renderer3D.h"
#include "Window.h"
#include "Gui.h"
#include "PanelScene.h"
#include "SceneManager.h"

#include "..\TheOneEngine\GameObject.h"
Expand Down Expand Up @@ -53,6 +54,8 @@ bool Renderer3D::PreUpdate()
bool Renderer3D::Update(double dt)
{
CameraInput(dt);
app->gui->panelScene->isHovered = false;

app->engine->Update(dt);

return true;
Expand Down Expand Up @@ -135,14 +138,17 @@ void Renderer3D::CreateRay()

void Renderer3D::CameraInput(double dt)
{
if (!app->gui->panelScene->isHovered)
return;

Camera* camera = sceneCamera.get()->GetComponent<Camera>();
Transform* transform = sceneCamera.get()->GetComponent<Transform>();

double speed = 10 * dt;
double speed = 20 * dt;
if (app->input->GetKey(SDL_SCANCODE_LSHIFT) == KEY_REPEAT)
speed = 20 * dt;
speed = 35 * dt;

double mouseSensitivity = 10.0 * dt;
double mouseSensitivity = 18.0 * dt;

if (app->input->GetMouseButton(SDL_BUTTON_RIGHT) == KEY_REPEAT)
{
Expand Down
21 changes: 12 additions & 9 deletions TheOneEditor/SceneManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ std::shared_ptr<GameObject> SceneManager::CreateMeshGO(std::string path)

uint fileCount = 0;

for (const auto& entry : fs::directory_iterator(folderName)) {
if (fs::is_regular_file(entry)) {
for (const auto& entry : fs::directory_iterator(folderName))
{
if (fs::is_regular_file(entry))
{
std::string path = entry.path().filename().string();
fileNames.push_back(entry.path().string());
fileCount++;
Expand Down Expand Up @@ -214,20 +216,21 @@ std::shared_ptr<GameObject> SceneManager::CreateMeshGO(std::string path)
}
}

/* if (!textures.empty()) {
if (meshes.size() == 1) {
/* if (!textures.empty())
{
if (meshes.size() == 1)
{
ComponentTexture* texture = (ComponentTexture*)GetComponent(ComponentType::TEXTURE);
textures->setTexture((*meshes.begin())->texture);
defaultTexture = texture->getTexture()->path;
}
else {
for (auto i = meshes.begin(); i != meshes.end(); ++i) {
else
{
for (auto i = meshes.begin(); i != meshes.end(); ++i)
{
ComponentTexture* texturePart = (ComponentTexture*)GOPart->GetComponent(ComponentType::TEXTURE);
texturePart->setTexture((*i)->texture);
defaultTexture = texturePart->getTexture()->path;
}
}
}*/
Expand Down
15 changes: 7 additions & 8 deletions TheOneEditor/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Window::Window(App* app) :
window(nullptr),
glContext(),
displayMode(DisplayMode::WINDOWED),
resolution(Resolution::R_1280x720),
resolution(Resolution::R_1920x1080),
borderless(false),
refreshRate(0)
{}
Expand All @@ -19,6 +19,8 @@ bool Window::Awake()
{
bool ret = true;

SetResolution(resolution);

LOG(LogType::LOG_INFO, "# Initializing SDL Window with OpenGL...");
if (!initSDLWindowWithOpenGL())
return false;
Expand All @@ -36,7 +38,7 @@ bool Window::Awake()
bool Window::Start()
{
displayMode = DisplayMode::WINDOWED;
resolution = Resolution::R_1280x720;
resolution = Resolution::R_1920x1080;

SetResolution(resolution);

Expand Down Expand Up @@ -82,7 +84,7 @@ bool Window::initSDLWindowWithOpenGL()
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);

std::string title = std::string(TITLE) + "_" + VERSION;
window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);

if (!window)
{
Expand Down Expand Up @@ -140,7 +142,7 @@ bool Window::initOpenGL()
}
LOG(LogType::LOG_OK, "-OpenGL 3.1 Supported");

glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
glViewport(0, 0, width, height);
glClearColor(0.25, 0.25, .25, 1);

LOG(LogType::LOG_OK, "-Init OpenGL");
Expand Down Expand Up @@ -174,7 +176,7 @@ void Window::SetDisplayMode(DisplayMode mode)
if (SDL_SetWindowFullscreen(window, 0) != 0)
LOG(LogType::LOG_ERROR, "Unable to set Display Mode to Windowed", SDL_GetError());

OnResizeWindow(WINDOW_WIDTH, WINDOW_HEIGHT);
OnResizeWindow(width, height);

displayMode = DisplayMode::WINDOWED;
break;
Expand Down Expand Up @@ -219,9 +221,6 @@ Resolution Window::GetResolution()

void Window::SetResolution(Resolution res)
{
uint width = WINDOW_WIDTH;
uint height = WINDOW_HEIGHT;

switch (res)
{
case Resolution::R_3840x2160: width = 3840; height = 2160; resolution = Resolution::R_3840x2160; break;
Expand Down
6 changes: 4 additions & 2 deletions TheOneEditor/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <SDL2/SDL.h>


#define WINDOW_WIDTH 1280
#define WINDOW_HEIGHT 720
//#define WINDOW_WIDTH 1280
//#define WINDOW_HEIGHT 720


enum class DisplayMode
Expand Down Expand Up @@ -69,6 +69,8 @@ class Window : public Module
bool borderless;

Resolution resolution;
uint width;
uint height;
};

#endif // !__WINDOW_H__
66 changes: 35 additions & 31 deletions TheOneEditor/imgui.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[Window][Inspector]
Pos=987,19
Size=293,701
Pos=1543,19
Size=377,1061
Collapsed=0
DockId=0x00000008,0
DockId=0x0000000B,0

[Window][DockSpace]
Pos=0,0
Size=1280,720
Size=1920,1080
Collapsed=0

[Window][Debug##Default]
Expand All @@ -20,64 +20,64 @@ Size=339,180
Collapsed=0

[Window][Console]
Pos=0,506
Size=985,214
Pos=877,766
Size=664,314
Collapsed=0
DockId=0x00000004,1
DockId=0x0000000A,0

[Window][Hierarchy]
Pos=0,19
Size=219,485
Size=285,745
Collapsed=0
DockId=0x00000006,0

[Window][Scene]
Pos=221,19
Size=764,485
Pos=287,19
Size=677,745
Collapsed=0
DockId=0x00000009,0
DockId=0x00000008,0

[Window][Assets]
Pos=0,511
Size=993,209
Collapsed=0
DockId=0x00000004,0
DockId=0x00000005,0

[Window][my name is your name]
Pos=727,295
Size=465,277
Collapsed=0

[Window][Project]
Pos=0,506
Size=985,214
Pos=0,766
Size=875,314
Collapsed=0
DockId=0x00000004,0
DockId=0x00000005,0

[Window][Stats]
Pos=983,86
Size=362,237
Collapsed=0

[Window][About TheOneEngine]
Pos=399,265
Pos=719,445
Size=481,105
Collapsed=0

[Window][Settings]
Pos=1518,841
Size=597,240
Pos=341,121
Size=597,298
Collapsed=0

[Window][Game]
Pos=221,19
Size=764,485
Pos=966,19
Size=575,745
Collapsed=0
DockId=0x00000009,1
DockId=0x0000000D,0

[Table][0x8AACECBD,2]
RefScale=13
Column 0 Width=286
Column 0 Width=326
Column 1 Width=519

[Table][0xF02CD328,4]
Expand All @@ -87,13 +87,17 @@ Column 2 Weight=1.0470
Column 3 Weight=1.0067

[Docking][Data]
DockSpace ID=0x09EF459F Window=0x9A404470 Pos=0,19 Size=1280,701 Split=Y
DockNode ID=0x00000001 Parent=0x09EF459F SizeRef=1280,143
DockNode ID=0x00000002 Parent=0x09EF459F SizeRef=1280,575 Split=X
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=985,429 Split=Y Selected=0xE192E354
DockNode ID=0x00000003 Parent=0x00000007 SizeRef=763,485 Split=X Selected=0xE192E354
DockNode ID=0x00000006 Parent=0x00000003 SizeRef=219,487 Selected=0x29EABFBD
DockNode ID=0x00000009 Parent=0x00000003 SizeRef=764,487 CentralNode=1 Selected=0xE192E354
DockNode ID=0x00000004 Parent=0x00000007 SizeRef=763,214 Selected=0xD04A4B96
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=293,429 Selected=0xE7039252
DockSpace ID=0x09EF459F Window=0x9A404470 Pos=0,19 Size=1920,1061 Split=X
DockNode ID=0x00000007 Parent=0x09EF459F SizeRef=2181,701 Split=Y
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=1280,143
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=1280,575 Split=Y
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=763,745 Split=X Selected=0xE192E354
DockNode ID=0x00000006 Parent=0x00000003 SizeRef=285,487 Selected=0x29EABFBD
DockNode ID=0x00000009 Parent=0x00000003 SizeRef=1894,487 Split=X Selected=0xE192E354
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=677,735 CentralNode=1 Selected=0xE192E354
DockNode ID=0x0000000D Parent=0x00000009 SizeRef=575,735 Selected=0x26816F31
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=763,314 Split=X Selected=0xD04A4B96
DockNode ID=0x00000005 Parent=0x00000004 SizeRef=875,214 Selected=0xD04A4B96
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=664,214 Selected=0x49278EEE
DockNode ID=0x0000000B Parent=0x09EF459F SizeRef=377,701 Selected=0xE7039252

0 comments on commit 03d2797

Please sign in to comment.