NAP
Functions
ImGui Namespace Reference

Functions

void IMGUI_API Image (const nap::Texture2D &texture, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 1), const ImVec2 &uv1=ImVec2(1, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
 
bool IMGUI_API ImageButton (const nap::Texture2D &texture, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 1), const ImVec2 &uv1=ImVec2(1, 0), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
 
bool IMGUI_API ImageButton (const nap::Icon &icon, const char *text=nullptr, const ImVec2 &tooltip_offset=ImVec2(10, 10), const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
 
bool IMGUI_API ImageButton (const nap::Icon &icon, const ImVec2 &size, const char *text=nullptr, const ImVec2 &tooltip_offset=ImVec2(10, 10), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
 
ImTextureID IMGUI_API GetTextureHandle (nap::Texture2D &texture)
 
bool IMGUI_API Combo (const char *label, int *current_item, nap::rtti::TypeInfo enum_type)
 

Detailed Description

This file contains NAP overrides for popular IMGui functions. These utility functions allow you to use common NAP objects in conjunction with IMGui All the functions in this file follow the IMGui style and naming conventions

Function Documentation

◆ Combo()

bool IMGUI_API ImGui::Combo ( const char *  label,
int *  current_item,
nap::rtti::TypeInfo  enum_type 
)

Displays all members of an rtti defined enumeration type inside a combo box. Call asserts if the provided type is not an enumeration object.

if(ImGui::Combo("Type Selection", &item, RTTI_OF(nap::ETweenEasing));
{
...
}
Parameters
labelname of the combo box
current_itemcurrent selected item
enum_typethe enum type to display
Returns
if selection changed

◆ GetTextureHandle()

ImTextureID IMGUI_API ImGui::GetTextureHandle ( nap::Texture2D texture)

Return ImTextureID, can be used when drawing textures in a window drawlist

Parameters
texturethe texture to retrieve the ImTextureID from
Returns
the ImTextureID

◆ Image()

void IMGUI_API ImGui::Image ( const nap::Texture2D texture,
const ImVec2 &  size,
const ImVec2 &  uv0 = ImVec2(0, 1),
const ImVec2 &  uv1 = ImVec2(1, 0),
const ImVec4 &  tint_col = ImVec4(1, 1, 1, 1),
const ImVec4 &  border_col = ImVec4(0, 0, 0, 0) 
)

Displays a NAP 2D texture as an IMGUI image

Parameters
texturethe texture to display in IMGUI
sizedisplay size of the texture
uv0the min uv coordinates, defaults to lower left corner
uv1the max uv coordinates, defaults to upper right corner
tint_colused to tint the displayed texture
border_colof the border of the image

◆ ImageButton() [1/3]

bool IMGUI_API ImGui::ImageButton ( const nap::Icon icon,
const char *  text = nullptr,
const ImVec2 &  tooltip_offset = ImVec2(10, 10),
const ImVec4 &  bg_col = ImVec4(0, 0, 0, 0),
const ImVec4 &  tint_col = ImVec4(1, 1, 1, 1) 
)

Displays a NAP Icon as an IMGUI image button where the height of the button is the same as the height of the frame. When hovered the name of the icon or optional text is displayed.

if (ImGui::ImageButton(gui_service.getIcon(icon::ok)))
{
...
}
Parameters
iconicon to apply to the button
textoptional overlay text, when null icon name is shown
tooltip_offsetoffset tooltip needs to have in x and y axis
bg_colbutton backgound color
tint_colbutton tint color
Returns
if the button is pressed

◆ ImageButton() [2/3]

bool IMGUI_API ImGui::ImageButton ( const nap::Icon icon,
const ImVec2 &  size,
const char *  text = nullptr,
const ImVec2 &  tooltip_offset = ImVec2(10, 10),
int  frame_padding = -1,
const ImVec4 &  bg_col = ImVec4(0, 0, 0, 0),
const ImVec4 &  tint_col = ImVec4(1, 1, 1, 1) 
)

Displays a NAP Icon as an IMGUI image of a certain size. When hovered the name of the icon or optional text is displayed.

if (ImGui::ImageButton(gui_service.getIcon(icon::ok)))
{
...
}
Parameters
iconicon to apply to the button
sizesize of the icon
textoptional overlay text, when null icon name is shown
tooltip_offsetoffset tooltip in x and y
frame_paddingimage frame padding
bg_colbutton backgound color
tint_colbutton tint color
Returns
if the button is pressed

◆ ImageButton() [3/3]

bool IMGUI_API ImGui::ImageButton ( const nap::Texture2D texture,
const ImVec2 &  size,
const ImVec2 &  uv0 = ImVec2(0, 1),
const ImVec2 &  uv1 = ImVec2(1, 0),
int  frame_padding = -1,
const ImVec4 &  bg_col = ImVec4(0, 0, 0, 0),
const ImVec4 &  tint_col = ImVec4(1, 1, 1, 1) 
)

Displays a NAP 2D texture as an IMGUI image button

Parameters
textureimage to apply to the button
sizedisplay size of the button
uv0the min uv coordinates, defaults to lower left corner
uv1the max uv coordinates, defaults to upper right corner
frame_paddingimage frame padding
bg_colbutton background color
tint_colbutton tint color
Returns
if the button is pressed
ImGui::ImageButton
bool IMGUI_API ImageButton(const nap::Texture2D &texture, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 1), const ImVec2 &uv1=ImVec2(1, 0), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
ImGui::Combo
bool IMGUI_API Combo(const char *label, int *current_item, nap::rtti::TypeInfo enum_type)