- Ice hockey game system module design:
- GUI Window module: Responsible for the entire game interface drawing, as the entire game software operating vector, the current plan to use the QT form program to create the main window of the game;
- OpenGL module: The drawing of the game elements in the GUI window;
- Physical Engine module: responsible for the calculation of physical logic, mainly collision and speed;
- Timer module: Responsible for controlling the drawing frequency;
- Game elements
The main is how to make robot AI judge the trajectory of the ball and intercept.
- The specific design is as follows:
Module interface: All modules should not use constructors and destructors to ensure initialization and exit in a certain order. Use startup and shutdown instead of constructors and destructors.
1#include <QObject>2 3 classBasemanager: PublicQobject4 {5 Q_object6 7 Public:8 9 Virtual voidStartUp () =0;Ten Virtual voidShutDown () =0; One A PublicSlots: - - Virtual voidUpdate () =0; the};
OpenGL Manager: The general framework is as follows, details to be perfected.
1#include <QOpenGLWidget>2#include"Basemanager.h"3 4 classOpenglmanager: PublicQopenglwidget, PublicBasemanager5 {6 Q_object7 8 Public:9 Ten Staticopenglmanager*getinstance (); One A voidStartUp (); - - voidShutDown (); the - PublicSlots: - - voidUpdate (); + - protected: + A voidPaintEvent (Qpaintevent *Event) Q_decl_override; at - Private: - - Openglmanager (); - - Staticopenglmanager*m_pinstance; in -};
Real-time Control software fourth week operation