项目作者: linussjo

项目描述 :
A game engine for 2D game development
高级语言: C
项目地址: git://github.com/linussjo/linussjo_engine.git
创建时间: 2019-10-21T13:39:31Z
项目社区:https://github.com/linussjo/linussjo_engine

开源协议:

下载


linussjo_engine

A game engine for 2D game development

How to make a world

Create a class that inherits from engine::world.

example:

  1. class example_world: public engine::world{
  2. public:
  3. start_world(unsigned int, unsigned int);
  4. void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
  5. protected:
  6. void first_prepare(engine::graphic::graphic_engine &ge, engine::physic::physics_engine &pe);
  7. void prepare(engine::graphic::graphic_engine &ge, engine::physic::physics_engine &pe);
  8. void on_iteration(engine::graphic::graphic_engine &ge, engine::physic::physics_engine &pe);
  9. };

Then in main() get the singleton linussjo_engine and create the example world and then start it with given window size. The window size and the world size does not need to be the same.

example:

  1. #include "linussjo_engine.hpp"
  2. #include "example_world.hpp"
  3. const unsigned int window_width{1000}, window_height{750};
  4. int main()
  5. {
  6. engine::linussjo_engine *le = &engine::linussjo_engine::getInstance();
  7. le->show_fps = true;
  8. auto s = std::make_shared<example_world>(window_width,window_height);
  9. le->start(s, window_width, window_height);
  10. }

To build it

Engine

In the directory engine, run:
cmake .
make

example

To create the examples and link the engine:
(First build the static engine library)
In the diectory example, run:
cmake .
make

To run the example

./test_game

Dependencies

FreeType2
OpenGL
GLFW
GLEW
GLUT
C++17

License

MIT