I am working on a game that is encoded in C ++, and I would like you to change the language at runtime. Currently, a language is selected at compile time, including a header file (which has language definitions), for example:
#include "lan_eng.h"
Therefore, the game does not allow changing the language after the client has been compiled. My question is, is there a way to include files at runtime at runtime? I am new to C ++, so at first I thought I could do something like this:
#define DEF_LANGUAGE_ENG //#define DEF_LANGUAGE_DEN #ifdef DEF_LANGUAGE_ENG #include "lan_eng.h" #endif #ifdef DEF_LANGUAGE_DEN #include "lan_den.h" #endif
Of course, this simplifies maintenance, but the problem is that I believe that it only works at compile time. I would like to be able to store the selected language in a variable (which changes at runtime), and then use this variable to choose which header file to include. Is there a way to do this with header files, or will I have to make a class?
I hope this is not a stupid question; my searches did not give me the results I was hoping for.
Thanks in advance!
source share