Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zong4 committed Nov 3, 2024
1 parent 04a52e3 commit dceffcf
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 74 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: "Hazel.sln"
SOLUTION_FILE_PATH: "Engine.sln"

permissions:
contents: read
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
# NOTE(Yan): Global environment vars aren't set automatically for some reason
# These build commands should be replaced by build script in future.
run: |
source /etc/hazel-env
source /etc/engine-env
premake5 --cc=clang gmake2
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
Expand Down
2 changes: 1 addition & 1 deletion Editor-Launcher/imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pos=60,60
Size=400,400
Collapsed=0

[Window][Select Hazel Install]
[Window][Select Engine Install]
Pos=290,268
Size=700,184
Collapsed=0
Expand Down
48 changes: 24 additions & 24 deletions Editor-Launcher/src/HazelnutLauncher.cpp
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
#include <Hazel/EntryPoint.h>
#include <Hazel/Utilities/ProcessHelper.h>
#include <Engine/EntryPoint.h>
#include <Engine/Utilities/ProcessHelper.h>
#include "LauncherLayer.h"

class HazelnutLauncherApplication : public Hazel::Application
class EditorLauncherApplication : public Engine::Application
{
public:
HazelnutLauncherApplication(const Hazel::ApplicationSpecification& specification)
: Application(specification), m_UserPreferences(Hazel::Ref<Hazel::UserPreferences>::Create())
EditorLauncherApplication(const Engine::ApplicationSpecification& specification)
: Application(specification), m_UserPreferences(Engine::Ref<Engine::UserPreferences>::Create())
{
}

virtual void OnInit() override
{
std::filesystem::path persistentStoragePath = Hazel::FileSystem::GetPersistentStoragePath();
std::filesystem::path persistentStoragePath = Engine::FileSystem::GetPersistentStoragePath();

// User Preferences
{
Hazel::UserPreferencesSerializer serializer(m_UserPreferences);
Engine::UserPreferencesSerializer serializer(m_UserPreferences);
if (!std::filesystem::exists(persistentStoragePath / "UserPreferences.yaml"))
serializer.Serialize(persistentStoragePath / "UserPreferences.yaml");
else
serializer.Deserialize(persistentStoragePath / "UserPreferences.yaml");
}

Hazel::LauncherProperties launcherProperties;
Engine::LauncherProperties launcherProperties;
launcherProperties.UserPreferences = m_UserPreferences;
launcherProperties.ProjectOpenedCallback = std::bind(&HazelnutLauncherApplication::OnProjectOpened, this, std::placeholders::_1);
launcherProperties.ProjectOpenedCallback = std::bind(&EditorLauncherApplication::OnProjectOpened, this, std::placeholders::_1);

// Installation Path
{
if (Hazel::FileSystem::HasEnvironmentVariable("HAZEL_DIR"))
launcherProperties.InstallPath = Hazel::FileSystem::GetEnvironmentVariable("HAZEL_DIR");
if (Engine::FileSystem::HasEnvironmentVariable("ENGINE_DIR"))
launcherProperties.InstallPath = Engine::FileSystem::GetEnvironmentVariable("ENGINE_DIR");
}

SetShowStats(false);
PushLayer(new Hazel::LauncherLayer(launcherProperties));
PushLayer(new Engine::LauncherLayer(launcherProperties));
}

private:
void OnProjectOpened(std::string projectPath)
{
std::filesystem::path hazelDir = Hazel::FileSystem::GetEnvironmentVariable("HAZEL_DIR");
Hazel::ProcessInfo hazelnutProcessInfo;
std::filesystem::path engineDir = Engine::FileSystem::GetEnvironmentVariable("ENGINE_DIR");
Engine::ProcessInfo editorProcessInfo;

#ifdef ZONG_DEBUG
#define ZONG_BINDIR_PREFIX "Debug"
Expand All @@ -57,28 +57,28 @@ class HazelnutLauncherApplication : public Hazel::Application
#define ZONG_BIN_SUFFIX ""
#endif

hazelnutProcessInfo.FilePath = hazelDir / "bin" / ZONG_BINDIR_PREFIX "-" ZONG_BINDIR_PLATFORM "-x86_64" / "Editor" / "Editor" ZONG_BIN_SUFFIX;
editorProcessInfo.FilePath = engineDir / "bin" / ZONG_BINDIR_PREFIX "-" ZONG_BINDIR_PLATFORM "-x86_64" / "Editor" / "Editor" ZONG_BIN_SUFFIX;

hazelnutProcessInfo.CommandLine = projectPath;
hazelnutProcessInfo.WorkingDirectory = hazelDir / "Editor";
hazelnutProcessInfo.Detached = true;
Hazel::ProcessHelper::CreateProcess(hazelnutProcessInfo);
editorProcessInfo.CommandLine = projectPath;
editorProcessInfo.WorkingDirectory = engineDir / "Editor";
editorProcessInfo.Detached = true;
Engine::ProcessHelper::CreateProcess(editorProcessInfo);
}

private:
Hazel::Ref<Hazel::UserPreferences> m_UserPreferences;
Engine::Ref<Engine::UserPreferences> m_UserPreferences;
};

Hazel::Application* Hazel::CreateApplication(int argc, char** argv)
Engine::Application* Engine::CreateApplication(int argc, char** argv)
{
Hazel::ApplicationSpecification specification;
Engine::ApplicationSpecification specification;
specification.Name = "Editor Launcher";
specification.WindowWidth = 1280;
specification.WindowHeight = 720;
specification.VSync = true;
specification.StartMaximized = false;
specification.Resizable = false;
specification.WorkingDirectory = FileSystem::HasEnvironmentVariable("HAZEL_DIR") ? FileSystem::GetEnvironmentVariable("HAZEL_DIR") + "/Editor" : "../Editor";
specification.WorkingDirectory = FileSystem::HasEnvironmentVariable("ENGINE_DIR") ? FileSystem::GetEnvironmentVariable("ENGINE_DIR") + "/Editor" : "../Editor";

return new HazelnutLauncherApplication(specification);
return new EditorLauncherApplication(specification);
}
30 changes: 15 additions & 15 deletions Editor-Launcher/src/LauncherLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "LauncherLayer.h"

#include <Hazel/ImGui/UICore.h>
#include <Hazel/Utilities/StringUtils.h>
#include <Engine/ImGui/UICore.h>
#include <Engine/Utilities/StringUtils.h>

#include "imgui_internal.h"

namespace Hazel {
namespace Engine {

#define MAX_PROJECT_NAME_LENGTH 255
#define MAX_PROJECT_FILEPATH_LENGTH 512
Expand Down Expand Up @@ -41,8 +41,8 @@ namespace Hazel {

void LauncherLayer::OnAttach()
{
std::string path = "Resources/Editor/Hazel.png";
m_HazelLogoTexture = Texture2D::Create(TextureSpecification(), path);
std::string path = "Resources/Editor/Engine.png";
m_EngineLogoTexture = Texture2D::Create(TextureSpecification(), path);
}

void LauncherLayer::OnDetach()
Expand Down Expand Up @@ -71,24 +71,24 @@ namespace Hazel {

ImGui::PopStyleVar(2);

// Hazel Install Folder Prompt
// Engine Install Folder Prompt
{
if ((m_Properties.InstallPath.empty() || !FileSystem::Exists(m_Properties.InstallPath)) && !ImGui::IsPopupOpen("Select Hazel Install"))
if ((m_Properties.InstallPath.empty() || !FileSystem::Exists(m_Properties.InstallPath)) && !ImGui::IsPopupOpen("Select Engine Install"))
{
ImGui::OpenPopup("Select Hazel Install");
ImGui::OpenPopup("Select Engine Install");
m_Properties.InstallPath.reserve(MAX_PROJECT_FILEPATH_LENGTH);
}

ImVec2 center = ImGui::GetMainViewport()->GetCenter();
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
ImGui::SetNextWindowSize(ImVec2(700, 0));
if (ImGui::BeginPopupModal("Select Hazel Install", 0, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize))
if (ImGui::BeginPopupModal("Select Engine Install", 0, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize))
{
ImGui::PushFont(boldFont);
ImGui::TextUnformatted("Failed to find an appropiate Hazel installation!");
ImGui::TextUnformatted("Failed to find an appropiate Engine installation!");
ImGui::PopFont();

ImGui::TextWrapped("Please select the root folder for the Hazel version you want to use (E.g C:/Dev/Hazel-dev).You should be able to find a file called premake5.lua in the root folder. The install you select will be used when creating new projects.");
ImGui::TextWrapped("Please select the root folder for the Engine version you want to use (E.g C:/Dev/Engine-dev).You should be able to find a file called premake5.lua in the root folder. The install you select will be used when creating new projects.");

ImGui::Dummy(ImVec2(0, 8));

Expand All @@ -99,7 +99,7 @@ namespace Hazel {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2, 10));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 6));
ImGui::SetNextItemWidth(700 - button_size.x - style.FramePadding.x * 2.0f - style.ItemInnerSpacing.x - 1);
ImGui::InputTextWithHint("##hazel_install_location", "C:/Dev/Hazel-dev/", m_Properties.InstallPath.data(), MAX_PROJECT_FILEPATH_LENGTH, ImGuiInputTextFlags_ReadOnly);
ImGui::InputTextWithHint("##engine_install_location", "C:/Dev/Engine-dev/", m_Properties.InstallPath.data(), MAX_PROJECT_FILEPATH_LENGTH, ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine();
if (ImGui::Button("..."))
{
Expand All @@ -109,7 +109,7 @@ namespace Hazel {

if (ImGui::Button("Confirm"))
{
bool success = FileSystem::SetEnvironmentVariable("HAZEL_DIR", m_Properties.InstallPath);
bool success = FileSystem::SetEnvironmentVariable("ENGINE_DIR", m_Properties.InstallPath);
ZONG_CORE_ASSERT(success, "Failed to set Environment Variable!");
ImGui::CloseCurrentPopup();
}
Expand All @@ -136,7 +136,7 @@ namespace Hazel {
float imageSize = 160.0f;

ImGui::SetCursorPosY(-40.0f);
UI::Image(m_HazelLogoTexture, ImVec2(imageSize, imageSize));
UI::Image(m_EngineLogoTexture, ImVec2(imageSize, imageSize));

ImGui::Separator();
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + imageSize / 3.0f);
Expand Down Expand Up @@ -249,7 +249,7 @@ namespace Hazel {

if (ImGui::Button("Open Project...", ImVec2(buttonWidth, 50)))
{
std::string result = FileSystem::OpenFileDialog({ { "Hazel Project", "hproj" } }).string();
std::string result = FileSystem::OpenFileDialog({ { "Engine Project", "hproj" } }).string();
AddProjectToRecents(result);
s_ProjectToOpen = result;
}
Expand Down
12 changes: 6 additions & 6 deletions Editor-Launcher/src/LauncherLayer.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#pragma once

#include <Hazel/Core/Layer.h>
#include <Hazel/Core/Ref.h>
#include <Hazel/Project/UserPreferences.h>
#include <Hazel/Renderer/Texture.h>
#include <Engine/Core/Layer.h>
#include <Engine/Core/Ref.h>
#include <Engine/Project/UserPreferences.h>
#include <Engine/Renderer/Texture.h>

#include <imgui/imgui.h>

#include <filesystem>
#include <functional>

namespace Hazel {
namespace Engine {

struct LauncherProperties
{
Expand All @@ -37,7 +37,7 @@ namespace Hazel {
private:
LauncherProperties m_Properties;
ImGuiID m_HoveredProjectID;
Ref<Texture2D> m_HazelLogoTexture;
Ref<Texture2D> m_EngineLogoTexture;
};

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off
pushd %~dp0
call %HAZEL_DIR%\vendor\bin\premake5.exe vs2022
call %ENGINE_DIR%\vendor\bin\premake5.exe vs2022
popd
16 changes: 8 additions & 8 deletions Editor/Resources/NewProjectTemplate/premake5.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
HazelRootDirectory = os.getenv("HAZEL_DIR")
include (path.join(HazelRootDirectory, "Editor", "Resources", "LUA", "Engine.lua"))
EngineRootDirectory = os.getenv("ENGINE_DIR")
include (path.join(EngineRootDirectory, "Editor", "Resources", "LUA", "Engine.lua"))

workspace "$PROJECT_NAME$"
targetdir "build"
Expand All @@ -12,20 +12,20 @@ workspace "$PROJECT_NAME$"
"Dist"
}

group "Hazel"
group "Engine"
project "Engine-ScriptCore"
location "%{HazelRootDirectory}/Engine-ScriptCore"
location "%{EngineRootDirectory}/Engine-ScriptCore"
kind "SharedLib"
language "C#"
dotnetframework "4.7.2"

targetdir ("%{HazelRootDirectory}/Editor/Resources/Scripts")
objdir ("%{HazelRootDirectory}/Editor/Resources/Scripts/Intermediates")
targetdir ("%{EngineRootDirectory}/Editor/Resources/Scripts")
objdir ("%{EngineRootDirectory}/Editor/Resources/Scripts/Intermediates")

files
{
"%{HazelRootDirectory}/Engine-ScriptCore/Source/**.cs",
"%{HazelRootDirectory}/Engine-ScriptCore/Properties/**.cs"
"%{EngineRootDirectory}/Engine-ScriptCore/Source/**.cs",
"%{EngineRootDirectory}/Engine-ScriptCore/Properties/**.cs"
}

filter "configurations:Debug"
Expand Down
2 changes: 1 addition & 1 deletion Editor/Resources/Templates/NewClassTemplate.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Hazel;
using Engine;

namespace $NAMESPACE_NAME$
{
Expand Down
6 changes: 3 additions & 3 deletions Editor/SandboxProject/Assets/AssetRegistry.hzr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Assets:
FilePath: Scripts/Source/.history/ThirdPerson_20241103151125.cs
Type: ScriptFile
- Handle: 689039470629100212
FilePath: Meshes/Source/HazelText.gltf
FilePath: Meshes/Source/EngineText.gltf
Type: MeshSource
- Handle: 764190760845490054
FilePath: Meshes/Source/Default/Cube.gltf
Expand Down Expand Up @@ -396,7 +396,7 @@ Assets:
FilePath: Meshes/Source/Default/Sphere.gltf
Type: MeshSource
- Handle: 6090468609339042727
FilePath: Materials/HazelText.hmaterial
FilePath: Materials/EngineText.hmaterial
Type: Material
- Handle: 6092368092518963256
FilePath: Meshes/Source/Sponza/16299174074766089871.jpg
Expand Down Expand Up @@ -1062,7 +1062,7 @@ Assets:
FilePath: Scripts/Source/.history/Projectile_20241103151121.cs
Type: ScriptFile
- Handle: 16902489934535872374
FilePath: Meshes/HazelText.hsmesh
FilePath: Meshes/EngineText.hsmesh
Type: StaticMesh
- Handle: 16947718648921030200
FilePath: Scripts/Source/Flocking/BoidSettings.cs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"buffers" : [
{
"byteLength" : 1200856,
"uri" : "HazelText.bin"
"uri" : "EngineText.bin"
}
]
}
2 changes: 1 addition & 1 deletion Editor/SandboxProject/Assets/scenes/PrefabSandbox.hscene
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Entities:
Range: 9.89999962
- Entity: 2966624095258384198
TagComponent:
Tag: HazelText
Tag: EngineText
Parent: 0
Children:
[]
Expand Down
2 changes: 1 addition & 1 deletion Editor/SandboxProject/Assets/scenes/SponzaDemo.hscene
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Entities:
Primary: true
- Entity: 11081956374634559166
TagComponent:
Tag: HazelText
Tag: EngineText
Parent: 0
Children:
[]
Expand Down
2 changes: 1 addition & 1 deletion Editor/SandboxProject/Assets/scenes/levels/Platformer.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Entities:
Type: 1
Data: 3
MeshComponent:
AssetPath: C:\Dev\Hazel\dev\Editor\assets\meshes\Cube1m.fbx
AssetPath: C:\Dev\Engine\dev\Editor\assets\meshes\Cube1m.fbx
RigidBody2DComponent:
BodyType: 1
FixedRotation: true
Expand Down
2 changes: 1 addition & 1 deletion Editor/SandboxProject/Win-CreateScriptProjects.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off
pushd %~dp0
call %HAZEL_DIR%\vendor\bin\premake5.exe vs2022
call %ENGINE_DIR%\vendor\bin\premake5.exe vs2022
popd
4 changes: 2 additions & 2 deletions Engine-Launcher/Engine-Launcher.rc
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "Studio Cherno"
VALUE "CompanyName", "Zong"
VALUE "FileDescription", "Saving Captain Cino Launcher"
VALUE "FileVersion", "1.0.0.0"
VALUE "LegalCopyright", "� Studio Cherno"
VALUE "LegalCopyright", "� Zong"
VALUE "ProductName", "Saving Captain Cino Launcher"
VALUE "ProductVersion", "1.0.0.0"
END
Expand Down
8 changes: 4 additions & 4 deletions Engine-Runtime/Engine-Runtime.rc
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "Studio Cherno"
VALUE "FileDescription", "Saving Captain Coffee - a game by Studio Cherno"
VALUE "CompanyName", "Zong"
VALUE "FileDescription", "Saving Captain Coffee - a game by Zong"
VALUE "FileVersion", "1.3.0.0"
VALUE "LegalCopyright", "� Studio Cherno"
VALUE "ProductName", "Saving Captain Coffee - a game by Studio Cherno"
VALUE "LegalCopyright", "� Zong"
VALUE "ProductName", "Saving Captain Coffee - a game by Zong"
VALUE "ProductVersion", "1.3.0.0"
END
END
Expand Down
Loading

0 comments on commit dceffcf

Please sign in to comment.