Jump to content
  • Advertisement

Jman2

Member
  • Content Count

    69
  • Joined

  • Last visited

Community Reputation

157 Neutral

About Jman2

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, Im currently hashing states like the code sample below, is there a more elegant way of doing this? or should i just cache the hash in the struct and default 0 as being "null" and hope i dont get a collision where one eventrually resolves to 0. struct RASTERIZER_DESC { FILL_MODE m_FillMode = FILL_SOLID; CULL_MODE m_CullMode = CULL_BACK; VERTEX_WIND_ORDER m_VertexWind = WIND_FRONT_CLOCKWISE; int m_DepthBias = 0; float m_DepthBiasClamp = 0.0f; float m_SlopeScaledDepthBias = 0.0f; bool m_DepthClipEnable = true; bool m_MultisampleEnable = false; bool m_AntialiasedLineEnable = false; Uint32 GetHash()const { Uint32 hash = 23; hash = hash * 31 + (Uint32)m_FillMode; hash = hash * 31 + (Uint32)m_CullMode; hash = hash * 31 + (Uint32)m_VertexWind; hash = hash * 31 + (Uint32)m_DepthBias; hash = hash * 31 + (Uint32)m_DepthBiasClamp; hash = hash * 31 + (Uint32)m_SlopeScaledDepthBias; hash = hash * 31 + (Uint32)m_DepthClipEnable; hash = hash * 31 + (Uint32)m_MultisampleEnable; hash = hash * 31 + (Uint32)m_AntialiasedLineEnable; return hash; } };
  2. Jman2

    Dear ImGui State Management

    Yes my engine has a similar set up, i have an void OnGui() that is called, i have a ImGui Manager that initialize the frame based on the graphics version and os platform etc. So mostly just figuring out how most do there managment of the actual GUI for sophisticated apps like Level Editors as opposed to in game debug etc. virtual bool Initialize() = 0; virtual void LoadContent() = 0; virtual void Update(Time time) = 0; virtual void Draw() = 0; virtual void OnGui() = 0; virtual void ShutDown() = 0;
  3. Hello, Just wondering how others have managed there GUI state when using ImGui, it seems as though you will end up with huge if else branches or switch cases to resolve the state of the dialog essentially a big state machine... // WinForm private void button1_Click(object sender, System.EventArgs e) { Stream myStream ; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); if(saveFileDialog1.ShowDialog() == DialogResult.OK) { // Create a File } } // My ImGui Guess if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("New")) { m_FileDialog.Open("New Project"); m_UIState = UIState::New_File_Dialog; } ImGui::EndMenu(); } if (ImGui::BeginMenu("Build")) { if (ImGui::MenuItem("Build")) { m_UIState = UIState::Build_Dialog; } ImGui::EndMenu(); } ImGui::EndMainMenuBar(); // Current State, If Else or Switch etc? if(m_UIState == UIState::New_File_Dialog) { // Do the New File dialog if(m_FileDialog.ShowDialog() == DialogResult::OK) { // Create file. } } else if (m_UIState == UIState::Build_Dialog) { // Do the Build Dialog } Thanks,
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!