This commit is contained in:
Branimir Karadžić 2015-07-15 10:53:37 -07:00
parent af2bb3874d
commit 1cf4f92152
3 changed files with 59 additions and 33 deletions

View file

@ -9707,6 +9707,8 @@ void ImFontAtlas::ClearInputData()
ImGui::MemFree(ConfigData[i].FontData); ImGui::MemFree(ConfigData[i].FontData);
ConfigData[i].FontData = NULL; ConfigData[i].FontData = NULL;
} }
ConfigData.clear();
} }
void ImFontAtlas::ClearTexData() void ImFontAtlas::ClearTexData()

View file

@ -86,7 +86,7 @@ struct OcornutImguiContext
, uint16_t(bx::fmin(pcmd->ClipRect.z, 65535.0f)-bx::fmax(pcmd->ClipRect.x, 0.0f)) , uint16_t(bx::fmin(pcmd->ClipRect.z, 65535.0f)-bx::fmax(pcmd->ClipRect.x, 0.0f))
, uint16_t(bx::fmin(pcmd->ClipRect.w, 65535.0f)-bx::fmax(pcmd->ClipRect.y, 0.0f)) , uint16_t(bx::fmin(pcmd->ClipRect.w, 65535.0f)-bx::fmax(pcmd->ClipRect.y, 0.0f))
); );
union { void* ptr; bgfx::TextureHandle handle; } texture = { pcmd->TextureId }; union { void* ptr; bgfx::TextureHandle handle; } texture ={ pcmd->TextureId };
bgfx::setTexture(0, s_tex, 0 != texture.handle.idx bgfx::setTexture(0, s_tex, 0 != texture.handle.idx
? texture.handle ? texture.handle
@ -185,7 +185,7 @@ struct OcornutImguiContext
io.Fonts->GetTexDataAsRGBA32(&data, &width, &height); io.Fonts->GetTexDataAsRGBA32(&data, &width, &height);
m_texture = bgfx::createTexture2D( (uint16_t)width m_texture = bgfx::createTexture2D((uint16_t)width
, (uint16_t)height , (uint16_t)height
, 1 , 1
, bgfx::TextureFormat::BGRA8 , bgfx::TextureFormat::BGRA8

View file

@ -1063,4 +1063,28 @@ namespace Scintilla
} // namespace Scintilla } // namespace Scintilla
ScintillaEditor* ImGuiScintilla(const char* _name, bool* _opened, const ImVec2& _size)
{
ScintillaEditor* sci = NULL;
if (ImGui::Begin(_name, _opened, _size) )
{
ImGuiStorage* storage = ImGui::GetStateStorage();
ImGuiID id = ImGui::GetID(_name);
sci = (ScintillaEditor*)storage->GetVoidPtr(id);
if (NULL == sci)
{
ImVec2 size = ImGui::GetWindowSize();
sci = ScintillaEditor::create(size.x, size.y);
storage->SetVoidPtr(id, (void*)sci);
}
sci->draw();
}
ImGui::End();
return sci;
}
#endif // defined(SCI_NAMESPACE) #endif // defined(SCI_NAMESPACE)