Programming a Retro Pop-Up Menu System

Sdílet
Vložit
  • čas přidán 22. 07. 2024
  • Simplicity often masks Complexity in programming. This video shows an extremely easy to use, flexible pop-up menu system, but the engineering behind it is quite complicated in a nerdy, elegant way. I use maps, vectors, recursion, references and operator overloading to implement a retro-style, skinnable menu system.
    Source: github.com/OneLoneCoder/Javid...
    Patreon: / javidx9
    CZcams: / javidx9
    / javidx9extra
    Discord: / discord
    Twitter: / javidx9
    Twitch: / javidx9
    GitHub: www.github.com/onelonecoder
    Homepage: www.onelonecoder.com
  • Věda a technologie

Komentáře • 167

  • @javidx9
    @javidx9  Před 4 lety +19

    Hello! Members of this community have formed a blog community.onelonecoder.com about all sorts of technology, programming, games, tutorials, devlogs and showcases of your work! If you fancy writing an article or two, for now shout out on the Discord server and we'll get you set up.

    • @B4503D
      @B4503D Před 4 lety +3

      Great video as always!

    • @laureven
      @laureven Před 4 lety

      Idea: Many of us are beginners, and if a beginner is trying to learn something new by himself normally it takes 10x more time. Your blog is an awesome idea and maybe it is possible to include a section for beginners, but designed by pro programmers because You guys know what is the best investment of our time. I can google and be able to find many C++ courses but I would have completely no clue is those are any good, and you know many shortcuts. Videos for beginners are super boring but if pros created a small section in Your blog :) for beginners it would be beautiful for many of us. And another question :) when a beginner is able to realize if he is not a beginner anymore ?? :). Personally, I understand objects, templates but till 3 months ago only program in mql5. Recently I decided to start learning c++ (career / health-related reasons) and this is like train in swimming pool and discover the ocean :)...Regards and sorry for long comment :)

    • @WHKnightZ
      @WHKnightZ Před 4 lety

      I have made some games by C++ in my channel, Please give me some comments, Tks!

    • @MortyrSC2
      @MortyrSC2 Před 4 lety

      It's very interesting, I've never seen UI done this way. But would you consider this a production-ready solution or just a protoype to iterate over? Because it bothers me that data is hardcoded. Surely, it would be better to decouple data from code (making generic buttons/submenus and loading specific menu items from file)?

    • @adamodimattia
      @adamodimattia Před 4 lety

      Hi, OLC, I'm a fan and a follower of your teachings. Have a bit of a problem though that I addressed elsewhere, but hasn't been answered... I'm using Windows 8 on Mac and everything is fine, except for when I'm using Pixel Game Engine or Console Game Engine the display window is squeezed along the horizontal axis by a half approximately and gets some stretch along the vertical as well. Any idea what might be the problem? PS. Hopefully, I'm gonna be able to switch to pc soon...

  • @LangleyNA
    @LangleyNA Před 4 lety +38

    _"If one of my children [has] children of its own, then I'm going to call the build function on that child."_
    The world of out-of-context language can be humoring and fun. I need my child to return a pointer to itself so I may reference my child later. Until then, I will store my child into an array. -- with all the other children.

    • @superslayerguy
      @superslayerguy Před 4 lety +7

      No wonder the world thinks that all programmers have aspergers

    • @ArchaicVirus
      @ArchaicVirus Před 4 lety +1

      @@superslayerguy lol

  • @erikhendrickson59
    @erikhendrickson59 Před 4 lety +1

    Your videos have been fantastic! As a very-novice, hobbyist programmer It's really exciting to learn about some of the code (and the logic supporting it) that made so many of my fondest childhood memories possible!

  • @Kaltinril
    @Kaltinril Před 4 lety +30

    So much more elegant than what I did 20 years ago in c.

    • @javidx9
      @javidx9  Před 4 lety +16

      Hi Jeremy, lol, the modern language things make the code smaller, but I wonder at what cost - this implementation is certainly far from performant XD. Thanks as always buddy!

    • @wojtekburzynski654
      @wojtekburzynski654 Před 4 lety +5

      ​@@javidx9 Smaller code usually perform better than longer. Also if fragment of code don't have to be as fast as possible i think it's ok to make it as elegant and easy to read/write/change as possible. But I'm still studying so i may have no idea what i'm talking about.

    • @javidx9
      @javidx9  Před 4 lety +17

      @@wojtekburzynski654 Well yes and no, I could write a very small program in the single line int main() { DoEntireGame(); } but that doesnt necessarily mean that function isnt millions of lines of code XD. However you are right as you get lower down the layers of abstraction, but objects like std::map, though optimised to a degree are still computationally slow, as are any structures which offer great abstraction of functionality, and you should carefully choose which tools you use. In my case, once the menus are configured, I don't need to rely on std::map again, and instead use std::vector, which is very fast by comparison.

    • @davidmcgill1000
      @davidmcgill1000 Před 4 lety +2

      @@javidx9 Showing off the final assembly code to show the bloat C++ adds might be educational.

    • @StarEclipse506
      @StarEclipse506 Před 4 lety

      @@davidmcgill1000 additionally a video on how to optimize the resultant assembly

  • @superslayerguy
    @superslayerguy Před 4 lety +1

    Just want to point out, you do an AMAZING job explaining what's going on in the code while you go over it & I understand everything very clearly, your teaching skills are phenomenal (which is not an easy thing to do, especially in c++)

  • @AngryNasus
    @AngryNasus Před 4 lety +22

    I appreciate the time you take to produce these videos. They've taught me a lot of basics of programming from a person with no knowledge. Keep being awesome.

    • @javidx9
      @javidx9  Před 4 lety +5

      Hey thanks and my pleasure man, always pleased to hear they have been useful!

  • @Ferenc-Racz
    @Ferenc-Racz Před 4 lety

    OMG! You are one of the few youtuber / programmer who creates really meaningfull and usefull contents. Thank you and congratulation for this! You are great!

  • @Salehalanazi-7
    @Salehalanazi-7 Před 4 lety +3

    This feels straight out of a dream. Your work is insane. This is truly inspiring. I really do want to get good and want to explain and give back to the community. I want to be like you

    • @javidx9
      @javidx9  Před 4 lety +2

      lol, thanks for the complements, but I would suggest aiming a little higher... XD

  • @johnvonhorn2942
    @johnvonhorn2942 Před 4 lety +2

    I love your clinical, analytical analyse of the storm;
    * mention storm
    * show storm
    * storm dealt with, now back to the task at end
    Your handling of "Ciara" was god like. You dismissed that storm out of hand.

    • @javidx9
      @javidx9  Před 4 lety

      Ain't got time for storms, there's code to be written...

  • @Borhamus
    @Borhamus Před 4 lety

    DUDE, i just find you! Love the Panel of ff1

  • @fredhair
    @fredhair Před 4 lety +1

    Wow that's quite lovely elegant interface well done.. I'm only 5 mins in and looks great

    • @javidx9
      @javidx9  Před 4 lety

      Thanks fredhair, yeah, I like the fact I dont need to explicitly maintain a hierarchy, nor do I need lots of intermediate stages in the menu's construction. This means its likely I will actually use this tool in future experiments.

  • @oscill8ocelot
    @oscill8ocelot Před 4 lety +1

    I like how you showed how the API is used before you built it. Sometimes when I'm building an API, I'll start by prototyping examples for how I want to interact with it, and then work backwards from there, shaping the implementation to fit the examples until it all works.

    • @javidx9
      @javidx9  Před 4 lety

      Thanks Scritch, it was a tough decision, because on the one hand it works as you describe, but on the other it could completely alienate people who are not as confident, and put them off watching the video.

    • @TheWeepingCorpse
      @TheWeepingCorpse Před 4 lety

      I think that's called "programming to an interface".

  • @speedyc88
    @speedyc88 Před 4 lety +2

    Hello! Javidx9, Another great video I always find your videos are very enjoyable to watch, on a Sunday or when ever you post them on your channel. Keep up the great work. All the best from Speedy C

  • @desmondbrown5508
    @desmondbrown5508 Před 4 lety +1

    Not only is this incredibly interesting and nostalgic, but you used a ton of amazing rudimentary programming concepts and data structures. Very good usage and reasoning for specific data structures that sadly don't see as much use anymore these days (namely stacks). Also you taught me a few things in this video. Been using C# a lot lately and I do miss me some operator overloading. It's easily one of the best parts of c++. Sure it exists but is nowhere near as powerful as C++.

    • @javidx9
      @javidx9  Před 4 lety

      Thanks Desmond, its great to hear you say such things, as I hope my videos are more about the how rather than the end result, so pleased to get this feedback!

  • @vitacell1
    @vitacell1 Před 4 lety +2

    Man, I love your videos, you are showing amazing things.

  • @rikuchiha540
    @rikuchiha540 Před 4 lety +2

    Very Elegant way to do things ;) Keep up the fine work man

  • @andrewjacobson6932
    @andrewjacobson6932 Před 4 lety +1

    Another awesome video! Honestly don't get why somebody would dislike this.

  • @Whateverworksism
    @Whateverworksism Před 4 lety +4

    Always exciting with a video, in this case a sizeable video, from Javidx9. You never fail to inspire me to work and practise harder. And I always learn something interesting or gain a new perspective to something, I've already learned. I suspect this video wont be an exception! Thanks for all your work buddy.

    • @javidx9
      @javidx9  Před 4 lety +2

      Thanks man, I think this video introduces lots of new things for people to google, so I hope it does prompt a few people to try and understand some of the more complicated techniques presented.

  • @davidbundgaard
    @davidbundgaard Před 4 lety +1

    I was 501, haha good job @javidx9 on this video very nice and I’m looking forward to see the GUI uploaded and or video about it.

  • @vampiriclion1176
    @vampiriclion1176 Před 4 lety +1

    Omg sir, you are a genius !
    You are really talented

  • @jsflood
    @jsflood Před 4 lety +2

    Awesome video, some great data structure gems you teach us in there, thank you.

  • @Diamonddrake
    @Diamonddrake Před 4 lety +1

    Another great installment!

  • @allmycircuits8850
    @allmycircuits8850 Před 4 lety +3

    Thanks for the video! One little tip: instead of integer division and modulo and ternary operation, you could write:
    nTotalRows = (items.size()+vCellTable.x-1) / vCellTable.x;
    the result is the same.

    • @oqardZ
      @oqardZ Před 4 lety +1

      Good that I checked comments before writing exactly this.

  • @oblivionronin
    @oblivionronin Před 4 lety +4

    great, now i have the FF7 songs stuck in my head for 3 months , Great video !

    • @javidx9
      @javidx9  Před 4 lety

      Thanks Chris! And that's a bad thing?

    • @oblivionronin
      @oblivionronin Před 4 lety

      javidx9 not at all !

    • @Asdayasman
      @Asdayasman Před 4 lety +1

      Last I heard, it was "Fire3" not "Firaga". :)

    • @ArchaicVirus
      @ArchaicVirus Před 4 lety

      @@Asdayasman I thought those spell names were from kingdom hearts

  • @ItsHyomoto
    @ItsHyomoto Před 4 lety +2

    I got really excited, I thought you were trying to solve something I was working on. Unfortunately this was not the case. That said, it did give me an idea for a solution I might try out later so it was worth the watch!

    • @javidx9
      @javidx9  Před 4 lety +3

      Well that's all I can hope for! If it gives people ideas, then it worked, so thank you!

  • @ArchaicVirus
    @ArchaicVirus Před 4 lety

    Please upload more videos, we are all hungry for more content! Thank you

  • @skilz8098
    @skilz8098 Před 4 lety +1

    Very nice and robust design. I had worked through a video tutorial series working with Modern OpenGL v3.3+ using shaders, and within that Shader Engine, we created a fully dynamic GUI system that can produce similar results to this. However, within that system, we also wrote two file parsers one in binary that would allow you to draw any renderable type object, the other was related to the GUI system that would allow you to specify where and how to draw different GUI elements including boxes, list boxes with different text alignment capabilities, scrolling, and even sprite objects including animated sprite sheets and more via the designed scripted language. What I liked about that design is that after the parser was completed you could modify the text file for the GUI loader and just run your application again without having to recompile or rebuild the project from changing values within the program. It does it dynamically for you at run time by loading in the objects and their values at runtime!
    If other viewers are interested more in that video series; I would highly recommend visiting www.marekknows.com and check out the Shader Engine Series! Marek's video series has taught me quite a bit about 2D and 3D Graphic-Game Engine design and many different techniques in programming in general! Don't get me wrong; I really like this approach too, but I'm always interested in seeing similar things being done from many different perspectives! It gives you great intuition when working on your own projects!

  • @enzymeboost8386
    @enzymeboost8386 Před 4 lety +1

    Just want to say thank you. i have learned so much from you. Great content

    • @javidx9
      @javidx9  Před 4 lety

      Thanks Enzyme, good to hear!

  • @victorlucki8586
    @victorlucki8586 Před 4 lety

    Superb content as always. Thank you very much.

  • @uvadroid
    @uvadroid Před 4 lety +1

    I had been wondering about this very concept of GUI some time ago. I eventually found a solution using good old polymorphism. I didn't understand exactly how your approach works, but mine does exactly the same thing. I have to admit however, yours is respectably less repetitive in terms of syntax.

  • @sevenedus
    @sevenedus Před 4 lety

    Thank you very much for inspiring thousand of people

  • @mr.roboter
    @mr.roboter Před 4 lety +1

    Thank you for your teaching

  • @TravelingMooseMedia
    @TravelingMooseMedia Před 4 lety

    Amazing! I'm having a great time using the pixel game engine

  • @bradleychristensen1574
    @bradleychristensen1574 Před 4 lety +2

    Hey, I love your videos. Have you considered doing a video about making a flexible UI and menu system for a game from scratch? Or is that too tedious haha

  • @lucasmachado6202
    @lucasmachado6202 Před 4 lety

    The new ported theme from C# is so much better. Best update in Visual Studio for a while haha

  • @elliottrecord5570
    @elliottrecord5570 Před 4 lety +1

    I think programming a system which uses a Visual Abstraction layer is so interesting because of the requirement to map data structures to pixels (in this video's context). I'm currently working with Machine Intelligence algorithms and that's all about finding a data structure which maps to your problem domain - so it's a similar challenge to overcome pragmatically. I was going to write about the process of implementing it at a high-medium level so it should be easy to follow along and I wondered if I could post it to the website if someone was interested?
    OLC, I use [C# + WPF + (Prism Library for MVVM pattern)] at work, and so I'm only able to see how much WPF abstracts away for me when looking at how you approached this problem. I find watching the implementation of your programming videos so beneficial because it helps find my feet when solving my own problems - and I can see that it's not as difficult to conceptualise as I thought, once you get your brain thinking in these ways.
    Now that I'm programming my own projects at home and taking design patterns seriously, these insights into your solutions help to expand my "problem solving repository" so to speak. Thank you for making these interesting and useful videos!

    • @javidx9
      @javidx9  Před 4 lety

      Thanks Elliott. If you want to devlog or write articles for the community blog, then register on the site (it takes a few moments to respond) and i'll see about you getting author credentials. It's even better if you shout out on the discord server, because we have a live chat just for authors.

  • @Bonfra04
    @Bonfra04 Před 3 lety

    hey there, do you plan on releasing the windowing extension you showed in this video any time soon? it's just awesome

  • @jorgengullstrand5988
    @jorgengullstrand5988 Před 3 lety

    How do you attach a action to it? Want to use it as main menu but I just can't figure it out

  • @samuelhulme8347
    @samuelhulme8347 Před 3 lety

    Have you got the download for the complex ui system or a guide on how to make it?

  • @ogr2
    @ogr2 Před 4 lety

    Thanks javidx9 for this great tutorial. I am interested if you are planning on doing a tutorial to make the "widgets" applied to the pixelgameengine, like the code you show on the minute 6:17, or it is possible to upload it? Regards.

  • @corretorortografico5534

    Where can I learn more about your engine?

  • @merlemuliem377
    @merlemuliem377 Před 4 lety +5

    Man this channel looks so awesome man why i didnt found u earlier =(
    but with which video should i start ? im rly confused on ur channel ^^
    u have some order for me to learn and recreate ur projects for myself ? would be a real experience !
    best channel ive ever seen for REAL PROGRAMMING !

    • @javidx9
      @javidx9  Před 4 lety

      Thanks Merlemulie, I somewhat intentionally dont have a video order, but most of those titled "Code-It-Yourself" are pretty much fully encapsulated projects that people appear to enjoy coding along to.

    • @merlemuliem377
      @merlemuliem377 Před 4 lety

      @@javidx9 Ok so u dont think i shouldnt do it in any logical order, just go on any "Code-it-Yourself" Series right ? ^^

    • @javidx9
      @javidx9  Před 4 lety

      @@merlemuliem377 Perhaps start with Tetris?

    • @merlemuliem377
      @merlemuliem377 Před 4 lety

      @@javidx9 Well for real i think i will start with it ^^ Just after ive finished my 1010 pages Book about C++ Programming ... well maybe site by site ... Yeah i know i have a looooong Way to go =)

  • @rioarifando7305
    @rioarifando7305 Před 4 lety +1

    You are amazing man

  • @tommy2nes
    @tommy2nes Před 4 lety

    hey javidx9, what do you make of handmade hero? I tried to follow it once but drove me crazy how fast the guy talked, i had to slow it down to 0.5 speed and even then it was insanely fast XD

  • @chrishulk1
    @chrishulk1 Před 3 lety

    I love this guy.

  • @warmCabin
    @warmCabin Před 4 lety

    When I need to round stuff, I like to use this trick:
    (items.size() - 1) / vCellTable.x + 1
    This will always get you the number of rows you need, no extra divisions or logic.

  • @Nikarus2370
    @Nikarus2370 Před 4 lety +1

    On the "9 Patch palette". I wonder if any early games (specifically NES/SNES and their counterparts era) used a 4 patch palette to save space? IE, in a 4, you'd have 1 corner (that is then mirrored as needed to make other corners) a vertical border (mirrored for other side) horizontal border (mirrored) and a background. Or perhaps a 3 patch, where the corner is mirrored as normal, but then some diagonal mirroring is done to the vertical border tile to make it a horizontal tile (which is then mirrored to make a top or bottom as needed)

    • @javidx9
      @javidx9  Před 4 lety +1

      Hi Nika, on the NES its unlikely as the background tiles are not mirror-able. If the menus were rendered as sprites it would be possible, but this would be a sloppy way to produce a static rectangle of information. No doubt, NES artists had to be creative with how things are constructed though, and reuse as many tiles in different places as possible, Super Mario Bros clouds being the bushes for example.

  • @user-sd9ed8vz7p
    @user-sd9ed8vz7p Před 3 lety

    31:11 if the sName is "root" because we didn't constructed the menuObject with string, why it is not appears root, root, root, root, root, but Attack, Defend, Esacape, Item, Magic?
    Is it using key of the map instead of sName for drawing the string?
    (34:44)

    • @javidx9
      @javidx9  Před 3 lety +1

      For sub menus it uses key name, for leaves it uses the specified name.

  • @psyjax2
    @psyjax2 Před 4 lety

    What Image editor are you using?

  • @chrislaing7108
    @chrislaing7108 Před 4 lety +1

    Oooh just like that, er, 'First Reality' game on the NES... Very nice!

  • @laureven
    @laureven Před 4 lety +24

    I'm curious how many times in a week You will be asked: "when You will release the extension to the game engine ?"? :):). Everything is looking absolutely awesome. As always thank You and Regards

    • @javidx9
      @javidx9  Před 4 lety +5

      Lol Marcin, I thought exactly the same thing, I'm gonna have to finish the GUI extension off now aren't I? XD

    • @mrsantana9094
      @mrsantana9094 Před 4 lety

      I'm also making a 2d game engine myself, mine uses the Windows GDI.

  • @ogr2
    @ogr2 Před 4 lety +1

    Hi @javidx9, I would like to know if it is possible to share the GUI example program you show on the video. It will be interested in create one for the pixelgameengine, to don't use external libraries. Regards.

    • @javidx9
      @javidx9  Před 4 lety

      Hi Oscar, at the moment it isnt released, simply because it isnt finished yet.

    • @ogr2
      @ogr2 Před 4 lety

      @@javidx9 woah, are you planning on making some type of GUI for PGE?

  • @slvrization
    @slvrization Před 4 lety +3

    Thanks for the video!
    Final fantasy

  • @ColossalMcBuzz
    @ColossalMcBuzz Před 4 lety +1

    You may have covered this elsewhere, but why do you prefer Hungarian notation?

  • @NoMercy8008
    @NoMercy8008 Před 4 lety +2

    So, first of all, this is a great video on a great channel, thanks a lot for all of that! :)
    I really enjoy your videos and have learnt quite a lot from them, which is always super appreciated!
    I know I've been a very quite viewer so far, and I'm sorry for that, but this time I have a question/topic I wanna "discuss" :D
    In your implementation, every menuobject has a Build() function that basically calculates all the necessary internal values, etc etc, which the user has to manually call for the menuobject to be able to actually draw itself.
    I'm wondering, wouldn't it be (slightly) easier to use if the menuobject had some sort of "dirty" flag that would automagically be set to true whenever the menu somehow gets changed, so that the DrawSelf(...) function could just check that flag and call the Build() function whenever the dirty flag is true (and then the Build() function would set it back to false, of course)?
    I know that that would incur a slight overhead each frame, since every menuobject has to evaluate that dirty flag, but I feel that might be something you could live with for the sake of making it easier to use. I guess it would also eliminate a potential spot for errors, after all it is very much possible to simply forget the Build() function.
    So yeah, is that something you thought about? If so, why did you decide against it? Are there any downsides I am missing?

    • @javidx9
      @javidx9  Před 4 lety +2

      Thanks NoMercy and its a good question! It is quite common in GUI systems to have a dirty flag, or even as far as a dirty region rectangle, assuming the underlying principle is only draw what you need too. I would completely recommend doing this if you expect the menu system to have dynamic content. In the clip of my GUI framework shown at the start I do exactly this, and I go one step further, each window is effectively a new sprite, so I can move it around but I never have to redraw the contents unless something signals that they need changing. In this instance however, my needs dont require dynamism, so its a fire and forget menu construction with just the one call to build of the root menu. lol, one of the things I was trying to resist (and I learnt the hard way through my prototype) was adding to much! Originally I had check boxes, and progress bars, but the video would have become far too long...

    • @NoMercy8008
      @NoMercy8008 Před 4 lety +2

      @@javidx9 Sounds like it would be very interesting to see a video (or probably way more than one since it seems rather complex) about that GUI framework :D
      But there's only so much time in the day and I imagine that producing these videos takes lots of time, so again thanks a lot, really appreciate it :)

  • @ratchet1freak
    @ratchet1freak Před 4 lety

    I wouldn't mind seeing the same menu style implemented in an immediate mode style api.
    So you can do something like
    if(menu(magic)){
    if(menuLeaf(fire)doFire();
    }

  • @1985stout
    @1985stout Před 4 lety +1

    Thankyou

  • @gabrielferrer8061
    @gabrielferrer8061 Před 4 lety +2

    Hi David.
    Cool stuff as usual!
    I point out some topics you could do a video about.
    * Linear, quadratic/cubic interpolation.
    * Bresenham line, circle, ellipse algorithm.
    * Anti aliasing with alpha channel.
    And I'm curious. What happened with the NES emulator? Will you do a follow up?
    Thanks.

    • @javidx9
      @javidx9  Před 4 lety

      Those are some good topics, its possible ive covered them before buried in other videos i suppose. New NES videos coming soon :D though there is not much left to talk about.

  • @Booooomoyo
    @Booooomoyo Před 4 lety +16

    Reminds me of Final Fantasy

    • @javidx9
      @javidx9  Před 4 lety +27

      Its from the series Final Fontusy, definitely not the franchise you mention XD

    • @KaosFireMaker
      @KaosFireMaker Před 4 lety +4

      @@javidx9 what? I could have sworn it was from "Last Legend" :p

  • @bashthecode7559
    @bashthecode7559 Před 4 lety +1

    Hi, I wanted to report a bug on your website. Please head over to the projects HTML and scroll to the last one titled "Personal Stuff" and click on it. It throws a 404 Error!
    Anyways love your channel a lot, helps learn very comprehensive C++!

  • @artaway6647
    @artaway6647 Před 4 lety

    Hello, I'm pretty new when it comes to Visual Studio (normally I do web dev and python. What are some stuff needed to follow your videos? Just default? or is there some "workloads" (as Visual Studio call it) I need to install first?

    • @javidx9
      @javidx9  Před 4 lety

      Hey! All you need is Visual Studio2019 community edition, and development for desktop applications installed. After that, check my other channel which shows you how to setup a new VS2019 project for olcPixelGameEngine. Its "javidx9 extra".

    • @artaway6647
      @artaway6647 Před 4 lety

      @@javidx9 thank you for the reply!

    • @artaway6647
      @artaway6647 Před 4 lety

      @@javidx9 by "development for desktop applications" you mean "Desktop development with C++"? do I install the optional stuff as well?

  • @spawnlink
    @spawnlink Před 4 lety +1

    If the number of elements in a vector and the comparison function is fast it is likely more efficient to scan over the vector.

    • @javidx9
      @javidx9  Před 4 lety

      It could well be. For small menu systems perhaps using a map is overkill, but at the same time, I'm sure a few people have since googled std::map and std::unordered_map, which makes it worthwhile in the end.

    • @spawnlink
      @spawnlink Před 4 lety +1

      @@javidx9 Certainly. I brought it up because you mentioned performance and it is not common for people to mention that with a small set of data vectors can be as fast or faster than maps even for random access due to the cost of indirection in a map/hash and it's lack of cache friendliness. That said if the string is dynamically allocating the data you'll still have some indirection. That all said... speed obviously isn't a primary concern with a menu.

  • @roamingcelt
    @roamingcelt Před 3 lety

    So all the time I like the correct use terms. Part of the reason I like watching this channel. But this one set my ear on end. "In many ways, this could be considered a GUI"...
    No it is the literal definition of a GUI. It is the graphical front end that allows users access to functions written in code.

  • @danwalker1494
    @danwalker1494 Před 4 lety +1

    This is beyond my comprehension as I’m new to coding; I recently started coding in python, and I wonder if I beat my head on the wall long enough if I could do the same thing in python. Is it even feasible?

  • @thatsnuts8935
    @thatsnuts8935 Před 4 lety +1

    Cheers Javid!
    i am wondering if you'l make a live stream or a video about the release of C++20 this month. and we discuss new stuff in the standard. will be too much fun godamit! im so excited

    • @javidx9
      @javidx9  Před 4 lety +2

      I "might" do something like that over on Twitch, but don't hold me to that XD I dont want to start using the features until I thoroughly understand them.

    • @thatsnuts8935
      @thatsnuts8935 Před 4 lety +2

      Lol i just forget the fact that you have to learn new stuff too!
      well till then we catch up buddy. have a great week!

  • @smashitround5680
    @smashitround5680 Před 4 lety

    Honestly I have to say thank you for your videos I just got my engineering degree and a big part of it is because of your videos :) thank u so much u have made me a better engineer. ..thank you :) (=^_^=)

  • @stomah9832
    @stomah9832 Před 3 lety

    When will you releae the gui system?

    • @javidx9
      @javidx9  Před 3 lety

      When I finish it. Plenty of others available. Worth searching GitHub for PGE GUI.

  • @hugoboston
    @hugoboston Před 4 lety +3

    You probably get this alot. I am a very beginner at cpp and i was wandering how hard it is to start making these cool console games you make. Do i need alot of experience or could i do it with just being able to make a calculator. Also how to i start. Thanks 😊 also i love you channel

    • @javidx9
      @javidx9  Před 4 lety +3

      Thanks ZZos, the key thing to remember is "everybody has gotta start somewhere" and you have, so that's great! Programming is one of those fields where you will get better only if you put in the practice and have patience. All programmers started off with simple calculators, and basic algorithms, its how you learn the building blocks to make more sophisticated things. Dont give up! Keep practicing!

    • @hugoboston
      @hugoboston Před 4 lety +2

      javidx9 thanks that has really boosted my confidence.

  • @kacperkujawa213
    @kacperkujawa213 Před 4 lety +1

    I have to ask, where do you get knowledge about all of this from?

    • @javidx9
      @javidx9  Před 4 lety +1

      Almost 30 years of messing about, experimenting, practicing, failing and having a whole lot of fun 😁

    • @kacperkujawa213
      @kacperkujawa213 Před 4 lety +1

      @@javidx9 I really appreciate your tutorials sir, you've got very diverse content, from synthesizer to 3D engine. I would like to be like you someday. I wish you further success :D

  • @xtdycxtfuv9353
    @xtdycxtfuv9353 Před 4 lety +2

    ah shit my dude i was wondering when u would next upload

  • @AndroidsReview
    @AndroidsReview Před 4 lety +1

    It would be great if ui layout could be load from json

    • @javidx9
      @javidx9  Před 4 lety

      Whats stopping you? Go for it!

  • @RhoTrepaan
    @RhoTrepaan Před 4 lety +1

    Heh, we seem to have the same storm (well, sort of) going on.

  • @dsmeckt2283
    @dsmeckt2283 Před 4 lety +1

    Final Fantasy thrills.

  • @vancemccarthy2554
    @vancemccarthy2554 Před 4 lety

    It seems complex until you realise the final commands can be put into one long list.

    • @javidx9
      @javidx9  Před 4 lety

      Thats the beauty of this approach in my eyes - its worth going through the extra hoops to establish the data structure when rewarded with a really simple tool to use.

  • @BurningBlueFox
    @BurningBlueFox Před 4 lety +3

    I was just doing a JRPG battle screen for my game when I saw the notification.

    • @javidx9
      @javidx9  Před 4 lety +1

      Quite a coincidence!

  • @err6910
    @err6910 Před 4 lety

    Hi OLC! There is a significant bug in your implementation. The issue is that you return references to objects stored in the vector and that you also increase the size of the vector when you add new menuobjects. At some time, the vector is resized and all references are then dangling. This can happen at any time when chaining the square brackets or when, as a user of the feature, you hold a reference to a submenu. A way to fix that would be to use a std::deque instead, or a list. Keeping references to vector elements must always be done very carefully.

    • @javidx9
      @javidx9  Před 4 lety

      Perhaps im getting old, but could you identify where im "keeping" references to vector elements?

    • @javidx9
      @javidx9  Před 4 lety

      I understand your argument, and im not trying to be awkward.

    • @err6910
      @err6910 Před 4 lety

      Sorry I should have been more explicit. The implementation does not keep a reference but an index. That's ok. The problem is on the user side.
      For example:
      auto& m1 = mo["main"]["menu1"]
      auto& m2 = mo["main"]["menu2"] // may invalidate m1
      auto& m3 = m2["menu3"] // ok
      auto& m4 = m1["menu4"] // UB
      The last line is undefined behavior and can do anything: work, crash, do nothing (but maybe leave a ticking bomb), add menu4 as a submenu of menu2, ...

    • @err6910
      @err6910 Před 4 lety +1

      BTW on a second thought, I think the chaining of square brackets is probably Ok, so the issue is only with keeping a reference.
      And my apologizes for having been so direct, dont get me wrong, I'm not critizing, your videos are amazing and I really enjoy them.

    • @javidx9
      @javidx9  Před 4 lety +1

      Hey no worries man, im totally open to criticism, and i was scratching my head thinking "maybe if this", "what if that" I was completely second guessing myself. Lol, its what makes this hobby fun 😁

  • @iProgramInCpp
    @iProgramInCpp Před 4 lety

    Woah woah woah, can't you make it a bit simpler? I may try I guess

  • @retnikt1666
    @retnikt1666 Před 4 lety

    Just a quick suggestion: invest in a pop filter for your microphone

  • @ViralVibesReal
    @ViralVibesReal Před 4 lety

    W

  • @endowdly
    @endowdly Před 4 lety

    Tables in tables!?
    I smell Lua around the corner...

  • @SquidCoder
    @SquidCoder Před rokem +1

    ChatGPT knows about your libraries. I just spent 3 hours trying to port these ideas to java without thinking to ask if it knew what i was trying to do... :P

  • @aminebel4145
    @aminebel4145 Před 4 lety

    who is java dev but still watch the video and enjoy it

  • @oracleoftroy
    @oracleoftroy Před 4 lety +1

    Re: code at 34:06 - I would not use _count()_ like that. The map has to find the element to see if it exists, then if it does, it has to re-find it to return it, or re-find where it should be to insert it in the correct location.
    Instead look at the _emplace()_ or _insert()_ member functions. They will return a pair with a bool indicating whether it added a new item, and the item (whether it was already existing item or a newly inserted item). One lookup, and does exactly what you want.

    • @BenderdickCumbersnatch
      @BenderdickCumbersnatch Před 4 lety +1

      Speaking of things not to do... He definitely should not hand-code the menu entries and item IDs the way he did. Very ugly code.

    • @oracleoftroy
      @oracleoftroy Před 4 lety +2

      @@BenderdickCumbersnatch True, though it provides a good enough foundation for loading from a config file or or script or similar, so I didn't mind that bit as much. The double map lookup is a common anti-pattern when people use methods like _contains()_ and in the past I praised the stl for not having it, but alas they added it in C++20.

    • @muhammadhaider5677
      @muhammadhaider5677 Před 4 lety

      He's explicitly said that he doesn't care about "best practices" and he'll never try to write optimal code.

  • @theternal
    @theternal Před 4 lety

    15:55 Isn't it called nineslice?

  • @aSameplayer
    @aSameplayer Před 4 lety

    could not find the big thumbs up button :p, so I just give an thumbs up. thats all i can do

  • @OllieLK
    @OllieLK Před 4 lety

    **watching after playing final fantasy VII remake** where are they?

  • @PixelOutlaw
    @PixelOutlaw Před 4 lety

    Game programming today is an absolute mess. I've seen people waste days on font rendering. Sometimes it's best to NOT use a AAA game engine. Single programmers need to focus on techniques like this that get them to the goal fast with time for embellishment later. It's unfortunate that game development is absurdly complex these days if you follow the "normal" path of complex IDE configuration, complex build system, complex code repository system, hand programming a texturing system from scratch (shame on Vulkan for making a graphics more verbose than even native ASM and buffer poking while providing no sensible defaults) and wasting 2 days just getting a camera set up in an engine that is way beyond the scope of anything a single person would have the time and attention span to finish. It's not C++, but man could I whip out a game FAST in Blitzmax. Even libraries like SFML and SDL are annoying because their drawing routines require additional objects to hold on to rather than just pushing to the screen buffer.
    Aaaaaanyway, great job with this menu system!

  • @geminirebirth
    @geminirebirth Před 4 lety +1

    Only issue with this: not very usable for multiple languages. Probably not the most suitable solution, even if it's the easiest one to expand upon, but still this flaw is pretty big if you're thinking in future-proof terms.

    • @javidx9
      @javidx9  Před 4 lety +1

      International support is always tricky, and quite frankly, neglected by most hobby coders like myself. I guess I would adopt the approach that the older computer games take and have a character set with international symbols, they seemed to manage it back then. That being said, I would not construct huge user interfaces in this manner, its useful for limited quick selections but not a great deal else.

    • @geminirebirth
      @geminirebirth Před 4 lety +1

      @@javidx9 Besides the encoding for strings, an ideal solution would be to use string references, or maybe something akin to what QT uses for translations, with lookup tables.

    • @michaelmahn4373
      @michaelmahn4373 Před 4 lety

      @@geminirebirth You could also easily build those menus dynamically from files instead of hardcoding them into C++. And then just have files like gui_en.dat, gui_fr.dat, gui_de.dat, ...
      That's how I would do it.

    • @geminirebirth
      @geminirebirth Před 4 lety

      @@michaelmahn4373 Yeah, that's a solution. I would leave the text part separated from the hierarchy and behavior, even if it makes creating the structure a bit more intricate.

  • @ericisedgy3446
    @ericisedgy3446 Před 4 lety

    Ayy first bb

  • @jx4219
    @jx4219 Před 4 lety

    Oooooh. Windows based operating system... That's why it's called windows. Because you have windows in it. I always thought it was because it fits the logo.

  • @henrykkaufman1488
    @henrykkaufman1488 Před 4 lety

    Imho it's overcomplicated. For instance, stack of flat menu structs instead of a tree would be simpler to implement and fill out. You could then, for example, make every menuable thing in the game implement IMenuable interface that would return such a struct, making solution extensible, dynamic and said struct would be a natural protocol between game logic code and user interface code. Just one example of how this can be made simpler, but it's just my opinion, I'm curious what you or someone else would think about this.