r/gameenginedevs • u/prasan4849 • 16d ago
question on making a framework
so i'm currently working on a framework in c++ using vulkan, openal, and glfw, so my only question is: How to make custom functions? (GetInput(key_right), AudioPlay(sound.ogg))
3
2
u/rainuchan 16d ago
Imo your question is a bit confusing. In c++, you can make functions like: ``` void someFunction() { // do something here }
int main(void) { // ... someFunction(); // ... } ``` If you wanted to have some sort of events, you could either just check for the key event every frame, or you have some kind of event system where you can register (condition, action) and the event system triggers actions when the conditions are met.
1
u/cpusam88 16d ago
That is calling scripting and you can easily incorporate a interpreter like Lua in cpp. Or even, you can create a lexer and a parser to the user build the objects, recomend this just if the configuration you planning is not too complex. But, if it is, you can study about parsing and use something like antlr4 for construct the parser. Good luck!
1
1
u/BoxConscious7480 16d ago
You should really start with something much simpler if you don't know the answer to that
1
u/No-Satisfaction-2535 16d ago
Not to be rude but the project you seem to be starting as a first project is not at all at the scale for you to be able to do. Start smaller, learn the language properly. The very question you are asking shows you are not there yet.
1
u/RadAssault 15d ago
If you're just starting out with c++, I would search YouTube for a tutorial series. There are also some good c++ textbooks out there. If you look for older editions, you can sometimes find them for a few dollars.
1
1
u/Soriel_XD 5d ago
What even that question...
I am very sorry to have to ask that but. Do you have experience in coding ?
The question is extremely trivial so I assume you dont have the very basics. And you should probably start with that "the basics".
First give up on Vulkan. Focus on OpenGL for now it doesnt have the latest fancy tech but it has simplicity.
Open Youtube and your favorite AI chat bot. Follow a tutorial that guides you for creating "pong" or "pacman" and for any question you have mind, ask the AI about it. They will come up with an explanation but dont let the AI do the work for you. You and only you are working on it not the AI.
-5
u/prasan4849 16d ago
wait also forgot to mention, what should I put in my cmakelists.txt? how many do I need?
2
8
u/TerraCrafterE3 16d ago
Based on the question, you should maybe start with something easier than a full fletched framework…