silageman
Members-
Posts
21 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Everything posted by silageman
-
woops, never mind my fault i got it working now
-
they simply won't work together can't even compile because MDd_DynamicDebug dosent match MTd_StaticDebug in main.obj and if i try to have them both the same to avoid the error then appkit complains the same and visa versa any way to avoid this or am i just stuck with this.
-
it's because your embedding a window inside a window and it looses focus. One way to get around this would be to add the mouse click "left down" so the code would be in the while loop but before the event stuff. if (viewport->MouseDown(MOUSE_LEFT)) { viewport->Activate(); }
-
spent a few hours on this and said i would post about it since it could be usefull to others here: #include "UltraEngine.h" #define SDL_MAIN_HANDLED #include <SDL.h> #include <SDL_image.h> using namespace UltraEngine; void clear(SDL_Renderer* renderer) { SDL_RenderClear(renderer); SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255); } void draw(SDL_Renderer* renderer, SDL_Rect* rectangle) { SDL_Surface* surface = SDL_LoadBMP("test.bmp"); SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface); SDL_FreeSurface(surface); SDL_RenderCopy(renderer, texture, NULL, rectangle); SDL_RenderPresent(renderer); } int main(int argc, const char* argv[]) { //Get the available displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("SDL2 Example with Ultra App Kit", 0, 0, 1920, 1080, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); auto ui = CreateInterface(window); iVec2 sz = ui->root->ClientSize(); auto viewport = CreateWindow("", 200, 8, sz.x - 200 - 8, sz.y - 16, window, WINDOW_CHILD); auto btnW = CreateButton("W", 0, 0, 200, 200, ui->root); auto btnS = CreateButton("S", 0, 200, 200, 200, ui->root); auto btnA = CreateButton("A", 0, 400, 200, 200, ui->root); auto btnD = CreateButton("D", 0,600, 200, 200, ui->root); SDL_Renderer* renderer; SDL_SetMainReady(); SDL_Init(SDL_INIT_EVERYTHING); auto getwindow = SDL_CreateWindowFrom(viewport->GetHandle()); renderer = SDL_CreateRenderer(getwindow, -1, SDL_RENDERER_ACCELERATED); SDL_Rect rectangle = { rectangle.x = 40, rectangle.y = 40, rectangle.w = 40, rectangle.h = 40 }; bool running = true; while (running) { clear(renderer); while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; case EVENT_WIDGETACTION: if (ev.source == btnW) { rectangle.y -=10; } else if (ev.source == btnS) { rectangle.y += 10; } else if (ev.source == btnA) { rectangle.x -= 10; } else if (ev.source == btnD) { rectangle.x += 10; } break; } } draw(renderer, &rectangle); } SDL_DestroyWindow(getwindow); SDL_Quit(); return 0; }
-
How to dynamically Add ui widgets on button press UAK
silageman replied to silageman's topic in Programming
so deleting these works too but leaves empty space any widget that will automatically redraw on btn deletion? -
How to dynamically Add ui widgets on button press UAK
silageman replied to silageman's topic in Programming
#include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Add Buttons", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); auto ui = CreateInterface(window); auto sz = ui->root->ClientSize(); array<shared_ptr<Widget>, 10> btn; int inc = 0; int space = 0; btn[0] = CreateButton("add", 0, 0, 100, 100, ui->root); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: if(ev.source == btn[inc]){ space=space+100; btn[inc+1] = CreateButton("+", 0,space, 100, 100, ui->root); Print(inc); inc= inc+1; break; } break; case EVENT_WINDOWCLOSE: return 0; break; } } } -
Can anyone give me an example? do I have to create a custom widget or can I do this with the included widgets for example add text line edit on button press while the app is running.
-
it seems to work from http:// some url but not a local path even tho it says loading icon /contents/resources /some.svg auto icon = LoadIcon("des.svg"); ui->root->SetIcon(icon); even when I look in show package contents its where it's supposed to be any help or is this a known problem
-
on kubuntu latest using the official install of steam the auto generated makefile wont build because of file structure changes. take a look at the screenshots below for fix. it's '/Release/AppKit.o' - this was the only way i could build for linux can you push out a fix for this as it will pee people off and is an easy fix. or at least mention somewhere how to build this with configname Thanks.
-
#include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); //Create User Interface auto ui = CreateInterface(window); //Create buttons int x = (window->ClientSize().x - 120) / 2; int y = 350; int sep = 0; auto button = CreateButton("CONVERT", x, y, 300, 60, ui->root); y += sep; while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: if (ev.source->As<Widget>()->text == "CONVERT") { WString file = RequestFile("Open File", "", "All Files:*", 0, false); Print(file); return 0; //Print(Command("./ffmpeg -h")); } break; case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } here just to make easier, latest Xcode and app kit from the App Store on big sur. it's hardly a permission thing?
-
Box 2D how to access it since it ships with App Kit
silageman replied to silageman's topic in General Discussion
#include "Libraries/box2d/include/box2d/box2d.h" sorry i found it -
for example how do i reference it in code can we get an example for this. Also whats 2dkit and is it nearly finished