Whenever we declare the render(float deltatime) or update(float deltatime), in any class, it automatically become a method that is repeated 60 times per second. But what makes this method repeat itself 60 fps? What makes the method do that? In some classes, I am not implementing any other interface or expending any abstract class but that still makes the render(float deltatim) and update(float deltatime) work. Also, even though I do expend a interface like Game, how does the render(float deltatime) work? I mean, there is no special code within the render() in the Game interface class as well.
Libgdx will do that. Part of the arguments passed to the project generator is
--mainClass MyGame. The libgdx will then look for the methods in that class (either using reflection or by creating it's own class during project generation that refers to that class directly).
After that it's a standard gameloop buried somewhere inside the libgdx code.
One has to write code that does this. libGDX happens to generate this code for you using its project generator tool, to avoid making you build that boilerplate. All it is doing is producing a set of stub source files based on your target platform. For example, this is the file used for desktop platforms.
%MAIN_CLASS% are replaced, by the generator, with the names of your package and game class.
You can see that all this code does is create a new
LwjglApplication and pass it an instance of your class. When constructed,
initialize(), which in turn starts a thread to call the
mainLoop simply runs until the game is done. Within that loop, it does work related to gathering input and updating state and ultimately calls
render() on the listener (your game instance) provided to it.
You can follow a similar path of execution for different platforms you may be interested in; there's nothing magic here. The project generator is just saving you some typing by instantiating the correct things for you, but ultimately all it is doing is copy-pasting some code on your behalf. It does not introspect your source code at all.