C++ Weekly - Ep 224 - RPG In C++20 - Part 5: Dealing With Game Input Events

preview_player
Показать описание
More work on game input events, plus cleanups and refactorings of the ImGui interaction code.

☟☟ Awesome T-Shirts! Sponsors! Books! ☟☟

T-SHIRTS AVAILABLE!

WANT MORE JASON?

SUPPORT THE CHANNEL

GET INVOLVED

JASON'S BOOKS

► C++23 Best Practices

► C++ Best Practices

JASON'S PUZZLE BOOKS

► Object Lifetime Puzzlers Book 1

► Object Lifetime Puzzlers Book 2

► Object Lifetime Puzzlers Book 3

► Copy and Reference Puzzlers Book 1

► Copy and Reference Puzzlers Book 2

► Copy and Reference Puzzlers Book 3

► OpCode Puzzlers Book 1


RECOMMENDED BOOKS

AWESOME PROJECTS

O'Reilly VIDEOS

Рекомендации по теме
Комментарии
Автор

RE: Gamepads and "Standard"; "Press 'X'" means different things depending on what your playing on!

Turbo
Автор

19:00 Instead of those infinitely long switch cases, you could have used a state machine, or used the visitor pattern by inheriting from lambda functions.

akj
Автор

Really interesting series of videos! Really like it.

Btw, `magic_enum` is awesome lib which can magically do enum to string casting for you.

dimeterious_fox
Автор

I love these type of videos. Very instructive.

enggeraldobraz
Автор

Just in case anyone else runs across this: In the ImGuiHelpers::Text function, I had to use fmt::runtime(format) as the first argument to fmt::format. Otherwise, I would get errors about the format not being a constant expression.

bradynglines
Автор

LOL at 13:36 when he is switching to firefox I got an ad for Chromebooks almost like it knew a competitor was about to be shown.

AusSkiller
Автор

I would like to know a bit more about how an event loop actually works. I understand that there is a loop where you read events, fetch, decode, execute, but what is an event and how does the program know about them? Is it like an event stack in memory where the OS pushes events and your program pops one off each iteration through the loop? How does this almost infinite event loop not eat up too much CPU time to do anything else? I have many questions...

NealMiskinMusic
Автор

Just a suggestion: rather than trying to work with every key / joystick etc event. Have actions and key bindings to those actions which are loaded from a config file and saved in an unordered_map.

dabraude
Автор

I was legitimately researching this exact topic last night 😂

ClassyDragon
Автор

4:30 - When reading different aspects of the joystick state, isn't there a race condition issue? Possibly a race against the incoming events?

Omnifarious
Автор

the conventional way to handle keyboard presses is to keep an array of keys and when a key is pressed set that index, when the key is released unset that index

(Key == struct or bool)
Key keys[MAX_KEYS]{};
while(getEvents(&event)) {
switch(event) {
...
case KeyPressed:
keys[event.key] = true;
break;
case KeyReleased:
keys[event.key] = false;
break;
}
...
}
then in the logic one would interrogate the keys array

katanasteel
Автор

Great Episode! However, would it be possible to mute the editor beep, it's quite obnoxious

petermuller
Автор

I know this series is about applying C++20 in a game engine context. However, one follow-up idea would be really interesting: how to make CMake plop out working .ipa and .apk packages. I never found a good guide on how to do that.

disieh
Автор

Man I wish you would stop putting everything into main :-D I have been struggling with making libraries work correctly in your starter template and you just keep not using libraries.

SimonToth
Автор

what ide is this? i saw serenity dev use it as well

Alex-frtd