Skip to content

Commit

Permalink
Removed more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniPlays committed Jan 4, 2022
1 parent 005b51e commit bb152b4
Show file tree
Hide file tree
Showing 18 changed files with 253 additions and 2,435 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions Hazard/src/Hazard/Core/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Hazard
void Allocate(uint32_t size)
{
if(Data != nullptr)
delete[] Data;
free(Data);

Data = nullptr;

Expand All @@ -24,7 +24,7 @@ namespace Hazard
}
void Release()
{
delete[] Data;
free(Data);
Data = nullptr;
Size = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions HazardEditor/src/GUI/EditorTabWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace WindowElement {

void OnRender() override;
virtual void Render() = 0;
virtual bool OnEvent(Event& e) = 0;
virtual bool OnEvent(Event& e) override = 0;

const std::vector<RenderableElement*>& GetElements() { return m_Elements; }

Expand Down Expand Up @@ -53,4 +53,4 @@ namespace WindowElement {
std::vector<RenderableElement*> m_Elements = std::vector<RenderableElement*>();
std::string m_Title;
};
}
}
2 changes: 2 additions & 0 deletions HazardEditor/src/GUI/EditorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ namespace WindowElement {
m_Renderer = new EditorPlatformVulkan(nativeWindow, context);
break;
#endif
default:
break;
}
}
bool EditorView::OnWindowFocus(WindowFocusEvent& e)
Expand Down
6 changes: 3 additions & 3 deletions HazardEditor/src/GUI/EditorView.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace WindowElement {
EditorView();
~EditorView() = default;

void Init();
void Init() override;
void Update() override;
void Render() override;
bool OnEvent(Hazard::Event& e);
bool OnEvent(Hazard::Event& e) override;

void Close() override;

Expand Down Expand Up @@ -75,4 +75,4 @@ namespace WindowElement {
EditorGuiPlatform* m_Renderer = nullptr;
Rendering::RenderContext* m_Context = nullptr;
};
}
}
4 changes: 1 addition & 3 deletions HazardEditor/src/GUI/EditorWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ namespace WindowElement {


void OnRender() override;
virtual void Init() {};
virtual void OnWindowRender() = 0;
virtual void OnBeforeRender() {};
virtual void OnAfterRender() {};
virtual bool OnEvent(Hazard::Event& e) override { return false; };

bool IsActive() { return m_Active; }
bool IsFocused() { return m_Focused; }
Expand All @@ -35,4 +33,4 @@ namespace WindowElement {

ImGuiWindowFlags m_Flags;
};
}
}
2 changes: 1 addition & 1 deletion HazardEditor/src/GUI/RenderableElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ namespace WindowElement
virtual void OnRender() {};
virtual bool OnEvent(Hazard::Event& e) { return false; };
};
}
}
3 changes: 1 addition & 2 deletions HazardEditor/src/GUI/Window/Editor/WelcomePopup.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace WindowElement {
~WelcomePopup() = default;

void OnWindowRender() override;
virtual void Init() {};
virtual bool OnEvent(Hazard::Event& e) override;

private:
Expand All @@ -20,4 +19,4 @@ namespace WindowElement {
private:
const char* m_Title = "Popup";
};
}
}
6 changes: 4 additions & 2 deletions HazardEditor/src/GUI/Window/Inspect/FileView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ namespace WindowElement {
case Hazard::AssetType::Image: return Style::ColorAsImVec4(Style::GetStyleColor(ColorType::Critical));
case Hazard::AssetType::EnvironmentMap: return Style::ColorAsImVec4(Style::GetStyleColor(ColorType::Primary));
case Hazard::AssetType::PhysicsMaterial: return Style::ColorAsImVec4(Style::GetStyleColor(ColorType::Primary));
default: return Style::ColorAsImVec4(Style::GetStyleColor(ColorType::Text));
}
}
Ref<Rendering::Texture2D> FileView::GetFileImageFromType(const AssetMetadata& metadata)
Expand All @@ -218,9 +219,10 @@ namespace WindowElement {
case Hazard::AssetType::AudioClip:
case Hazard::AssetType::EnvironmentMap:
case Hazard::AssetType::PhysicsMaterial:
return m_Images["folder"];
return m_Images["logo"];
default:
return m_Images["logo"];
}
return m_Images["logo"];
}
void FileView::UpdateFolderData()
{
Expand Down
4 changes: 2 additions & 2 deletions HazardEditor/src/GUI/Window/Inspect/Properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace WindowElement {
Properties();
~Properties() = default;

void Init();
void Init() override;
void OnUpdate() override;
void OnWindowRender() override;
bool OnEvent(Event& e) override;
Expand All @@ -24,4 +24,4 @@ namespace WindowElement {
Hazard::ECS::Entity m_SelectionContext;
bool m_Locked = false;
};
}
}
3 changes: 1 addition & 2 deletions HazardEditor/src/Library/DragDropUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once

#include <hzrpch.h>
#include "DragDropUtils.h"
Expand Down Expand Up @@ -35,4 +34,4 @@ namespace WindowElement
if (ext == "obj") return "Mesh";
return "HAZARD_NULL";
}
}
}
7 changes: 4 additions & 3 deletions HazardEditor/src/Library/Input.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once

#include "Input.h"
#include "Style.h"
Expand Down Expand Up @@ -405,7 +404,7 @@ namespace WindowElement {

if (meta.Has<HeaderAttribute>()) {
Style::SelectFont(1);
ImGui::Text(meta.Get<HeaderAttribute>().Header.c_str());
ImGui::Text("%s", meta.Get<HeaderAttribute>().Header.c_str());
ImGui::PopFont();
}

Expand All @@ -417,7 +416,9 @@ namespace WindowElement {
if (modified)
field->SetValue<float>(value, runtime);
}
default:
return false;
}
return modified;
}
}
}
2 changes: 0 additions & 2 deletions HazardEditor/src/Library/Layout/ContextMenus.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once


#include "ContextMenus.h"
#include "Layout.h"
Expand Down
3 changes: 1 addition & 2 deletions HazardEditor/src/Library/Layout/Dockspace.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once

#include "Dockspace.h"

Expand Down Expand Up @@ -334,4 +333,4 @@ namespace ImGui
return TreeNodeWithIcon(icon, window->GetID(label), flags, label, NULL, iconTint);
}

}
}
4 changes: 2 additions & 2 deletions HazardEditor/src/Library/Layout/Layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ namespace WindowLayout
}
void Layout::Text(const std::string& text)
{
ImGui::Text(text.c_str());
ImGui::Text("%s", text.c_str());
}
void Layout::TextColored(const char* text, const Color& color)
{
ImGui::TextColored(Style::ColorAsImVec4(color), text);
ImGui::TextColored(Style::ColorAsImVec4(color), "%s", text);
}
void Layout::NextLine(float height)
{
Expand Down
2 changes: 1 addition & 1 deletion HazardEditor/src/Library/Layout/Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace WindowLayout
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2{ 4, 4 });
float lineHeight = GImGui->Font->FontSize + GImGui->Style.FramePadding.y * 2.0f;
ImGui::Separator();
bool open = ImGui::TreeNodeEx((void*)name, flags, name);
bool open = ImGui::TreeNodeEx((void*)name, flags, "%s", name);
bool removed = false;
ImGui::PopStyleVar();

Expand Down
2 changes: 1 addition & 1 deletion HazardEditor/src/Library/Style.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once

#include "Style.h"

Expand Down Expand Up @@ -63,6 +62,7 @@ ImVec4 Style::AssetTypeColor(Hazard::AssetType type)
case AssetType::Mesh: return ColorAsImVec4(GetStyleColor(ColorType::Info));
case AssetType::PhysicsMaterial: return ColorAsImVec4(GetStyleColor(ColorType::Primary));
case AssetType::EnvironmentMap: return ColorAsImVec4(Style::GetStyleColor(ColorType::Trace));
default: return ColorAsImVec4(GetStyleColor(ColorType::Text));
}
}
ImGuiTreeNodeFlags Style::GetTreeNodeDefaultFlags()
Expand Down
Loading

0 comments on commit bb152b4

Please sign in to comment.