IRenderViewToTexture#
Rendering view to texture storage interface.
Header: | #include <AUI/Render/IRenderViewToTexture.h> |
CMake: | aui_link(my_target PUBLIC aui::views) |
Public Types#
InvalidArea#
struct IRenderViewToTexture::InvalidArea
Defines areas to invalidate (redraw).
Field | Description |
---|---|
using Rectangles
|
Specific areas redraw. |
using Underlying
|
Public Methods#
begin#
virtual bool IRenderViewToTexture::begin(IRenderer& renderer, glm::ivec2 surfaceSize, IRenderViewToTexture::InvalidArea& invalidArea)
Instructs the renderer to begin drawing to the surface (framebuffer) stored in IRenderViewToTexture.
- Arguments
renderer
renderer to draw with. IRenderViewToTexture is expected to be associated with the renderer it's created with and normally this parameter is used to assert check the used renderer is the same.surfaceSize
framebuffer size. Adjusts this value to achieve supersampling. Resizes the surface if mismatched with surfaceSize.invalidArea
invalid areas to update. Should not be empty. Can be changed to InvalidArea::Full{} by implementation and caller is expected to react accordingly.- Returns
- true on success, false otherwise
If needed, implementation may adjust renderer's transform matrix.
Examples#
examples/app/minesweeper/src/NewGameWindow.h
Minesweeper Game - Minesweeper game implementation driven by ass.
examples/ui/contacts/src/main.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
mSelectedContact = nullptr;
}
_<AView> indexedList() {
return AUI_DECLARATIVE_FOR(group, *mContacts | ranges::views::chunk_by([](const _<Contact>& lhs, const _<Contact>& rhs) {
return groupLetter(lhs->displayName) == groupLetter(rhs->displayName);
}), AVerticalLayout) {
auto firstContact = *ranges::begin(group);
auto firstLetter = groupLetter(firstContact->displayName);
ALogger::info("Test") << "Computing view for group " << AString(1, firstLetter);
examples/7guis/cells/src/Cell.cpp
7GUIs Cells - Spreadsheet processor (Excel).
}
glm::uvec2 Cell::fromName(const AString& name) {
glm::uvec2 out{UNDEFINED};
auto it = name.begin();
for (;it != name.end() && 'A' <= *it && *it <= 'Z'; ++it) {
if (out.x == UNDEFINED) { out.x = 0; }
out.x *= 26;
out.x += *it - 'A';
}
examples/7guis/cells/src/AST.cpp
7GUIs Cells - Spreadsheet processor (Excel).
}
}
if (!binaryOperators.empty()) {
auto root = std::min_element(
binaryOperators.begin(), binaryOperators.end(),
[](const BinaryOperatorAndItsPriority& lhs, const BinaryOperatorAndItsPriority& rhs) {
return lhs.priority < rhs.priority;
});
auto out = std::make_unique<T>();
AUI_ASSERT(root->owning != nullptr);
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer - Undo, redo, dialog control.
draw#
virtual void IRenderViewToTexture::draw(IRenderer& renderer)
Draws contents of the surface.
- Arguments
renderer
renderer to draw with. IRenderViewToTexture is expected to be associated with the renderer it's created with and normally this parameter is used to assert check the used renderer is the same.
end#
virtual void IRenderViewToTexture::end(IRenderer& renderer)
Finishes drawing operation started with begin method.
- Arguments
renderer
renderer to draw with. IRenderViewToTexture is expected to be associated with the renderer it's created with and normally this parameter is used to assert check the used renderer is the same.
The caller is obligated to recover renderer's state prior to begin method call.
Examples#
examples/7guis/cells/src/Cell.cpp
7GUIs Cells - Spreadsheet processor (Excel).
glm::uvec2 Cell::fromName(const AString& name) {
glm::uvec2 out{UNDEFINED};
auto it = name.begin();
for (;it != name.end() && 'A' <= *it && *it <= 'Z'; ++it) {
if (out.x == UNDEFINED) { out.x = 0; }
out.x *= 26;
out.x += *it - 'A';
}
for (;it != name.end() && '0' <= *it && *it <= '9'; ++it) {
examples/7guis/cells/src/AST.cpp
7GUIs Cells - Spreadsheet processor (Excel).
}
}
if (!binaryOperators.empty()) {
auto root = std::min_element(
binaryOperators.begin(), binaryOperators.end(),
[](const BinaryOperatorAndItsPriority& lhs, const BinaryOperatorAndItsPriority& rhs) {
return lhs.priority < rhs.priority;
});
auto out = std::make_unique<T>();
AUI_ASSERT(root->owning != nullptr);
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer - Undo, redo, dialog control.