Jump to content

Search the Community

Showing results for tags 'ui'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Blogs

  • Development Blog
  • Canardian's Blog
  • Beyond Civilization Blog Ext
  • Tyler's Blog
  • macklebee's Blog
  • B-Byrnes' Blog
  • Marleys Ghost's Blog
  • omid3098's Blog
  • Richardsimpo123456's Blog
  • DJDD's Blog
  • Rick's Blog
  • --
  • xtreampb's Blog
  • Economically Disadvantaged
  • klepto2's Blog
  • Old Blog
  • Chris Paulson's Blog
  • Davaris' Blog
  • nil
  • Rekindled Phoenix's Blog
  • Flexman's Blog
  • Kattemaksu Online
  • Marcousik's Creations Blog
  • EVE LBS Studio
  • Rendering puzzles
  • Screen Size Utility
  • Niosop's Blog
  • 1299 RTS Game Project
  • Blitzbat's Blog
  • gordonramp's Blog
  • Andy Gilbert's Blog
  • Marcus' Blog
  • JornAggror Blog
  • diedir's Blog
  • wayneg's Blog
  • Masterxilo's Blog
  • Dave Lee's Blog
  • peubuy's blog
  • OD Arts -Leadwerks Blog
  • The progression......
  • Ultra Software Company Blog
  • The Progression
  • Pancake's Blog
  • Test Blog
  • BLaBZ Blog
  • Pure³d's Blog
  • dreamhead Blog
  • RVL's Blog
  • DB's Blog
  • Toxin Games Development Blog
  • CombatHelo Blog (RSS Import)
  • Foolish's Blog
  • ZioRed's Corner
  • Toxin Games Twitter
  • Shard - Third Initiative
  • Shard's Blog
  • Soamp's Blog
  • Soamp's Blog
  • Laurens' Blog
  • JT`s warehouse district
  • Kennar's Blog
  • KiteFuchs' Blog
  • KiteFuchs' Blog
  • Rachel's Dev-Blog
  • Eagle's Blog
  • zaphos' Blog
  • please delete this blog
  • Afke's Blog
  • Richard Simpson
  • knowledgegranted's Blog
  • EdzUp(GD)'s Blog
  • aGameLife's Kelasel MMORPG Blog
  • tournamentdan's Blog
  • Beyond Civilization Blog
  • smashthewindow
  • AnniXa's Blog
  • AnniXa's Blog
  • Elemental Development
  • DigitalHax Blog
  • Aria's Blog
  • Strogg76's Blog
  • Clackdor's Blog
  • Leadwerks Project Status
  • simpleprogrammer's Blog
  • Pathfinding in LE.2.x
  • Naughty Alien's Blog
  • smashthewindow's Blog
  • Ali Salehi's Blog
  • Jardar's Blog
  • Chris Vossen's Development Blog
  • Scarlet Thread Studios' Blog
  • Kronos' Blog
  • Benton's Blog
  • ChrisV's Blog
  • tjheldna's Blog
  • shadmar's Blog
  • 3D Masons, LLC
  • Andy Gilbert's Enviro Models
  • ParaToxic's Blog
  • NarkLord's Blog
  • ChrisMAN's Blog
  • ChrisMAN's Blog
  • CGMan's Blog
  • The Game
  • Chris Tutorials
  • Leadwerks 3 Experience
  • An Alien Saga
  • klepto2 & Leadwerks 3
  • Inside the mind of eternal insomniac
  • josk's Blog
  • Shader Development in Leadwerks 3.1
  • 3D Coat : Column game making of
  • Einlander's Blog
  • Ginger George's Blog
  • I have a problem
  • Michael_J's Blog
  • nasamydifol's Blog
  • Digman's Blog
  • noesisGUI
  • SavageDogg38's Blog
  • Built from Ruins
  • Remaining Days
  • test_external_blog
  • The Hunt For Food Blog
  • Crazy Minnow Studio
  • CrazyMinnowStudio
  • Guppy's Blog
  • Playing Online
  • Evayr's Blog
  • DerRidda's Blog
  • Karl's Blog
  • whiterabbit's Blog
  • Tinyboss Games
  • abendkleider's Blog
  • sacguccireplica's Blog
  • Arena
  • Imchasinyou's Blog
  • xtom's Blog
  • Lua is better than you think.
  • mdgunn's Blog
  • Crime Closer
  • lxFirebal69xl's Blog
  • Wedmer's Blog
  • Lockdown, going forward.
  • Pump-Action Captain
  • Igor's Blog
  • Dead Anyway
  • Runenrise and more
  • reepblue's Blog
  • Slippy's Corner
  • LUA Musings
  • severjack's Blog
  • mikeporter's Blog
  • miko93's Blog
  • Megalocerous' Blog
  • lxFirebal69xl's Blog
  • aiaf's Blog
  • Lostghbear's Blog
  • echo $BLOG_NAME > blog_title.tmpl
  • johnadam111's Blog
  • Dwarf Beard
  • burgelkat's Blog
  • Charrua's Blog
  • peterpaul's Blog
  • joshmathews' Blog
  • Martin Kearl's Blog
  • Brutile's blog
  • tipforeveryone's Blog
  • Glushchenko Blog
  • Express Lab Games Blog
  • Blueapples' Blog
  • DooMAGE's Blog
  • Structura devblog
  • UltraEngine - Experiences, add-ons and other Stuff
  • martyj's Blog
  • Dragonfreak's Blog
  • Brutile's Blog
  • assigmenthelp
  • Case Study Assignment Help
  • How to deal with bad grade ?
  • How to deal with bad grade ?
  • GameDev Blog
  • devcjohnson's Blog
  • devcjohnson's Blog
  • THE WHAT? Blog
  • The Demurian Scribe
  • GUI Editor
  • GUI Tutorial
  • noob_shaders
  • The Seventh World
  • Phodex Games Blog
  • Leadwerks VS Source 2
  • Work in Progress - Scifi PBR Media
  • [C++] First Player game start
  • The Blog of Yue
  • Snowboarding Development Blog
  • Ocean: Rendering in Leadwerks 4
  • Game Ready Maps
  • Ultra App Kit (Advanced Custom Widgets)
  • Poking around
  • SALVATIONLAND
  • Blender tutorials
  • Usefull Scripts & Components
  • Thirsty Panther
  • Direct Macro

Forums

  • Software
    • General Discussion
    • Programming
    • Game Artwork
    • Showcase
    • Suggestion Box
    • Bug Reports
  • Addons
    • Extensions & Plugins
    • Components
    • Addon Development
  • Platforms
    • Windows
    • Linux
    • macOS

Categories

  • Tutorials
  • Games
  • Work in Progress

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location

Found 13 results

  1. Steam beta branch. When i first time create widgets it's works. But when i destroy them and create new ones in a same vector they are invisible. It worked several months ago. Need that for an inventory gui. #include "UltraEngine.h" using namespace UltraEngine; class ContainerWidget : public Panel { vector<shared_ptr<Widget>> btns; protected: virtual bool Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { btns.resize(4); return Widget::Initialize(text, x, y, width, height, parent, style); } public: void initBtns() { clearBtns(); for (int i = 0; i < btns.size(); i++) { btns[i] = CreateButton("Btn", i * 50 + 10, 0, 20, 20, Self()->As<Widget>()); } } void clearBtns() { for (int i = 0; i < btns.size(); i++) { if (btns[i]) { btns[i]->SetParent(nullptr); btns[i] = nullptr; } } } static shared_ptr<ContainerWidget> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { struct Struct : public ContainerWidget { }; auto instance = std::make_shared<Struct>(); instance->Initialize(x, y, width, height, parent); instance->SetColor(0.5, 0.5, 0.5, 1, WIDGETCOLOR_BACKGROUND); instance->initBtns(); return instance; } }; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> btn; shared_ptr<ContainerWidget> container; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); container = ContainerWidget::create(10, 50, 200, 50, ui->root); btn = CreateButton("Reinit buttons", 10, 10, 150, 20, ui->root); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 300, 300, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.source == btn && ev.id == EVENT_WIDGETACTION) { container->initBtns(); } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  2. Hello Guys i try to create an ui but it wont show anything. I think i missed something. This is my main.cpp code #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { RegisterComponents(); auto cl = ParseCommandLine(argc, argv); //Load FreeImage plugin (optional) auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto ui = CreateInterface(window); //Create widget auto label1 = CreateLabel("Label", 20, 20, 120, 30, ui->root); auto label2 = CreateLabel("Border Label", 20, 50, 120, 30, ui->root, LABEL_BORDER | LABEL_CENTER | LABEL_MIDDLE); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Load the map WString mapname = "Maps/TestScene.ultra"; if (cl["map"].is_string()) mapname = std::string(cl["map"]); auto scene = LoadMap(world, mapname); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  3. Example: #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, 1920, 1080, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.6); camera->SetFov(90); camera->SetRotation(54.736f, 45, 0); camera->SetPosition(0, 4, 0); auto sz = framebuffer->GetSize(); // Load a font auto font = LoadFont("Fonts/arial.ttf"); // Create user interface auto ui = CreateInterface(world, font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); // Create ui camera auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition(float(framebuffer->GetSize().x) * 0.5f, float(framebuffer->GetSize().y) * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); //Create light auto light = CreateBoxLight(world); light->SetRange(-100, 100); light->SetArea(100, 100); light->SetRotation(35, 35, 0); light->SetColor(2); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false); } return 0; }
  4. So, I was lurking around the forums looking for some action, you know ... some real crazy action. That kind of action you get from watching a Michael Bay movie, and I got it alright. I got it real good. Some homies chatting right here, wanting to know how they can get GLEW playing nice with UAK: Well guess what guys, strap your eyeballs in ... cos I'm about to take them for the ride of their lives! Lets kick things off by starting up a fresh, raw, uncensored ... raw? Visual Studio project! A precursor before you continue reading. This is for Windows only, if you are on anything else then God speed. Project Setup w/ Blank C++ Project. You can do this one of two ways, or maybe even two of two ways. UAK has a real fancy application that can help you set up a Visual Studio project through Steam. Or, if your an old-schooler (like me), you can simply set up a blank C++ project. Either way, I don't care, cos let's be honest cuh ... if you can't even make a Visual Studio project, then what the heck you doing here, at Slippy's Corner ... at this hour, shouldn't you be in bed by now? Slippy got gat's, you feel me? For real though, let's put our big boy pants on and ditch the UAK project launcher (sorry Josh). Fire up Visual Studio and select the "Create a new project" option, choosing "Empty Project" on the right. Once everything has loaded right-click your project in the Solution Explorer and go to Properties (Alt+Enter if your a shortcut loser, just kidding, shortcuts are cool). You'll get the properties page of your project, we want to set some general paths for our Output Directory and Intermediate Directory. Both directories refer to where your built binaries go. Output is where the built Configuration Type goes to (that's the type of application you are making, we are making an executable .exe). Our intermediate path is where all the files our compiler creates and uses to build our application goes: Feel free to copy mine, or if you have a personal preference then go with that, I won't judge. As an optional step here, depending on how you set up your project (if you did it through creating a blank C++ project like I suggested above) then you'll have to link up the UAK library and also include the sweet nectar, the elixir of life. The header files. This is good to go through as its a nice practice run for when we get our hands full of GLEW, real sticky, pungent GLEW. Hey, if you did set up your project using the UAK app on Steam then I'd recommend to delete that and start off with a blank C++ project, if you got the nards! Go on, I dare you. Ok, enough messing around, lets go and create some folders to keep our project in order (this is optional, only follow this if you have made a blank C++ project). Right-click your solution in the Solution Explorer within Visual Studio (that's the top-most item in the list) and choose "Open Folder in File Explorer". We want to create a folder here called Dependencies, within that folder make another new folder called UAK. Now, hop into that folder (reminds me of that movie Inception) and make two new folders, one called includes and another called libs. Having fun yet? Well there is more, a lot more. We now need to go and get those UAK dependencies, otherwise we won't have access to any UAK code. Head on over to your Steam installation and go to "steamapps > common > Ultra App Kit > Library > Windows > x64 > Debug", in there we should see AppKit.lib. Copy that and paste it in our libs folder that we made earlier. This is the .lib file we will want to link later in Visual Studio. Now go back to the root Ultra App Kit folder and you should see an Include folder. Select everything in this folder and copy and paste it into our includes folder we made earlier. These files make up the necessary code files that together forms the UAK API. Ok, so far we have copied the UAK dependencies into their respective folders. Now we can go back to Visual Studio and get into the nitty-gritty. Right-click your project in the Solution Explorer and open up the properties page again. I gonna warn you here that if you don't follow these instructions explicitly then your computer may combust into a spectacular ball of fire, so listen up carefully! <-- I'm just kidding guys, don't panic. In the Linker drop-down on the left you should see a General section, click that and it will reveal new options on the right pane. We are looking for the option "Additional Library Directories" you should see it half way down, buried in the abyss of other frightening options we must not touch. Clicking that option will display yet another drop-down on the fields far right, click this and choose <Edit...>. Now we need to enter the path to our UAK libs folder. There are some special macro's we can use (just copy and paste the below snippet if your lazy): $(SolutionDir)Dependencies\UAK\libs If you look in the "Evaluated value:" box you should see it has retrieved the correct path! I know right, this is pretty wild! There is one last step, we need to head to the Input section within the Linker drop-down and in the "Additional Dependencies" field enter AppKit.lib; (don't forget that semi!) Now, we are gonna do the same thing for our includes directory, but there is one extra step we need to do for this. Accept and OK the changes we have made in the project properties as we would like to save the hard work we have made so far. Now in the Solution Explorer we are going to add our first source code file. Right-click the Source Files folder filter in the Solution Explorer and go to Add > New Item. From the new dialog box we want to add a .cpp file. I'm going to call my Application.cpp. With this file now added we can right-click our project and head to the properties once again! The keen-eyed readers here will notice that we now have a new drop-down on the left, the C/C++ drop-down. Let's click it and go to the General properties. Similar to what we did with our libs folder, we now want to add our includes folder using the special macro's from before: $(SolutionDir)Dependencies\UAK\includes Hit apply and OK to save our changes. Ok, with all that out of the way we are back on track. Again, I'd like to reiterate that if you didn't make a blank C++ project then all of the above was completely pointless and I can only assume that you continued reading it to expand your vocabulary palette, or maybe my fore-warning wasn't clear enough ... either way, I can only apologise. Downloading & Linking GLEW. We are finally here and we are ready to get sticky. We first need to download GLEW, head over to this link where you can get the official GLEW binaries (download the binaries, not the source code) http://glew.sourceforge.net/. Once we have downloaded and extracted the GLEW zip we should see the following folder structure: We are interested in the include and lib folders. First we will deal with the lib folder. Take a peek inside it, what do you see? Maybe a nice picture of a sunrise, or a .mp3 file called sounds of the ocean, no? Surprise! Its another folder. Lets see whats inside this one. Ok, you gotta be kidding me, two more folders! Let's pick the x64 folder. Now before you think your on a roll here with your copying and pasting, take a second to check that we have two .lib files and one has an "s" on the end of its name. What this is referring to is the static version of the GLEW library. Now I'm not going into all the details of dynamic and static linking here, but to make our lives easier lets pick the glew32s.lib file, as you have probably guessed we are going to statically link GLEW in our project. Before we copy and paste that .lib file we need to head to our solutions directory and go to the Dependencies folder as we have 3 new folders to make. Similar to our UAK folder structure, we are going to do the same thing for GLEW. So, inside Dependencies create a new folder called GLEW (if you can't remember what we did here just go to Visual Studio and right-click your solution file which will be the top-most item in the Solution Explorer list and click "Open Folder in File Explorer"). Inside our newly made GLEW folder, lets make those two new includes and libs folders. With that all done we can now copy and paste the glew32s.lib file into our libs folder we just created. Now we can head to the include folder where we extracted our GLEW download and copy and paste the GL folder into our includes folder. This next step is pretty much a rinse and repeat of what we did earlier to get UAK setup in our project. Going back to Visual Studio, we right-click our project and choose Properties. Let's go to the Linker, General option and look for "Additional Library Directories", selecting the fields drop-down and choosing <Edit...>. To make our lives easier we can double click our UAK entry, copy and paste it underneath and simply change the UAK part of our path to GLEW 😎 Lets not forget the Input section, choose this from the Linker drop-down and enter glew32s.lib in the "Additional Dependencies" field. As a last step we simply need to include our includes (see what I did there). Go to the C/C++ drop-down and select the General option. Click the top "Additional Include Directories" field drop-down (the little drop-down that appears on the far right) and choose <Edit...>. In the new dialog that appears we can do the same trick we did when we linked our GLEW lib file. Copy and paste our existing UAK entry and change the UAK part of our path to GLEW. GLEWing It All Together If you have made it this far then I have to congratulate you. We have successfully included and linked both UAK and GLEW! There are just a few more things we need to set up to get rid of some errors we will inevitably get when starting to use both libraries in our code. If you are still in the Properties dialog of your project then head on over to the C/C++ section and go to Preprocessor. In here we need to set a definition in the "Preprocessor Definitions" field. Clicking in the field, enter the following definition: _ULTRA_APPKIT; This ensures that all the other stuff found in the UAK include files aren't included. With this we are finally ready to start using GLEW, OpenGL and UAK. We need to include one final, important library ... OpenGL. To do this head back to your project properties by right-clicking your project in the Solution Explorer and choosing Properties. Head to the Linker, Input section and in the "Additional Dependencies" field enter: opengl32.lib; An important note, when using GLEW you have to make sure that its initialized after a rendering context has been created. We do need to include one more library, but this one is easy, its a header-only library which means we don't need to do anything with the linker. Head on over to the GLM Github link here and click the green Code button (somewhere near the top-right of the screen) making sure to select "Download ZIP". Once you have downloaded GLM, extract it (the folder will likely be called "glm-master"). Navigate into the extracted folder and you'll see a folder named glm. Copy this entire folder and paste it inside our Dependencies folder. Now, I challenge you to figure out how you should include GLM in your project Properties (if you don't know how to do it check below in the Conclusion section). Without getting into the complexities of writing a shader class and coding and parsing GLSL shaders, I have edited the example code from the UAK documentation to include a Vertex struct for us to get some data into the graphics pipeline (maybe another blog for another time) For now, simply copy and paste the following code into your .cpp file: #include "UltraEngine.h" #define GLEW_STATIC #include <GL/glew.h> #include <GL/GL.h> #include <glm.hpp> using namespace UltraEngine; struct Vertex { glm::vec3 Position; glm::vec3 Normal; glm::vec2 TexCoords; glm::vec3 Tangent; glm::vec3 Bitangent; glm::vec4 Colour; Vertex() { Position = { 0.0f, 0.0f, 0.0f }; Normal = { 0.0f, 0.0f, 0.0f }; TexCoords = { 0.0f, 0.0f }; Tangent = { 0.0f, 0.0f, 0.0f }; Bitangent = { 0.0f, 0.0f, 0.0f }; Colour = { 0.0f, 0.0f, 0.0f, 0.0f }; } Vertex(glm::vec3 position, glm::vec4 colour) { this->Position = { position }; Normal = { 0.0f, 0.0f, 0.0f }; TexCoords = { 0.0f, 0.0f }; Tangent = { 0.0f, 0.0f, 0.0f }; Bitangent = { 0.0f, 0.0f, 0.0f }; this->Colour = { colour }; } }; // Callback function for resizing the viewport bool ResizeViewport(const Event& ev, shared_ptr<Object> extra) { // If the window resize event is captured auto window = ev.source->As<Window>(); // Get the new size of the applications window iVec2 sz = window->ClientSize(); auto viewport = extra->As<Window>(); // Set the position and size of the viewport window viewport->SetShape(200, 8, sz.x - 200 - 8, sz.y - 16); return true; } int main(int argc, const char* argv[]) { // Get the available displays auto displays = GetDisplays(); // Create a window auto window = CreateWindow("OpenGL Example", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); // Create user interface auto ui = CreateInterface(window); // Get the size of the user-interface iVec2 sz = ui->root->ClientSize(); // Create a treeview widget auto treeview = CreateTreeView(8, 8, 200 - 16, sz.y - 16, ui->root); // Anchor left, top and bottom of treeview widget treeview->SetLayout(1, 0, 1, 1); // Add nodes to the treeview widget treeview->root->AddNode("Object 1"); treeview->root->AddNode("Object 2"); treeview->root->AddNode("Object 3"); // Create a viewport window auto viewport = CreateWindow("", 200, 8, sz.x - 200 - 8, sz.y - 16, window, WINDOW_CHILD); // Adjust the size of the viewport when the applications window is resized (this will callback to our ResizeViewport() function) ListenEvent(EVENT_WINDOWSIZE, window, ResizeViewport, viewport); // Initialize an OpenGL context (get a hdc) HWND hwnd = (HWND)(viewport->GetHandle()); HDC hdc = GetDC(hwnd); // Specify the format of the default framebuffer PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, // Flags PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, // Framebuffer colour format (R, G, B, A) PFD_TYPE_RGBA, // Framebuffer colour depth (32 bit) 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Number of bits for depth-buffer 24, // Number of bits for stencil-buffer 8, // Number of render-targets in default framebuffer 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; // Select an appropriate pixel format that is supported by the hdc int format = ChoosePixelFormat(hdc, &pfd); if (SetPixelFormat(hdc, format, &pfd) == 0) { RuntimeError("SetPixelFormat() failed."); } // Create an OpenGL rendering context using our current hdc HGLRC glcontext = wglCreateContext(hdc); if (glcontext == NULL) { RuntimeError("wglCreateContext() failed."); } wglMakeCurrent(hdc, glcontext); if (glewInit() != GLEW_OK) { RuntimeError("Failed to init GLEW"); } // Create vertex data for a triangle Vertex triangle[3]; // Bottom right triangle[0] = Vertex(glm::vec3(0.5f, -0.5f, 0.0f), glm::vec4(1.0f, 0.0f, 0.0f, 1.0f)); // Top triangle[1] = Vertex(glm::vec3(0.0f, 0.5f, 0.0f), glm::vec4(0.0f, 1.0f, 0.0f, 1.0f)); // Bottom left triangle[2] = Vertex(glm::vec3(-0.5f, -0.5f, 0.0f), glm::vec4(0.0f, 0.0f, 1.0f, 1.0f)); unsigned int triVAO; // A value OpenGL can reference when we want to use this object unsigned int triVBO; // Much like the triVAO, we can refernce this VBO with this value // Using the triVAO and triVBO values as a reference to our objects, we generate veretx arrays and buffers using said references glGenVertexArrays(1, &triVAO); glGenBuffers(1, &triVBO); // Bind the VAO first to say which VAO we want to bind subsequent VBOs to, and then we follow up with binding the relevant VBOs glBindVertexArray(triVAO); glBindBuffer(GL_ARRAY_BUFFER, triVBO); // Assigning our triangle array data to our vertex buffer object glBufferData(GL_ARRAY_BUFFER, sizeof(triangle), &triangle, GL_DYNAMIC_DRAW); // Position data glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Vertex::Position)); // Enable the vertex data we formatted above glEnableVertexAttribArray(0); // Colour data glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Vertex::Colour)); // Enable the vertex data we formatted above glEnableVertexAttribArray(1); // Render loop (applications run loop) while (true) { // Check for events const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWPAINT: if (ev.source == viewport) { // Get and set the current size of the viewport iVec2 sz = viewport->ClientSize(); if (sz.x < 1 or sz.y < 1) break; glViewport(0, 0, sz.x, sz.y); // Set clear colour of viewport background glClearColor(0.15f, 0.15f, 0.15f, 1.0f); // Clear colour and depth buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // WE ARE RENDERING HERE // // Work with our triangle vertex array glBindVertexArray(triVAO); glDrawArrays(GL_TRIANGLES, 0, sizeof(triangle) / sizeof(Vertex)); glBindVertexArray(0); HWND hwnd = viewport->GetHandle(); auto hdc = GetDC(hwnd); SwapBuffers(hdc); ReleaseDC(hwnd, hdc); } break; case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; } } return 0; } I will come back to this blog at some point and clean up this code but for now running this code will reveal a cool tree view in a panel on the left of the window and a small OpenGL viewport on the right with a white triangle, success! Conclusion And there you have it. GLEW and UAK working together. From here the world's your oyster. Abstract to your hearts content to make some wicked cool stuff with modern OpenGL. If there are any issues during setup please comment below and I'd be happy to help. P.S. For the people that was wondering how to include GLM the process is the same as when we included UAK and GLEW. Right-click your project and go to Properties, then head to the C/C++ dropdown, choosing the General option. Then add the follow path with those awesome macro's: $(SolutionDir)Dependencies\GLM Depending on if you kept the glm folder lowercase or uppercase, change the GLM part of the path to reflect that. Again, I hope this helped, any questions post below. Stay safe! Slippy
  5. Hello team!! It has been a long time since I was connected here. I hope you are all OK. That no one has been touched by the damn COVID. This week I have finally resumed my work with LEADWERKS, and I want ask you if there is a tutorial, or a site in the WIKI (Learn) that shows how create and display SUBTITLES on the screen inside our games. Is possible? I want to subtitle in English all the dialogues that I have recorded in Spanish in my game. But I can't find anything in GOOGLE, or in the WIKI (Learn), or here in the FORUM. Thank you, and I hope you are doing well! Cheers!!
  6. Hey guys, I was searching the forums for a releated subject, but I couldnt find one, but I could imagine there is one, if so I am sorry to post the same topic again So I am currently trying to come up with a way to handle diffrent objects rendering in the right order. What solutions have you for this problem. For example: I have a trading menu, but my cursor is rendered behind the inventory slots and buttons rendered by the NPC Trader entity. (elements of my trading menu are rendered by two diffrent entities (Player and NPC Trader)) I was thinking about something where you can set a variable "renderPriority" which indicates in which order objects are rendered. So if render Priority is 1 those objects "PostRender" function is called before all the others, then come entities with priority 2,3 and so on. Thats the point I am stuck . How to make the other PostRender functions "wait" unitl the PostRender function of an specific entity is finished. This I a problem I occured pretty often and havent found a solution yet, I mean that you control the order entities call functions like UpdateWorld() or PostRender(). Would really appreciate if somebody can come up with an idea
  7. Hi, I was wondering that I couldn't find any tutorial about creating simple UI elements. I searched the web and the forum for a while, and because I couldnt find anything useful I started this thread. The problem is I dont get how to check whether my mouse cursor is hovering over an element or not. To give you an more exact example: I just finished a simple inventory generation system where you can choose how many columns and slots it has and some other stuff. This works very well. However now I want to implement that, if you click on one of the items collected and shown in the inventory, that they get used/activated. The method I know from previous game developing experience is that you cast a ray from your camera origin through the mouse position and grab the UI elements which get intersected. My questions so far: Info: I only code in LUA. - How to check if my mouse hovers an context object (for example an image drawn with context:DrawImage()) - How to unlock my mouse so that I can move it around freely You would do me a great favor, if you tell me how this works in Leadwerks. Phoenix
  8. I want to make a password pad to put in some numbers. The attached picture is what it looks now, at a resolution of 1080 p. (for 1920 p the green text fits in properly) But as you can see the text is not scaled with the window, so how do I make it right? I can get the top left and bottom right of the screen as x,y vectors, but how do i calculate that the text always is inside of it ?
  9. Currently moved to Linux mint for a while. I've noticed that in the assets and project manager, the text is white and unreadable. This also happens with the file manager (When you go to load a new map or something), and the material editor. However, in the scene tab, the highlighter is called and you can see all the entities selected or not. Also not sure if this is Mint exclusive, but I can say it's apparent using Linux Mint 17.1.
  10. Well met, everyone! I am a new Leadwerker, only having purchased the engine about three days ago. I went running with guns up, opting directly for the Standard Edition on Steam. I am currently a 30 year old college student who is studying in the last semester of computer science. I am currently enrolled in a Unity course. My grades are fine, but I played with Leadwerks for about an hour and was already able to do more and have better productivity with absolutely no instruction than I am half a semester into Unity. Please note, I do not even know either LUA or C++. C# is as close as I get. So yes, I was immediately converted into a Leadwerker based on sheer usability alone. Now that introductions are out of the way, onto the meat and potatoes: I have made those Google goblins earn their keep the past day and half burning up their engine with queries regarding cutscenes, animation methods and techniques, main menu design, UI development, etc. I have ran across some useful information but I am here because I am seeking further clarification (read: I am not trolling). UI/UX/Main Menu: I ran into Aggror's FlowGUI after watching a few of his excellent tutorials on YouTube and nabbed that as fast as I could. It is awesome, easy to set up, and easy to use. So that settled an issue I was having altogether. However, I am also eager to flex my artistic muscles and was wondering if there were a way (hack, file, script, or anything) which would allow me to make a really "artsy" UI system and/or main menu (I am seeing animated smoke, menus popping in and out, and the like). This has been treated, but I am using LE3.4 and most of what I ran into was LE2.x. Keep in mind that Aggror's awesome tool provides a really solid backbone to my efforts. Cutscenes:After furiously Googling for the better part of a couple hours, I ran across suggestions such as LETheora(which is apparently deprecated now). That solution is fine (especially since I really love using opensource tools) but, as stated, seems to be non-functional. I am not well-versed enough in either LUA or C++ to give it CPR, I have additionally encountered posts from this thread and this one which solves the problem programmatically and via toolkit (respectively) in a roundabout fashion. However, they too are old and out of date.I have run into Rick's posts all over these forums, so if you see this Rick, any further advice/suggestion would be MOST welcome! So I wonder if anyone either a.) currently implements cutscenes or b.) has a way to implement cutscenes or c.) would be willing to work with me to find a way to GET cutscenes. Animation: This topic is related to the above. I was going to get the new FaceRig app (a toy, I know) and it caused me to wonder if importing animations into LE was doable in reasonable fashion and if so how it is done most commonly in LE3.4. Apologies for the lengthy post, but I feel that this will provide the most information needful to get the answers I can't seem to discover on my own. Thank you all for your time. Happy Leadwerking!
  11. Hi, I have not been able to find tutorials on making GUI's, UI's and HUD's. I want to create a very simple GUI on the main menu for my game which some text you click on starts the game, goes to the options menu, credits, or exits the game. Also, for when you hover over the text it goes to for instance, the colour red (but not entirely needed, but would be great!). I hope someone can help me out here, it would make my day EDIT: This is what it should look like (just quickly done in paint):
  12. Intro This is a hard post for me to make, I really dislike releasing code that isn't done and polished ( as people will inevitable judge your ability by the code ) on the other hand I've had to realize that if I do not then this will be another entry on my dead project pile - and I do believe that the community could benefit from it.. once it's in a more presentable shape at any rate. For some time now I've been working on porting myGUI to Leadwerks, or well honestly "working" is a bit of a misnomer as according to my version software I've not done anything use full for 5 weeks As somebody ( i forget who ) once said; The hardest part of a any project is finishing it. And that's very much the issue here, I've done all the challenging/fun bits and now there is "just" the finishing it left, so what needs to be done? Current state of the UI The C++ binding is 90% there ​RTT is missing, but should be trivial resource paths from files specified in XML files works but needs more thought (current implementation is guessing where the files are) comments may in places be in Danish (woops) Input handling uses standard leadwerks key inputs, which is less that satisfactory leak detection, it's been a few years since I've last used c++ ( or any unmanaged language ) so I'm quite paranoid about leaks [*]Lua binding lacks real world test to see what is needed [*]Automatic event binding is not yet supporting all widget types ( bascially just a whole lot of typing ) [*]Text labels seems to bleed through overlapping windows ( apparently because your supposed to have them on different layers and the demo does not do this - myGUI is still new to me as well ) [*]Switching between mouse look and cursor mode needs to be standardized ( currently relying on a modified fpsplayer ) [*]Linux only everything *should* work cross-platform but I do not currently have a OpenGL 4 windows machine ( my old media center is a fusion e450 which should in theory be OpenGL 4 compatible - so I may install windows on that at some point ) if anyone want's to try it out on windows I can guide them through the cmake settings required. Why My GUI? The default skin looks nice It's still maintained It has an agreeable license The developers have made a host of tools to actually work with the gui - you can find pre-compiled binaries for windows here ( works well with wine, or you can compile them on linux ) ​Skin creation tool Layout tool Font map tool ( but you can also use true type font's directly ) Widget creation tool etc [*]It's well documented http://mygui.info/docs/index.html [*] What's required in order to participate? At least Leadwerks license and a willingness to contribute, beyond that experience with any of the following is a nice bonus C++ Mercurial Lua valgrind "distributed" collaboration bitbucket Goal The ultimate goal is to provide a royalty free, free to use UI library to any and all Leadwerks users Licensing and commercial use myGUI is licensed under MIT http://mygui.info/#ui-tabs-15 but some of the companion libs have additional licenses, none of which preclude commercial/closed source use. A attribution template that can be copy/pasted into your games 'credit' section is planned. How can I participate? Assuming that I at this point sold you on the idea, shoot me a pm or reply here introducing your self and I'll add you to the bitbucket repository and help you get it working on your machine. (I've no idea how to make a publicly readonly repo there, and I'd rather not enable everybody writing to it all willy nilly) Keep in mind that as a working family father I've only about 2-6 hours / week of 'me' time so there may be some lag in replies but I'll try to be as quick about it as possible
  13. I purchased the indie version earlier this week, fired it up and was able run the tutorial maps and generally have a look around. Yesterday I decided to grab the sci-fi DLC and fired it up to have a look. Steam told me it was downloading a new version of the software so I waited for that to go through. Fired it up, got the splash window and it said it was downloading the DLC, the splash then went but the editor window never appeared. In the stdout the synchronise with workshop all went through ok without errors. The Leadwerks process is running and consuming a little CPU, the window manager believes there is a Leadwerks window and jumps me to it but it is currently not rendering. Decided to purge the application from my machine and download again but I got the same results. My setup is Debian Jessie (testing), latest NVidia drivers, up to date Steam, other steam items are running ok. My experience with Steam and purchases under it so far has been "just use it" so I've not had to worry about doing any problem determination so far. Is there any standard debugging/logging options I can activate to help resolve this?
×
×
  • Create New...