Kireita Posted August 4, 2020 Share Posted August 4, 2020 Hey Guys, i am working on a network system for unigine but i need the following things: argc and argv[] i want to have a task running each frame or in the background and i know unigine takes argc and argv[] in the main.cpp but i dont know how to pass it to the appworldlogic.h or .cpp here is a snippet of the code. maybe there is a way to make it a global value through the code. and this snippet is what i need to run each frame or in the background: server.SendPackets(); server.ReceivePackets(); time += deltaTime; server.AdvanceTime(time); if (!server.IsRunning()) break; yojimbo_sleep(deltaTime); the server runs but i need this specific snippet of code to always run, that is why i need argc and argv[] to initialize it first. Link to comment
Kireita Posted August 4, 2020 Author Share Posted August 4, 2020 topic can be solved! some1 from discord helped me with this piece of code: const auto arg_num = Unigine::Engine::get()->getNumArgs(); for (int i = 0; i < arg_num; ++i) const auto arg = Unigine::Engine::get()->getArg(i); and i was able to solve my problem by making these 2 lines: int argc = Unigine::Engine::get()->getNumArgs(); char* argv = (char*)Unigine::Engine::get()->getArg(0); and now my client can connect to the server :D Link to comment
Recommended Posts