Timeline for Whats a proper way to design a GUI event system?
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 28, 2019 at 20:00 | comment | added | user346466 | @BenCottrell i do agree with you on this point, but what i'm trying to do is write a GUI library from Scratch (literally), like all of the rendering, event handling, layout management, etc. i'm not looking for shortcuts since the best way to learn something is by actually doing it, that's why i don't want to rely on existing APIs to do the work for me. i can off course (probably should) use a pre-written library when working on a "real" project, but for a personal for-fun project like this, i don't think that the result actually matters that much, as long as i'm learning something new | |
Nov 27, 2019 at 19:36 | comment | added | Ben Cottrell | @IshoAntar That shouldn't matter really - cross-platform GUI libraries often contain a large amount of platform-specific code which can't be reused between different platforms. You'd write the library in a way that anyone who uses the library doesn't need to write platform-specific code, just by encapsulating the platform-dependent API calls behind some standard interfaces/wrappers. The key to that is having a sensible interface which users of your library can use without needing to care about the underlying platform-specific/API stuff. | |
Nov 27, 2019 at 11:39 | vote | accept | CommunityBot | ||
Nov 27, 2019 at 11:39 | comment | added | user346466 | That's really cool, i never actually though of doing it that way, i'll try implementing it and see if it works out. | |
Nov 27, 2019 at 11:27 | comment | added | T. Sar | @IshoAntar Then you update the map! Just change the points of the edited area (which you know, since you're drawing it in the first place) to point to the correct ones and you're set. Once the layout changes/menu closes, you'll have to redraw again - and thus, update the pointers once more. | |
Nov 27, 2019 at 11:27 | comment | added | Theraot | @IshoAntar the idea would be to make it a bitmap that you can paint when widgets change or move. By the way, if your only concern is making it cross platform, you could isolate the API of each platform behind adapters with a common interface and load the right one for the platform on runtime, | |
Nov 27, 2019 at 11:24 | comment | added | user346466 | @T.Sar-ReinstateMonica That's an interesting approach, actually. but how would that work if the GUI layout changes? if you switch to another menu for example. | |
Nov 27, 2019 at 11:22 | comment | added | user346466 | @BenCottrell Actually in my case that wouldn't workout (not without a lot of headache, atleast), since the library is suposed to be cross-platform. thats why i'm trying to "write one from scratch". | |
Nov 26, 2019 at 13:36 | answer | added | Theraot | timeline score: 4 | |
Nov 26, 2019 at 13:28 | comment | added | T. Sar | [pssst - just a hint. Instead of iterating, consider using a bidimensional array as a map for the screen, with a 1 pixel = 1 position in it. Add the click event pointers to the cells of the array, and voilà - direct access to everything, no iteration needed. Memory is cheap!] | |
Nov 26, 2019 at 13:05 | review | Close votes | |||
Dec 4, 2019 at 3:05 | |||||
Nov 26, 2019 at 13:00 | comment | added | Ben Cottrell | Most GUI libraries are wrappers around the operating system's own API, so the typical approach would simply be to use whatever the O/S provides already (i.e. by hooking directly into its API) - the OS will always be better at doing this than anything that you'd be able to build yourself simply because the OS is already responsible for managing those controls/components and already owns the communication between those and your hardware inputs. | |
Nov 26, 2019 at 12:50 | review | First posts | |||
Dec 4, 2019 at 20:40 | |||||
Nov 26, 2019 at 12:46 | history | asked | user346466 | CC BY-SA 4.0 |