summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp
diff options
context:
space:
mode:
author Branimir Karadžić <branimirkaradzic@gmail.com>2016-05-03 12:20:29 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-05-03 12:20:29 +0200
commitf97b68d3ed8312f0800fc0e501ad0174a968d3e9 (patch)
treebf876c8732bd657d05908876ae88e1736f306610 /3rdparty/bgfx/examples/00-helloworld/helloworld.cpp
parentf2aca844f6bbfcc0d1284d6dd546cd552cbe0a92 (diff)
Update GENie, BGFX and BX (nw)
Diffstat (limited to '3rdparty/bgfx/examples/00-helloworld/helloworld.cpp')
-rw-r--r--3rdparty/bgfx/examples/00-helloworld/helloworld.cpp191
1 files changed, 14 insertions, 177 deletions
diff --git a/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp b/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp
index e2e8a599a15..92996ae0314 100644
--- a/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp
+++ b/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp
@@ -7,7 +7,6 @@
#include "common.h"
#include "bgfx_utils.h"
#include "logo.h"
-#include "imgui/imgui.h"
class ExampleHelloWorld : public entry::AppI
{
@@ -29,111 +28,23 @@ class ExampleHelloWorld : public entry::AppI
// Set view 0 clear state.
bgfx::setViewClear(0
, BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
- , 0x000000ff
+ , 0x303030ff
, 1.0f
, 0
);
- imguiCreate();
- ImGui::GetIO().FontGlobalScale = 1.5;
}
virtual int shutdown() BX_OVERRIDE
{
- // Cleanup.
- imguiDestroy();
-
// Shutdown bgfx.
bgfx::shutdown();
return 0;
}
- void displayMainMenu()
- {
- if (ImGui::BeginMainMenuBar())
- {
- if (ImGui::BeginMenu("Left"))
- {
- if (ImGui::MenuItem("Brief", "CTRL+1")) {}
- if (ImGui::MenuItem("Medium", "CTRL+2")) {}
- if (ImGui::MenuItem("Two columns", "CTRL+3")) {}
- if (ImGui::MenuItem("Full (name)", "CTRL+4")) {}
- if (ImGui::MenuItem("Full (size, time)", "CTRL+5")) {}
- if (ImGui::MenuItem("Full (access)", "CTRL+6")) {}
- ImGui::Separator();
- if (ImGui::BeginMenu("Sort mode"))
- {
- ImGui::MenuItem("Name");
- ImGui::MenuItem("Extension");
- ImGui::MenuItem("Modif. Time");
- ImGui::MenuItem("Size");
- ImGui::MenuItem("Unsorted");
- ImGui::EndMenu();
- }
- if (ImGui::MenuItem("Change source")) {}
- ImGui::EndMenu();
- }
- if (ImGui::BeginMenu("Files"))
- {
- if (ImGui::MenuItem("User menu", "F2")) {}
- if (ImGui::MenuItem("View", "F3")) {}
- if (ImGui::MenuItem("Edit", "F4")) {}
- if (ImGui::MenuItem("Copy", "F5")) {}
- if (ImGui::MenuItem("Rename or move", "F6")) {}
- if (ImGui::MenuItem("Make directory", "F7")) {}
- if (ImGui::MenuItem("Delete", "F8")) {}
- ImGui::Separator();
- if (ImGui::MenuItem("File attributes", "CTRL+A")) {}
- if (ImGui::MenuItem("Apply command", "CTRL+G")) {}
- ImGui::Separator();
- if (ImGui::MenuItem("Select group")) {}
- if (ImGui::MenuItem("Unselect group")) {}
- if (ImGui::MenuItem("Invert selection")) {}
- ImGui::EndMenu();
- }
- if (ImGui::BeginMenu("Commands"))
- {
- if (ImGui::MenuItem("Find file", "ALT+F7")) {}
- if (ImGui::MenuItem("History", "ALT+F8")) {}
- if (ImGui::MenuItem("Maximize window", "ALT+F9")) {}
- ImGui::Separator();
- if (ImGui::MenuItem("Panel on/off", "CTRL+O")) {}
- if (ImGui::MenuItem("Equal panels", "CTRL+=")) {}
- ImGui::EndMenu();
- }
- if (ImGui::BeginMenu("Options"))
- {
- if (ImGui::MenuItem("Settings")) {}
- ImGui::EndMenu();
- }
- if (ImGui::BeginMenu("Right"))
- {
- if (ImGui::MenuItem("Brief", "CTRL+1")) {}
- if (ImGui::MenuItem("Medium", "CTRL+2")) {}
- if (ImGui::MenuItem("Two columns", "CTRL+3")) {}
- if (ImGui::MenuItem("Full (name)", "CTRL+4")) {}
- if (ImGui::MenuItem("Full (size, time)", "CTRL+5")) {}
- if (ImGui::MenuItem("Full (access)", "CTRL+6")) {}
- ImGui::Separator();
- if (ImGui::BeginMenu("Sort mode"))
- {
- ImGui::MenuItem("Name");
- ImGui::MenuItem("Extension");
- ImGui::MenuItem("Modif. Time");
- ImGui::MenuItem("Size");
- ImGui::MenuItem("Unsorted");
- ImGui::EndMenu();
- }
- if (ImGui::MenuItem("Change source")) {}
- ImGui::EndMenu();
- }
- ImGui::EndMainMenuBar();
- }
- }
-
bool update() BX_OVERRIDE
{
- if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) )
+ if (!entry::processEvents(m_width, m_height, m_debug, m_reset) )
{
// Set view 0 default viewport.
bgfx::setViewRect(0, 0, 0, m_width, m_height);
@@ -142,91 +53,18 @@ class ExampleHelloWorld : public entry::AppI
// if no other draw calls are submitted to view 0.
bgfx::touch(0);
- imguiBeginFrame(m_mouseState.m_mx
- , m_mouseState.m_my
- , (m_mouseState.m_buttons[entry::MouseButton::Left] ? IMGUI_MBUT_LEFT : 0)
- | (m_mouseState.m_buttons[entry::MouseButton::Right] ? IMGUI_MBUT_RIGHT : 0)
- , m_mouseState.m_mz
- , m_width
- , m_height
- );
- displayMainMenu();
- ImGui::SetNextWindowPos(ImVec2(0, 32));
- ImGui::SetNextWindowSize(ImVec2(m_width/2, m_height - 32));
- if (ImGui::Begin("Window1", nullptr, ImVec2(m_width/2, m_height-32), 1.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar))
- {
- ImGui::PushStyleVar(ImGuiStyleVar_ChildWindowRounding, 5.0f);
- ImGui::BeginChild("Sub1", ImVec2(0, m_height - 48), true);
-
-
- ImGui::Columns(4, "mycolumns");
- ImGui::Separator();
- ImGui::Text("ID"); ImGui::NextColumn();
- ImGui::Text("Name"); ImGui::NextColumn();
- ImGui::Text("Path"); ImGui::NextColumn();
- ImGui::Text("Flags"); ImGui::NextColumn();
- ImGui::Separator();
- const char* names[3] = { "One", "Two", "Three" };
- const char* paths[3] = { "/path/one", "/path/two", "/path/three" };
- static int selected = -1;
- for (int i = 0; i < 50; i++)
- {
- char label[32];
- sprintf(label, "%04d", i);
- if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SpanAllColumns))
- selected = i;
- ImGui::NextColumn();
- ImGui::Text(names[i%3]); ImGui::NextColumn();
- ImGui::Text(paths[i % 3]); ImGui::NextColumn();
- ImGui::Text("...."); ImGui::NextColumn();
- }
- ImGui::Columns(1);
- ImGui::Separator();
-
-
-
- ImGui::EndChild();
- ImGui::PopStyleVar();
- }
- ImGui::End();
- ImGui::SameLine();
- ImGui::SetNextWindowPos(ImVec2(m_width / 2, 32));
- ImGui::SetNextWindowSize(ImVec2(m_width / 2, m_height - 32));
- if (ImGui::Begin("Window2", nullptr, ImVec2(m_width/2, m_height - 32), 1.0f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar))
- {
- ImGui::PushStyleVar(ImGuiStyleVar_ChildWindowRounding, 5.0f);
- ImGui::BeginChild("Sub2", ImVec2(0, m_height - 48), true);
-
- ImGui::Columns(4, "mycolumns");
- ImGui::Separator();
- ImGui::Text("ID"); ImGui::NextColumn();
- ImGui::Text("Name"); ImGui::NextColumn();
- ImGui::Text("Path"); ImGui::NextColumn();
- ImGui::Text("Flags"); ImGui::NextColumn();
- ImGui::Separator();
- const char* names[3] = { "One", "Two", "Three" };
- const char* paths[3] = { "/path/one", "/path/two", "/path/three" };
- static int selected = -1;
- for (int i = 0; i < 3; i++)
- {
- char label[32];
- sprintf(label, "%04d", i);
- if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SpanAllColumns))
- selected = i;
- ImGui::NextColumn();
- ImGui::Text(names[i]); ImGui::NextColumn();
- ImGui::Text(paths[i]); ImGui::NextColumn();
- ImGui::Text("...."); ImGui::NextColumn();
- }
- ImGui::Columns(1);
- ImGui::Separator();
-
-
- ImGui::EndChild();
- ImGui::PopStyleVar();
- }
- ImGui::End();
- imguiEndFrame();
+ // Use debug font to print information about this example.
+ bgfx::dbgTextClear();
+ bgfx::dbgTextImage(bx::uint16_max(m_width /2/8, 20)-20
+ , bx::uint16_max(m_height/2/16, 6)-6
+ , 40
+ , 12
+ , s_logo
+ , 160
+ );
+ bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/00-helloworld");
+ bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Initialization and debug text.");
+
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
@@ -241,7 +79,6 @@ class ExampleHelloWorld : public entry::AppI
uint32_t m_height;
uint32_t m_debug;
uint32_t m_reset;
- entry::MouseState m_mouseState;
};
ENTRY_IMPLEMENT_MAIN(ExampleHelloWorld);