25 #include <glm/gtc/matrix_transform.hpp> 
   35 std::list<std::tuple<unsigned int, unsigned int, KeyboardButton, bool>> 
UI::clickEvents;
 
   87     unsigned char* pixels;
 
  151     static unsigned long lastTime = 0;
 
  163                                     std::get<2>(i), std::get<3>(i));
 
  178         if (std::get<1>(i)) {
 
  249     static bool showTestWindow = 
false;
 
  250     static bool showStyleWindow = 
false;
 
  261                 showTestWindow = !showTestWindow;
 
  265                 showStyleWindow = !showStyleWindow;
 
  271             static int index = 0;
 
  274             static glm::mat4 MVP(1.0f);
 
  275             static bool dirty = 
true, redraw = 
false;
 
  276             static float zoom = 1.0f;
 
  291                 static glm::mat4 projection = glm::perspective(45.0f, 1.0f, 0.1f, 2000.0f);
 
  293                 glm::mat4 rotateX = glm::rotate(glm::mat4(1.0f), rot[0], glm::vec3(1.0f, 0.0f, 0.0f));
 
  294                 glm::mat4 rotateY = glm::rotate(glm::mat4(1.0f), rot[1], glm::vec3(0.0f, 1.0f, 0.0f));
 
  295                 glm::mat4 rotateZ = glm::rotate(glm::mat4(1.0f), rot[2], glm::vec3(0.0f, 0.0f, 1.0f));
 
  296                 glm::mat4 rotate = rotateZ * rotateX * rotateY;
 
  297                 glm::mat4 translate = glm::translate(glm::mat4(1.0f), glm::vec3(pos[0], pos[1], pos[2]));
 
  299                 glm::mat4 view = rotate * translate;
 
  300                 glm::mat4 
scale = 
glm::scale(glm::mat4(1.0f), glm::vec3(zoom, zoom, zoom));
 
  301                 MVP = projection * view * 
scale;
 
  307             if ((index >= 0) && (index < 
getWorld().sizeSkeletalModel())) {
 
  309                 if ((sm.size() > 0) && (sm.get(0).size() > 0)) {
 
  320                     if ((st != 
nullptr) && redraw) {
 
  322                         sm.display(MVP, 0, 0, st);
 
  327                     ImGui::Text(
"Selected SkeletalModel has no animation/frame!");
 
  372     while (*text != 
'\0') {
 
  393     clickEvents.push_back(std::make_tuple(x, y, button, released));
 
  400     motionEvents.push_back(std::make_tuple(xrel, yrel, xabs, yabs));
 
  421         } 
else if (button == 
padUp) {
 
  423         } 
else if (button == 
padDown) {
 
  425         } 
else if (button == 
padLeft) {
 
  436         } 
else if (button == 
bButton) {
 
  438         } 
else if (button == 
xButton) {
 
  440         } 
else if (button == 
yButton) {
 
  442         } 
else if (button == 
padUp) {
 
  444         } 
else if (button == 
padDown) {
 
  446         } 
else if (button == 
padLeft) {
 
  460     if (cmd_lists_count == 0)
 
  465     glEnable(GL_SCISSOR_TEST);
 
  479     for (
int i = 0; i < cmd_lists_count; i++) {
 
  480         auto& commands = cmd_lists[i]->
commands;
 
  484         for (
int n = 0; n < commands.size(); n++) {
 
  485             std::vector<glm::vec2> vertices;
 
  486             std::vector<glm::vec2> uvs;
 
  487             std::vector<glm::vec4> colors;
 
  489             for (
int v = 0; v < commands[n].vtx_count; v++) {
 
  490                 vertices.push_back(glm::vec2(buffer[offset + v].pos.x, buffer[offset + v].pos.y));
 
  491                 uvs.push_back(glm::vec2(buffer[offset + v].uv.x, buffer[offset + v].uv.y));
 
  494                 a = ((buffer[offset + v].col & 0xFF000000) >> 24) / 255.0f;
 
  495                 b = ((buffer[offset + v].col & 0x00FF0000) >> 16) / 255.0f;
 
  496                 g = ((buffer[offset + v].col & 0x0000FF00) >> 8) / 255.0f;
 
  497                 r = (buffer[offset + v].col & 0x000000FF) / 255.0f;
 
  498                 colors.push_back(glm::vec4(r, g, b, a));
 
  501             offset += commands[n].vtx_count;
 
  507             auto bm = 
static_cast<BufferManager*
>(commands[n].texture_id);
 
  511             glScissor(commands[n].clip_rect.x,
 
  513                       commands[n].clip_rect.z - commands[n].clip_rect.x,
 
  514                       commands[n].clip_rect.w - commands[n].clip_rect.y);
 
  516             glDrawArrays(GL_TRIANGLES, 0, vertices.size());
 
  525     glDisable(GL_SCISSOR_TEST);
 
  534 layout(location = 0) in vec2 vertexPosition_screen; 
  535 layout(location = 1) in vec2 vertexUV; 
  536 layout(location = 2) in vec4 vertexColor; 
  544     vec2 halfScreen = screen / 2; 
  545     vec2 vertexPosition_homogenous = (vertexPosition_screen - halfScreen) / halfScreen; 
  547     gl_Position = vec4(vertexPosition_homogenous.x, -vertexPosition_homogenous.y, 0, 1); 
  549     FragColor = vertexColor; 
  561 uniform sampler2D textureSampler; 
  564     color = texture(textureSampler, UV) * FragColor; 
static std::string logFilename
static void handleMouseScroll(int xrel, int yrel)
void bufferData(int elem, int size, void *data)
IMGUI_API ImVec2 GetWindowSize()
IMGUI_API bool CollapsingHeader(const char *label, const char *str_id=NULL, bool display_frame=true, bool default_open=false)
static const char * imguiShaderFragment
static std::list< std::tuple< int, int > > scrollEvents
IMGUI_API void SetWindowPos(const ImVec2 &pos, ImGuiSetCond cond=0)
static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs)
static void setClipboard(const char *s)
static void handleControllerAxis(float value, KeyboardButton axis)
IMGUI_API void GetTexDataAsRGBA32(unsigned char **out_pixels, int *out_width, int *out_height, int *out_bytes_per_pixel=NULL)
static void handleControllerAxis(float value, KeyboardButton axis)
static void handleControllerButton(KeyboardButton button, bool released)
void(* SetClipboardTextFn)(const char *text)
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
static std::list< std::tuple< KeyboardButton, bool > > keyboardEvents
static glm::vec3 getPosition()
IMGUI_API void Shutdown()
static std::string getBaseDir()
static Shader imguiShader
void loadUniform(int uni, glm::vec2 vec)
static const char * imguiShaderVertex
static LogLevel & get(int level)
int compile(const char *vertex, const char *fragment)
static const char * getClipboard()
static unsigned int fontTex
static bool getTextInput()
static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs)
static std::string iniFilename
const char *(* GetClipboardTextFn)()
static void setTextInput(bool t)
static unsigned long getFPS()
static bool getMousegrab()
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0), bool repeat_when_held=false)
static void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released)
void(* RenderDrawListsFn)(ImDrawList **const draw_lists, int count)
ImVector< ImDrawCmd > commands
IMGUI_API float GetColumnWidth(int column_index=-1)
IMGUI_API bool SliderFloat3(const char *label, float v[3], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
static BufferManager * getBufferManager(int tex, TextureStorage store)
static std::list< std::tuple< int, int, int, int > > motionEvents
IMGUI_API ImGuiIO & GetIO()
static void handleAction(ActionEvents action, bool isFinished)
SkeletalModel & getSkeletalModel(unsigned long index)
IMGUI_API ImGuiStyle & GetStyle()
Runtime Configuration Storage. 
IMGUI_API void SameLine(int column_x=0, int spacing_w=-1)
IMGUI_API void ShowStyleEditor(ImGuiStyle *ref=NULL)
static KeyboardButton getKeyBinding(ActionEvents event)
IMGUI_API void ShowUserGuide()
ImVector< ImDrawVert > vtx_buffer
static void inputPositionCallback(int x, int y)
static void handleKeyboard(KeyboardButton key, bool pressed)
static void renderImGui(ImDrawList **const draw_lists, int count)
ImVec4 Colors[ImGuiCol_COUNT]
IMGUI_API void Text(const char *fmt,...)
int addUniform(const char *name)
IMGUI_API void Separator()
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
static glm::vec2 getRotation()
static void setMousegrab(bool g)
static bool metaKeyIsActive
static std::list< std::tuple< unsigned int, unsigned int, KeyboardButton, bool > > clickEvents
IMGUI_API void NewFrame()
static void setVisible(bool v)
static int loadBufferSlot(unsigned char *image=nullptr, unsigned int width=256, unsigned int height=256, ColorMode mode=ColorMode::RGBA, unsigned int bpp=32, TextureStorage s=TextureStorage::GAME, int slot=-1, bool filter=true)
Loads Buffer as texture. 
static void eventsFinished()
static void handleText(char *text, bool notFinished)
IMGUI_API void ShowTestWindow(bool *open=NULL)
IMGUI_API bool Begin(const char *name="Debug", bool *p_opened=NULL, const ImVec2 &initial_size=ImVec2(0, 0), float bg_alpha=-1.0f, ImGuiWindowFlags flags=0)
static void setSize(glm::i32vec2 s)
static void set2DState(bool on, bool depth=true)
or_time_t systemTimerGet()
Read the system timer. 
void unbind(int location)
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *display_format="%.0f")
static glm::i32vec2 getSize()
IMGUI_API void AddInputCharacter(ImWchar c)
void(* ImeSetInputScreenPosFn)(int x, int y)
int KeyMap[ImGuiKey_COUNT]