Hi,
I was bored at work so i started to make general c++ classes to facilitate an hypothetical game development.
I made a Game class that can store States, an Entity class that contains a hitbox and can handle collisions on another Entity, a 8-directions movement inheriting from Entity and handling acceleration/deceleration, a Tilemap class able to handle collisions with Entities and load/save to binary file, a Camera class allowing smooth target following (you can set its x/y target and get its viewport x1 x2 y1 y2 to do what you want with...)
But those classes don't use any library (except the c++ standard library) so they don't do any drawing or input handling. For example the Tilemap can't draw itself, but you can inherit your game-specific tilemap class and access the whole array directly to draw it with a graphics lib. The 8-directions movement don't take any input it's just a function "move(int direction)" you'll call yourself after detecting a key press using your input library.
I am wondering, is having a non-library-dependant game engine/framework worth? it's a good or bad practice ? I like the idea, but i dunno if it's a good way of organizing the code.
I haven't tested it on a real game but it sounds good, for example when developing your game you'll made some Player, Enemy or whatever classes inheriting from Entity then adding some library dependant code (graphics/input/sound) to make a fully working object for your game. For Game states you just have to make inherited classes (Level, Menu...) and override the Input, Update and Draw methods.
I searched for game frameworks on google but can't find anything similar, they all include all the stuff like drawing into the engine. What's best practice ? Am i losing time doing this ?
Thanks !