More Cross Platform Graphical User Interfaces in C++: Custom Controls

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 มิ.ย. 2024
  • In this video, I create a simple application to edit sprites for use with the olcConsoleGameEngine. That's irrelevant. What is interesting is just how quickly wxWidgets and C++ combine to provide a powerful Rapid Application Development environment, where you can create your own customised GUI components in minutes.
    TH-cam: / javidx9
    / javidx9extra
    Discord: / discord
    Twitter: / javidx9
    Twitch: / javidx9
    GitHub: www.github.com/onelonecoder
    Patreon: / javidx9
    Homepage: www.onelonecoder.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 159

  • @MrKrusten
    @MrKrusten 4 ปีที่แล้ว +104

    You are a goldmine for beginners javid. Your videos for operator overloading and pointers are just so perfectly explained. I wish i could make you quit your job and squeeze out more awsome tutorials. Alot of people underestimate how helpful it can be to watch or read a good explanation of things. I could be reading about a certain concept in c++ for hours and all i need is one good explanation to make it click in my mind.

  • @M2Chris
    @M2Chris 4 ปีที่แล้ว +41

    I wasn't even planning on learning C++ but you are such an amazing teacher I kind of want to now!

    • @javidx9
      @javidx9  4 ปีที่แล้ว +9

      lol thanks tradingpilot, good stuff and good luck!

  • @leonardochiruzzi7642
    @leonardochiruzzi7642 4 ปีที่แล้ว +5

    It is a good starting point. I'll use it to create an icon editor. Infinitely thank you for these videos.

  • @GustavoValdiviesso
    @GustavoValdiviesso 4 ปีที่แล้ว +1

    This is the series I needed. Please continue!

  • @WilliamDye-willdye
    @WilliamDye-willdye 4 ปีที่แล้ว +4

    I've done a lot in TCL/Tk on desktops, and more recently in gtk for embedded systems, but haven't worked with wx, so this was fun to watch.
    One thing that I'd change in a fresh code base is to design it with testability in mind. AutoCAD was originally driven by a command line, with the GUI added later to generate the line commands. Old-fashioned, yes, but fantastic for testing. All user sessions can be saved as a log of line commands, so it's easy to record a session to recreate a bug, then start a new version of the code with the bug fix, then automatically playback all of the steps to recreate the bug. This greatly reduces the need for manual testing, and makes bugs much easier to recreate.

  • @jsflood
    @jsflood 4 ปีที่แล้ว +2

    Nice tutorial. Have a good summer brake.

  • @JustKatoh
    @JustKatoh 4 ปีที่แล้ว +3

    Thank you so much, please keep them coming

  • @aimanal-eryani7809
    @aimanal-eryani7809 4 ปีที่แล้ว +2

    You're awesome, your videos are awesome, Love ya!

  • @sevenedus
    @sevenedus 4 ปีที่แล้ว

    Thanks a lot. Have a good summer brake.

  • @kaungzawhtet8702
    @kaungzawhtet8702 4 ปีที่แล้ว +4

    We are awaiting your next video for wxwidget, sir!

  • @BryanChance
    @BryanChance ปีที่แล้ว

    Priceless! Thank you so much.

  • @davep7176
    @davep7176 ปีที่แล้ว

    This video helped me to finally figure out how to create my own level editors for me little games.

  • @cosmicrdt
    @cosmicrdt 3 ปีที่แล้ว +16

    "Source: Coming Soon!" - Any chance you still have this floating around on your hard drive??? I'd love to poke around in it.

  • @seankayll9017
    @seankayll9017 4 ปีที่แล้ว

    Another class vid. Thanks!

  • @PhilBoswell
    @PhilBoswell 4 ปีที่แล้ว

    Awesome as ever, thank you!

  • @djordjemancic5205
    @djordjemancic5205 4 ปีที่แล้ว

    Hey nice videos. You seem like you really know your stuff, what would you recommend for a beginner in c++? Where to start learning?

  • @videogameepicfails
    @videogameepicfails 2 ปีที่แล้ว +2

    If your tiles don’t change color, make sure your cEditorFrame’s SetColor function looks like it does in 40:22

  • @wojtekburzynski654
    @wojtekburzynski654 4 ปีที่แล้ว +2

    very informative guide, as always. Will you do video about wxFormBuilder or wxSmith or whatever visual builder you use?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +2

      Thanks Wojtek, year I think a 3rd part covering tools would be a good idea

  • @Justajawnie
    @Justajawnie 3 ปีที่แล้ว

    Just stumbled across your channel great stuff. Any advice for generic tips on structuring GUI code? I feel like its easy to let your code spiral out of control as it expands in scope.

  • @defini7
    @defini7 2 ปีที่แล้ว +1

    The best man on youtube

  • @shamaelangel7212
    @shamaelangel7212 4 ปีที่แล้ว +1

    thanx for you work . Hi from chile

    • @javidx9
      @javidx9  4 ปีที่แล้ว +2

      Hey cheers buddy!

  • @Janokins
    @Janokins 4 ปีที่แล้ว

    This is a bit off topic, but this has been a great source of inspiration. When you mentioned that the console game engine only uses 16 colours, I thought "how is that done?" the number of bits used to get 16 doesn't divide into the number of channels. So I would guess that you use 3 of the bits as normal for red green and blue and use the 4th bit to say whether or not the values should be low or high. (If it were set, multiply the colour by 0.5 for example. I would also guess that you use the low black value for transparency.) For my own project I have been wondering how I can make a colour from 5 bits - this is the solution! I can use the 4th and 5th bits to say whether the colour should be low, medium, high or unmodified. Excellent.

    • @Ziplock9000
      @Ziplock9000 4 ปีที่แล้ว +2

      Because it's an index colour palette not RGB

  • @ibrakap
    @ibrakap 4 ปีที่แล้ว +4

    Thx for video javid. Hello

    • @javidx9
      @javidx9  4 ปีที่แล้ว

      Hello! No problem :D

  • @vapon
    @vapon 3 ปีที่แล้ว

    Since we override the OnPaint and OnDraw, can you explain why exactly we also have to EVT_PAINT? Won't those two events be called anyway when the widget needs to be displayed?

  • @SapphFire
    @SapphFire 4 ปีที่แล้ว

    That was really interesting!
    Not sure if you're interested but I think it would be nice to see a tutorial about Cairo.

  • @hemantakakati1103
    @hemantakakati1103 4 ปีที่แล้ว

    Hi, i need some guidance i actually want to make a vector editing software in c++ and want to run the software in web browsers using webassemby. But im confused which gui library is to choose wxWidgets or QT or gui using html css (i dont know if its possible). There are softwares such as construct 3 and figma i wonder how they made their gui and what kind of library they used. As far as i know these softwares are made in c++.

  • @user-vn7ce5ig1z
    @user-vn7ce5ig1z 4 ปีที่แล้ว +7

    43:30 - Doesn't wxWidgets use RAII? 🤨

  • @jamesgrimwood1285
    @jamesgrimwood1285 4 ปีที่แล้ว +4

    I did not know you could multi-select function prototypes and generate all their implementations in one go.

  • @murtiuso
    @murtiuso 3 ปีที่แล้ว

    Wonderful

  • @440s
    @440s 4 ปีที่แล้ว

    Need some advice...I'm just learning to code, done everything in the console(except for some vba on excel) but all the tutorials just teach about variables, loops, clases, pointers, etc.. i swear if i see another video telling me how to declare a variable i'm gonna punch the pc xd so learning gui is a good thing after learning the syntaxis???

  • @yuno3364
    @yuno3364 2 ปีที่แล้ว

    In linux, wxMDIChildFrame doesn't give resizable windows, nor does it at a window menu item. it opens the new documents in maximized tabs

  • @ahmedqasem1591
    @ahmedqasem1591 3 ปีที่แล้ว

    Amazing .👍

  • @goshisanniichi
    @goshisanniichi 4 ปีที่แล้ว

    Nice timing... I've been working on an RPG based in SDL, and I'm getting to the point to where I'm building a level editor. ...Doing it all in SDL and creating the buttons and entire interface myself is turning out to be more of a pain in the arse than it's worth, lol, and I was already intending to switch it over to a wxWidgets-based application. I'm not that familiar with wxWidgets yet, so this is helpful. Although, I'll definitely find it myself in the documentation, since I'm already typing here, I may as well ask here: What are the wxWidgets class(es) to look at for loading and displaying .png files and also drawing partial image files, i.e.: like tiles in a tilesheet?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      By itself, wxWidgets is really not suitable for game rendering. You can embed opengl and similar into it quite easily though. If you do want to use wxWidgets for rendering then it has a set of bitmap classes, which will load png, and it can do rudimentary drawing, including partial sprites etc.

    • @goshisanniichi
      @goshisanniichi 4 ปีที่แล้ว +1

      @@javidx9 I'll be using SDL2 for the in-game rendering, but I'd just want use wxWidgets for the editor.
      But now that I'm thinking about it, wxWidgets has OpenGL functionality... Do you think I could render the tiles onto quads and render and use OpenGL to render a grid of them? It would honestly be overkill for purpose of my 2D sprite-based game, but for performance and probably quality, that would probably the most effective way. ...I'll have to look into this a bit more.

  • @robertboran6234
    @robertboran6234 4 ปีที่แล้ว +1

    Wonderfull.

  • @alojzybabel4153
    @alojzybabel4153 3 ปีที่แล้ว +2

    11:15 What is the difference between Connect and Bind?

  • @lucs0091
    @lucs0091 4 ปีที่แล้ว

    You are awesome

  • @errvega2705
    @errvega2705 4 ปีที่แล้ว

    Can you make a video on the demo scene?

  • @theoriginaltoadnz
    @theoriginaltoadnz 4 ปีที่แล้ว +1

    The vid says Cross platform, but doesn't linux not have MDI child style forms/windows support? so the sprite editor would have to create another separate window from the main window if this was targeted for linux?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      It would create a tabbed interface.

  • @theskillwarzchannel
    @theskillwarzchannel 3 ปีที่แล้ว +2

    Anyone else on Windows having trouble with the Child windows not working properly? The Window menu appears but the windows do not show on screen.

  • @charafbelaid2659
    @charafbelaid2659 4 ปีที่แล้ว

    Why you can't do some wxwidgets course ????

  • @mrg2872
    @mrg2872 4 ปีที่แล้ว +1

    Cool

  • @sergten
    @sergten 3 ปีที่แล้ว +1

    I wonder how common it is to call evt->Skip() in event handlers. If it is as common as the video makes me believe, won't it be a better design on the wxWidgets side to prototype these event handlers as returning bool with "true" as "handled" and "false" otherwise? This way it's more difficult to forget to call Skip().

  • @huskar1u3
    @huskar1u3 4 ปีที่แล้ว

    Can someone tell me how to disable hovering effect on buttons? I have buttons of different colors and this hover effect is just awful, it makes them white on hovering.

  • @ross9263
    @ross9263 4 ปีที่แล้ว +3

    the "MAIN FRAME"

  • @mdaslamknl
    @mdaslamknl 4 ปีที่แล้ว

    Is your program run on Visual Studio 2017
    If yes can you please tell how to do
    Thaks

  • @unodos1821
    @unodos1821 4 ปีที่แล้ว +1

    Nice, why did you stop doing wxwidgets vids?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      Thanks. Who said i stopped?

  • @GoodHomeVideos
    @GoodHomeVideos 4 ปีที่แล้ว +1

    Hi @javidx9, I didn't spend any time surveying the comments to see if anyone else suggested this, but have you heard of Dear ImGui (github.com/ocornut/imgui)? It's a cross-platform, immediate mode GUI library for C++. It integrates really seamlessly with hardware accelerated graphics applications (supports bindings for OpenGL, DirectX, Vulkan, and more), like those you create with the olcPixelGameEngine, and it looks great. I'm not affiliated with the development (even though it's an open-source project), but it seems like a great option for the kind of tool you made in the video. Especially if you want to utilize the capabilities of your engine to also build the toolsets you use to create game assets. You should check it out!

    • @javidx9
      @javidx9  4 ปีที่แล้ว

      Yeah I'm familiar with imgui, but its not that easy to integrate into business like applications. Great for debug layers in games though.

  • @pranjalrajchouhan6100
    @pranjalrajchouhan6100 3 ปีที่แล้ว +1

    Javid plz make more video on wxwidget

  • @HikingUtah
    @HikingUtah 4 หลายเดือนก่อน

    It looks very similar to MFC. I wonder if it has any benefits over MFC if you're only targeting Windows.

  • @khacviet3461
    @khacviet3461 4 ปีที่แล้ว +1

    please do more wxwidgets javid

  • @jaimehislop286
    @jaimehislop286 3 ปีที่แล้ว +1

    Was a great tutorial, but I couldn't get it to work. Does not create any errors (although a few warnings), executes, creates a black grid but I can't draw on it. Must have missed something along the way but don't know what which is a bummer.

    • @videogameepicfails
      @videogameepicfails 2 ปีที่แล้ว

      Same. I think it has something to do with the color selection in main. Or either of the SetColor functions in cCanvas or cEditorFrame.
      Edit: It was cEditorFrame, 40:22 shows what it should look like

  • @saptomudito6779
    @saptomudito6779 4 ปีที่แล้ว +5

    more video turorial wxWidgets please, sir.

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      Hi Sapto, noted ;)

  • @rajatmond
    @rajatmond 3 ปีที่แล้ว

    Can you do one for wxwidgets with pixel game engine?

  • @tx6723
    @tx6723 4 ปีที่แล้ว +1

    please make moreeee wxwidgets

  • @iProgramInCpp
    @iProgramInCpp 4 ปีที่แล้ว

    One idea I had is that you leave out one color and have the colors as 4-bit (including transparency). This would save on space.

    • @Kitulous
      @Kitulous 4 ปีที่แล้ว +1

      he could also make colors as 5 bits and pad the remaining bits as, say, 0 at the end so the number of bits becomes a multiple of 8.

    • @iProgramInCpp
      @iProgramInCpp 4 ปีที่แล้ว

      @@Kitulous yes but that would kinda waste space wouldn't it?

    • @Kitulous
      @Kitulous 4 ปีที่แล้ว +1

      @@iProgramInCpp it would, but that way we won't have to get rid of one color, which kind of sounds bad since we only have 16 colors in the console.

    • @iProgramInCpp
      @iProgramInCpp 4 ปีที่แล้ว

      @@Kitulous ok

  • @mizatokimiya739
    @mizatokimiya739 4 ปีที่แล้ว +1

    Plz more wxwidgets videos

  • @sweetberries4611
    @sweetberries4611 4 ปีที่แล้ว +2

    hello javid!

    • @javidx9
      @javidx9  4 ปีที่แล้ว +2

      Hello!

  • @dosu5064
    @dosu5064 3 ปีที่แล้ว +2

    My code doesn't work. I find that I left empty setcolour() in the cEditorFrame.cpp. I think U forget to show us that part.

    • @dosu5064
      @dosu5064 3 ปีที่แล้ว +1

      @@DrGrunty Thanks

    • @dosu5064
      @dosu5064 3 ปีที่แล้ว +1

      ​@@DrGrunty The other ones have no such problem.
      We are two just copying? :)

  • @andreymoura9865
    @andreymoura9865 4 ปีที่แล้ว

    How I compile my application to Linux if I'm using Windows?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      Cross compiling can be messy. Easiest option is to compile on the system you are targeting. Programs can rely on components provided by the various flavours of linux, which could mean building for one linux wont automatically work for all.

    • @andreymoura9865
      @andreymoura9865 4 ปีที่แล้ว +1

      @@javidx9 Ok. Thanks for reply. Good channel.

  • @dirtyblasion15
    @dirtyblasion15 4 ปีที่แล้ว

    Woohoo 3am video

  • @burntt999
    @burntt999 4 ปีที่แล้ว +1

    if a memory leak was possible on this design, about were would it be located? Not for me, for a friend. Totally for a friend...

  • @maximvelikanov9641
    @maximvelikanov9641 3 ปีที่แล้ว

    A proper programmer would execute anyone for putting in unnamed constants, but I'm not a proper programmer and you justified youself as this is a test project (seen same constants in previous video, hehe)

  • @tx6723
    @tx6723 3 ปีที่แล้ว +3

    Can you please do more WX widgets tutorials please

  • @philipfry9436
    @philipfry9436 4 ปีที่แล้ว +1

    41:30 Oy vey! That one is definitively not Italian. All the stereotypes are there. You even added a 'J' on his shirt so there is no doubt.

    • @philipfry9436
      @philipfry9436 4 ปีที่แล้ว

      @Gek Badass Very few Jews are like that.

  • @EximiusDux
    @EximiusDux 4 ปีที่แล้ว

    Javid pronounces the abbreviation of Graphical User Interface (GUI) as 'Guwis". Mind... blown.

    • @thefoolishgmodcube2644
      @thefoolishgmodcube2644 4 ปีที่แล้ว +4

      Gooey

    • @EximiusDux
      @EximiusDux 4 ปีที่แล้ว +2

      @@thefoolishgmodcube2644 haha indeed. that would be a better way to write it.

  • @cowasakiElectronics
    @cowasakiElectronics 2 ปีที่แล้ว

    Can you do a "how to" for installing WXWidgets with C++ on a fresh install of Visual Studio 2022.... I watched the original video and scoured the internet but if I create a folder C:/Dev/WXWidgets and copy the WXWidgets source code directly from the site then load a fresh install of Visual Studio 2022 (the free version) then follow your video it fails from 286 fatal errors on two separate computers. Building it again and again makes no difference.

    • @javidx9
      @javidx9  2 ปีที่แล้ว

      That's all good, but what's the first error you get?

    • @cowasakiElectronics
      @cowasakiElectronics 2 ปีที่แล้ว

      @@javidx9 First there is a warning saying "The WindowsSDKDir property is not defined" then "Cannot open include file 'stdlib.h' then' math.h' then 'string.h' etc.

    • @cowasakiElectronics
      @cowasakiElectronics 2 ปีที่แล้ว

      I am using the wx_vc16.sln file I double click this and it opens in Visual Studio 2022. I then click Build/Batch Build followed by "Select All" and "Build". I set the environmental variable WXWIN to be "C:\wx\" where wx was the folder I unpacked wxwidgets into so "C:\wx\build\msw\wx_vc16.sln" is the file.

    • @javidx9
      @javidx9  2 ปีที่แล้ว

      Sounds like you've not installed "c++ for desktop development" when you install visual studio.

    • @cowasakiElectronics
      @cowasakiElectronics 2 ปีที่แล้ว

      @@javidx9 Thanks. There were so many options I didn't know what to install and what to leave out. Can it be added or do I need to re-install it all?

  • @painsme2
    @painsme2 3 ปีที่แล้ว

    VS 2019 has an issue with cCanvas object in cEditorFrame. Even though we derived from class wxHVScrolledWindow and called "virtual wxCoord OnGetRowHeight() const, virtual wxCood OnGetColumnWidth() const and returned wxCoord(m_nPixelSize) for both I'm still locked out and unable to make an object of class cCanvas. I went through the documents and all my ideas fail to fix this problem. Not sure if VS 2019 handles pure virtual functions differently than how we do it here. My 2 errors are these functions do not have an overrider. I will leave this comment here incase someone else has this issue however just "wxCoord OnGetRowHeight(size_t row) const override" will fix this issue!

    • @lgbrand3175
      @lgbrand3175 2 ปีที่แล้ว

      Thx Alvis! Now it works for me too.

  • @shiftingsandsgames
    @shiftingsandsgames ปีที่แล้ว

    this code is buggy and as you said slow aaaaaaaaz he11 lmao
    try to click on the empty space to the right of the canvas in the child frame and you'll get pixels filled
    also my Alpha button only works if i set the counter in the loop less than 15 somehow

  • @nikitademodov3446
    @nikitademodov3446 3 ปีที่แล้ว

    Thank you for introducing me to this amazing library! Sadly, you used coloured buttons. These are not supported on macOS and because of that your application is not really cross-platform(which technically makes your title clickbait).

    • @javidx9
      @javidx9  3 ปีที่แล้ว +2

      Thanks... There are platforms other than macOS though!

  • @justins7796
    @justins7796 3 ปีที่แล้ว

    :D :D :D :D

  • @iwbnwif
    @iwbnwif 4 ปีที่แล้ว +1

    Hi, would it be okay to add a link to these two videos on the wxWidgets site? If so please get in touch via the mailing list www.wxwidgets.org/support/mailing-lists/. Many thanks!

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      Hey, sure thing, Im a huge advocate of wxWidgets to friends and colleagues, and have been using it since 2003.

    • @iwbnwif
      @iwbnwif 4 ปีที่แล้ว

      javidx9 Perfect, thank you I will let the admins know 👍

  • @minsin56
    @minsin56 4 ปีที่แล้ว +1

    hewwow owo

    • @javidx9
      @javidx9  4 ปีที่แล้ว +6

      errr... ksjdhfhfsiiwhfhl?

    • @minsin56
      @minsin56 4 ปีที่แล้ว +1

      @@javidx9 owo?

    • @HalValla01
      @HalValla01 4 ปีที่แล้ว

      @@minsin56 xjf ghkdfsdgfs df sadfgu?

  • @cplusplussizeddick1430
    @cplusplussizeddick1430 4 ปีที่แล้ว

    What's a fairly epic C++ project that can be built by an expert level C++ programmer in 24 hours? What kind of project would it take to get a job as an entry level C++ engineer?

    • @srccde
      @srccde 4 ปีที่แล้ว +1

      You can do all kinds of stuff within 24 hours but trying to code as fast as possible will inevitably lead to bad code design and many potential bugs making an "epic" project much less so.

  • @iozkLive
    @iozkLive 3 ปีที่แล้ว

    good video i want to reply on wxpython

  • @gabrielribeiro1927
    @gabrielribeiro1927 4 ปีที่แล้ว

    I can't understand a single thing... And I know some c++...

    • @dangputerz
      @dangputerz 4 ปีที่แล้ว

      watch part one. a couple of times so you "get" what he is talking about.

  • @V0TION
    @V0TION 4 ปีที่แล้ว +5

    hello javid!

    • @javidx9
      @javidx9  4 ปีที่แล้ว +4

      Hello! XD