Jump to content

reepblue

Developers
  • Posts

    2,503
  • Joined

  • Last visited

Everything posted by reepblue

  1. GetEntity() isn't valid within the component Start function when the old raw pointer was. Place this Start function in any Component. virtual void Start() { auto self = GetEntity(); Assert(self != NULL, "entity is null!"); }
  2. This would be a good editor plug in much like the image generator. This way if people post an example in one language, they can just use GPT to convert the example in the language they are using.
  3. Hopefully I'll see the measurement display soon. 💙
  4. This also can happen. Also, when using an ultra-wide monitor, the grid stops short.
  5. I'm trying to fix a bug in my application where if the mouse cursor switching works after the window is rebuilt. What I need to do is reset the cursor to default before I destroy the window and then reapply the old cursor after the window is rebuilt. I need a Window::GetCursor() function to do this and none exists. bool GraphicsWindow::Initialize(const WString& title, const int width, const int height, shared_ptr<Display> display, const GraphicWindowStyles style) { // Release existing pointers so we can rebuild! static bool firstwindow = true; // Set the cursor to default before we delete the window. MouseCursor current_cursor = CURSOR_DEFAULT; if (window) { // I need this function. current_cursor = window->GetCursor(); window->SetCursor(CURSOR_DEFAULT); } window = NULL; framebuffer = NULL; int w = width; int h = height; WindowStyles window_style = WINDOW_TITLEBAR | WINDOW_CENTER | WINDOW_HIDDEN; switch (style) { case GRAPHICSWINDOW_TITLEBAR: window_style = WINDOW_TITLEBAR | WINDOW_CENTER | WINDOW_HIDDEN; break; case GRAPHICSWINDOW_BORDERLESS: window_style = WINDOW_CENTER | WINDOW_HIDDEN; break; case GRAPHICSWINDOW_FULLSCREEN: window_style = WINDOW_FULLSCREEN | WINDOW_CENTER | WINDOW_HIDDEN; break; case GRAPHICSWINDOW_FULLSCREENNATIVE: w = display->size.x; h = display->size.y; window_style = WINDOW_FULLSCREEN | WINDOW_CENTER | WINDOW_HIDDEN; break; default: break; } windowtitle = title; window = CreateWindow(windowtitle, 0, 0, w, h, display, window_style); SetWindowTitlebarTheme(window, TITLEBAR_DARK); framebuffer = CreateFramebuffer(window); if (firstwindow) { splashscreen = std::make_shared<SplashScreen>(); splashscreen->Initialize(window, 1500); firstwindow = false; } else { window->SetHidden(false); } // Set this to focus! window->SetCursor(current_cursor); window->Activate(); // Send this event with the size of the framebuffer. EmitEvent(EVENT_GRAPHICSWINDOW, GetProgram(), 0, window->GetPosition().x, window->GetPosition().y, framebuffer->GetSize().x, framebuffer->GetSize().y, window); return true; }
  6. This is what it looks like when attempt to load any previously saved map. box.zip
  7. 1. I can't resize the grid with the bracket hot keys ("[" and "]") 2. I don't know if the grid was not adjusted correctly for the unit change a while back, but nothing seems to line up anymore. The texture scale is 0.28 off. 3. When will I get my unit number display for brushes? 😭
  8. When attempting to look at a model in the asset browser, you'll receive the "PostEffect is NULL" error message as the compiled post effects are missing in the Shaders folder. The current fix is to copy and paste the Post Effects folder from the Source folder to the Shaders folder. The fix would involve including the copy the compiled shaders to the Shaders folder.
  9. Looks like I need to make sure I'm initializing my game world first and my menu world last.
  10. I recall the GUI in the vulkan renderer not looking as good. Glad to hear you plan to fix this soon.
  11. Ok, will fix my code with this advice. I also recommend making the update function static so future users don't do the same thing. Maybe turn it into a UpdateWorlds() function?
  12. Ahh, should we only be updating one world at a time or just update A world all the time? This maybe why I'm getting issues with the physics just not working.
  13. I've ran into physics totally not working in my second world but it never crash. I haven't tried the recent builds yet.
  14. Yeah you disable it for the viewpoints, I get that. The demos we've played with in the past always work fine but I understand there's no more going on here. I'm surprised you're not having this issue on your end. I got viewpoint issues on both on Win10 and 11 with a Nivdia GPU with pretty recent drivers. Granted, I don't update my driver's religiously but that can be something I can try on my end. I may just rebuild my Win10 dev box with a 1050 so my system is as close as your setup as possible. Windows will not force me to upgrade it because it's "not supported".
  15. Oh, it's still been a struggle to use on my end using more than one viewport and the asset viewer also flickers everytime the focus is lost from the 3D viewpoint. I think it's something to do with your Async rendering to be honest.
  16. Ok, I'll be sure to check it out after the next build goes out and I'll report back on it's behavior.
  17. I noticed this too. Something is up with map loaded components. Yes, I set up my new component with an empty json script and although the constructor was called, none of the functions were.
  18. @Josh Ok, this is weird. The CameraControls.hpp works fine but today I made a brand-new component and although the constructor is being called, the other functions aren't. #pragma once #include "UltraEngine.h" using namespace UltraEngine; class FPSCamera : public Component { public: FPSCamera() { name = "FPSCamera"; } ~FPSCamera() { name = ""; } //This method will work with simple components virtual shared_ptr<Component> Copy() { return std::make_shared<FPSCamera>(*this); } virtual void Start() { Print("Debug: " + name); } virtual void Update() { Print("Debug: " + name); } }; And yes, I do have it being registered with everything else. #pragma once #include "UltraEngine.h" // Components #include "Motion/Mover.hpp" #include "Player/CameraControls.hpp" #include "Player/FPSCamera.hpp" #include "Player/SettingsListener.hpp" namespace UltraEngine::Game { void RegisterComponents() { RegisterComponent<Mover>(); RegisterComponent<CameraControls>(); RegisterComponent<FPSCamera>(); RegisterComponent<SettingsListener>(); } }
  19. Yep, it now breaks at that function. I need to test multiple components with ProcessEvent functions on them, but I'll have to look into that later.
  20. I'm finding that a component's start function isn't called when loaded from a map. I'm attaching multiple components in my case, but it should work regardless. I need it to bind my listen events. #pragma once #include "UltraEngine.h" using namespace UltraEngine; class CameraControls : public Component { bool freelookstarted{ false }; Vec3 freelookmousepos; Vec3 freelookrotation; Vec2 lookchange; public: float mousesmoothing = 0.0f; float mouselookspeed = 1.0f; float movespeed = 4.0f; CameraControls() { name = "CameraControls"; } virtual void Start() { Print("Put a break on me!") } virtual void Update() { auto window = ActiveWindow(); if (window == NULL) return; if (!freelookstarted) { freelookstarted = true; freelookrotation = entity->GetRotation(true); freelookmousepos = window->GetMouseAxis(); } auto newmousepos = window->GetMouseAxis(); lookchange.x = lookchange.x * mousesmoothing + (newmousepos.y - freelookmousepos.y) * 100.0f * mouselookspeed * (1.0f - mousesmoothing); lookchange.y = lookchange.y * mousesmoothing + (newmousepos.x - freelookmousepos.x) * 100.0f * mouselookspeed * (1.0f - mousesmoothing); if (Abs(lookchange.x) < 0.001f) lookchange.x = 0.0f; if (Abs(lookchange.y) < 0.001f) lookchange.y = 0.0f; if (lookchange.x != 0.0f or lookchange.y != 0.0f) { freelookrotation.x += lookchange.x; freelookrotation.y += lookchange.y; entity->SetRotation(freelookrotation, true); } freelookmousepos = newmousepos; float speed = movespeed / 60.0f; if (window->KeyDown(KEY_SHIFT)) { speed *= 10.0f; } else if (window->KeyDown(KEY_CONTROL)) { speed *= 0.25f; } if (window->KeyDown(KEY_E)) entity->Translate(0, speed, 0); if (window->KeyDown(KEY_Q)) entity->Translate(0, -speed, 0); if (window->KeyDown(KEY_D)) entity->Move(speed, 0, 0); if (window->KeyDown(KEY_A)) entity->Move(-speed, 0, 0); if (window->KeyDown(KEY_W)) entity->Move(0, 0, speed); if (window->KeyDown(KEY_S)) entity->Move(0, 0, -speed); } //This method will work with simple components virtual shared_ptr<Component> Copy() { return std::make_shared<CameraControls>(*this); } virtual bool ProcessEvent(const Event& e) { return true; } virtual bool Load(table& properties, shared_ptr<Stream> binstream, shared_ptr<Scene> scene, const LoadFlags flags) { if (properties["mousesmoothing"].is_number()) mousesmoothing = properties["mousesmoothing"]; if (properties["mouselookspeed"].is_number()) mouselookspeed = properties["mouselookspeed"]; if (properties["movespeed"].is_number()) movespeed = properties["movespeed"]; return true; } virtual bool Save(table& properties, shared_ptr<Stream> binstream, shared_ptr<Scene> scene, const SaveFlags flags) { properties["mousesmoothing"] = mousesmoothing; properties["mouselookspeed"] = mouselookspeed; properties["movespeed"] = movespeed; return true; } };
  21. I just created a file called "RegisterComponents.cpp" and I have it in my Components folder. Then I call the function in my Program class. #pragma once #include "UltraEngine.h" #include "RegisterComponents.h" // Components #include "Motion/Mover.hpp" #include "Player/CameraControls.hpp" #include "Player/SettingsListener.hpp" namespace UltraEngine::Game { void RegisterComponents() { RegisterComponent<Mover>(); RegisterComponent<CameraControls>(); RegisterComponent<SettingsListener>(); } } Everything works as expected. My only issue right now is that the editor can't load existing ultra maps which makes further developing this annoying, but I expect this to be fixed eventually.
  22. I can't seem to call RegisterComponent from the engine API, it states it's undefined. I just copied and pasted the function in my code, and it works. Made it work, it was my implementation as I don't want to register everything within the main function.
  23. You're the best, now the real fun begins! I'll be playing with this for sure this weekend.
  24. I'm not on my PC to try it, but we've ran into this issue twice before and it's always been a server issue described here.
  25. Slider acts weird when the range minimum value is not 0. #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, 800, 600, displays[0]); //Create User Interface auto ui = CreateInterface(window); //Create widget auto sz = ui->root->ClientSize(); auto slider1 = CreateSlider(10, 10, 200, 30, ui->root, SLIDER_TRACKBAR); slider1->SetRange(54, 90); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: Print("Widget action: " + String(ev.data)); break; case EVENT_WINDOWCLOSE: return 0; break; } } return 0; }
×
×
  • Create New...