Jump to content

Dreikblack

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. If i understand correctly your case and how mouse/keys events works a callbacks triggers only for upper UI element under mouse cursor. In UAK i solved it for my custom widgets by calling parent event methods void InnerContainer::MouseEnter(const int x, const int y) { GetParent()->MouseEnter(x, y); }
  2. Thanks! Not sure if i prefer annual subscription due a bit more than 8$ per month in compare with monthly one tho 😅(i guess current annual pricing meant for 10$/month that will be later at some point). Sorry for bothering that much. When i found out Ultra Engine is close to launch, i started working on game prototype in UAK and was not sure should i focus on it like proper 2D game (turn based, so should be possible to make with just GUI) or spend less time on things that will be barely useful in proper 3D game engine.
  3. Cell.h: #pragma once #include "UltraEngine.h" #include "Table.h" using namespace UltraEngine; class Cell : public TextField { protected: Cell(); public: static std::shared_ptr<Cell> create(const int x, const int y, const int width, const int height, shared_ptr<Table> table, bool isHeader = false); void MouseEnter(const int x, const int y); void MouseLeave(const int x, const int y); Vec4 highlightColor = Vec4(0.3f, 0.3f, 0.3f, 1.0f); Vec4 backgroundColor = Vec4(0.15f, 0.15f, 0.15f, 1.0f); }; Cell.cpp: #include "UltraEngine.h" #include "Cell.h" Cell::Cell() { } std::shared_ptr<Cell> Cell::create(const int x, const int y, const int width, const int height, shared_ptr<Table> table, bool isHeader) { struct Struct : public Cell { }; auto instance = std::make_shared<Struct>(); instance->As<Widget>()->Initialize("", x, y, width, height, table, TEXTFIELD_DEFAULT); if (isHeader) { instance->backgroundColor = Vec4(0.2f, 0.2f, 0.2f, 1.0f); instance->highlightColor = Vec4(0.35f, 0.35f, 0.35f, 1.0f); instance->SetColor(instance->backgroundColor, WIDGETCOLOR_SUNKEN); } return instance; } void Cell::MouseEnter(const int x, const int y) { TextField::MouseEnter(x, y); SetColor(highlightColor, WIDGETCOLOR_SUNKEN); } void Cell::MouseLeave(const int x, const int y) { TextField::MouseEnter(x, y); SetColor(backgroundColor, WIDGETCOLOR_SUNKEN); } Table.h #pragma once #include "UltraEngine.h" class Cell; using namespace UltraEngine; class Table : public Panel { protected: Table(); public: int rowCount = 0; int columnCount = 0; vector<std::shared_ptr<Cell>> headers; static std::shared_ptr<Table> create(const int x, const int y, const int width, const int height, int columnCount, int rowCount, shared_ptr<Widget> parent); vector<vector<std::shared_ptr<Cell>>> cells; }; Table.cpp #include "UltraEngine.h" #include "Table.h" #include "Cell.h" using namespace UltraEngine; Table::Table() { } std::shared_ptr<Table> Table::create(const int x, const int y, const int width, const int height, int columnCount, int rowCount, shared_ptr<Widget> parent) { struct Struct : public Table { }; auto instance = std::make_shared<Struct>(); instance->Initialize("", x, y, width, height, parent, UltraEngine::PanelStyle::PANEL_DEFAULT); instance->SetColor(0, 0, 0, 0); instance->columnCount = columnCount; instance->rowCount = rowCount; int cellWidth = Floor (float(width) / float(columnCount)); int cellHeight = Floor(float(height) / float(rowCount + 1)); instance->cells.resize(columnCount); instance->headers.resize(columnCount); for (int i = 0; i < columnCount; i++) { instance->cells[i].resize(rowCount); instance->headers[i] = Cell::create(cellWidth * i, 0, cellWidth, cellHeight, instance, true); instance->headers[i]->SetText(WString("Header ") + WString(i)); } for (int i = 0; i < columnCount; i++) { for (int j = 0; j < rowCount; j++) { instance->cells[i][j] = (Cell::create(cellWidth * i, cellHeight * (j+1) , cellWidth, cellHeight, instance)); instance->cells[i][j]->SetText(WString("Cell ") + WString(i) + WString(',') + WString(j)); } } return instance; } main.cpp #include "UltraEngine.h" #include "UI/Table.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CENTER); auto ui = CreateInterface(window); Table::create(0, 0, 500, 500, 3, 7, ui->root); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_QUIT: case EVENT_WINDOWCLOSE: return 0; break; default: break; } } return 0; }
  4. Hi! I may try to create own Table class on the weekend.
  5. I may only hope it is. Epic Games Store still allows to buy games in my region via Xsolla.
  6. Never tried crypto but i will look into it. Should i use Binance for it or something else?
  7. I wish i could buy it rn but still have to wait for avaiable for me a payment method like Xsolla 😐
  8. Will be with early access launch added other payment methods? Xsolla would be great for me 🙏
×
×
  • Create New...