bgfx/examples/common/imgui/imgui.h

86 lines
3.1 KiB
C
Raw Normal View History

2013-04-25 00:01:11 -04:00
/*
2014-02-11 01:07:04 -05:00
* Copyright 2011-2014 Branimir Karadzic. All rights reserved.
2013-04-25 00:01:11 -04:00
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
// This code is based on:
//
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
// Source altered and distributed from https://github.com/AdrienHerubel/imgui
#ifndef IMGUI_H_HEADER_GUARD
#define IMGUI_H_HEADER_GUARD
2013-04-25 00:01:11 -04:00
2013-08-07 00:04:28 -04:00
#define IMGUI_MBUT_LEFT 0x01
#define IMGUI_MBUT_RIGHT 0x02
2013-04-25 00:01:11 -04:00
2013-08-07 00:04:28 -04:00
struct ImguiTextAlign
2013-04-25 00:01:11 -04:00
{
2013-08-07 00:04:28 -04:00
enum Enum
{
Left,
Center,
Right,
};
2013-04-25 00:01:11 -04:00
};
inline uint32_t imguiRGBA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255)
{
return 0
2014-06-22 22:15:38 -04:00
| (uint32_t(_r) << 0)
2013-04-25 00:01:11 -04:00
| (uint32_t(_g) << 8)
| (uint32_t(_b) << 16)
| (uint32_t(_a) << 24)
;
}
2014-05-03 18:18:28 -04:00
bool imguiCreate(const void* _data);
2013-04-25 00:01:11 -04:00
void imguiDestroy();
void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, uint8_t _view = 31);
void imguiEndFrame();
bool imguiBeginScrollArea(const char* _name, int _x, int _y, int _width, int _height, int* _scroll);
void imguiEndScrollArea();
void imguiIndent();
void imguiUnindent();
void imguiSeparator();
void imguiSeparatorLine();
bool imguiButton(const char* _text, bool _enabled = true);
bool imguiItem(const char* _text, bool _enabled = true);
bool imguiCheck(const char* _text, bool _checked, bool _enabled = true);
bool imguiCollapse(const char* _text, const char* _subtext, bool _checked, bool _enabled = true);
void imguiLabel(const char* _format, ...);
void imguiValue(const char* _text);
bool imguiSlider(const char* _text, float* _val, float _vmin, float _vmax, float _vinc, bool _enabled = true);
bool imguiSlider(const char* _text, int32_t* _val, int32_t _vmin, int32_t _vmax, bool _enabled = true);
2013-04-25 00:01:11 -04:00
2014-01-19 03:28:17 -05:00
uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...);
2014-01-18 23:07:00 -05:00
#define imguiChoose(...) imguiChooseUseMacroInstead(__VA_ARGS__, NULL)
2013-08-07 00:04:28 -04:00
void imguiDrawText(int _x, int _y, ImguiTextAlign::Enum _align, const char* _text, uint32_t _argb);
2013-04-25 00:01:11 -04:00
void imguiDrawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _argb);
void imguiDrawRoundedRect(float _x, float _y, float _w, float _h, float _r, uint32_t _argb);
void imguiDrawRect(float _x, float _y, float _w, float _h, uint32_t _argb);
2014-06-22 22:15:38 -04:00
int imguiReserve(int _y);
#endif // IMGUI_H_HEADER_GUARD