Skip to content

mtaha3249/Space-Shooter-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Space Shooter cpp

Here is a demo video of this project.

Below is the detailed documentation of classes in this project.

Class NameFunction NameClass/Function Description
LAYER 1
Game.cppMain class, entry point of the engine. Initialize and update engine class
LAYER 2
Engine.cppA wrapper for the whole game engine combine multiple classes like Input, GameManager and SDL
Init()Start the rendering of the SDL and initialize the gameobjects from GameManager
Update()Update all gameobjects assigned in the GameManager
Sdlevent()Detect Input and raise event for the Input
Render()Clear the old render and draw a fresh instance of the gameobjects
Clean()Clear the SDL data

GameManager.cpp

(Singleton)

have all the world gameobjects
Init()Initialize the gameobjects and cache in the world object vector
InputListener.hhave virtual function of keydown and keyup
KeyDown()calls when key is down
KeyUp()calls when key is up

InputSystem.cpp

(Singleton)

Raise, bind and remove listeners
RaiseEvent()raise event and call the listener bind
addListener()Registering listener
removeListener()Unregister listener
TextureManager.cppThis class is basically a separate module, whose responsibility is to render the texture
LoadTexture()Load texture with the file path
LoadTexture()Load the given texture, loading should be done manually from the file
LoadFile()Load file
Physics.cpp (Singleton)Contains information of physics, like gravity, optimized value for velocity iteration and position iteration
EngineTime.cppContains the time information like delta time, FPS, frame time etc
LAYER 3
Vector2.cppA vector2 struct with the overload operators
Transform.cppA class consists of position, rotation and scale as a vector2
Rigidbody.cppCreate rigidbody for the multiple overload constructor and register it to the box2d via physics class having the information of physics world
GameObject.cppA class with the virtual function of Draw and Update
Draw()Implemented to the gameobject implementer for the draw
Update()Implemented to the gameobject implementer for the update of the gameobject
Collider.cppA class having 2 virtual functions for the Init and CheckCollision
Init()Initialize the collider for the object
CheckCollision()TODO
LAYER 4
CircleCollider.cppInherits from the Collider class and create a circle collider to given object
Init() overrideSetup collider
CheckCollison() overrideTODO
SetCircleCollider()Setup collider size
BoxCollider.cppInherits from the Collider class and create a Box collider to given object
Init() overrideSetup collider
CheckCollison() overrideTODO
SetBoxCollider()Setup collider size
Helper.cppA class with some utility functions
Print()Various overload for the print log
Random()Various overload to find the random in the given range
DrawCricle()Draw a circle, a gizmo circle
DrawRectangle()Draw a rectangle, a gizmo rectangle
Ship.cppA player class inherit from the gameobject and input listener. It draws ship and initialize the whole system for the player. Used Constructor to draw texture using texture manager
Update() overrideUpdate movement
Draw() overrideDraw ship for the texture
OnKeyDown() overrideMove direction for the keys
OnKeyUp() overrideMove direction for the keys
InitRigidBody()Initialize the rigidbody
Move()Update position to the transform
boundToScreen()Check the player stays in the screen
Asteroids.cppA simple asteroid is spawn and move to the direction, inherited from the gameobject class
Update() overrideUpdate the position of the asteroid
Draw() overrideUpdate the rendering
InitRigidBody()Initialize the rigidbody
InitSpeeds()Get random speed value using helper class
InitDirection()Get random direction value using helper class
Background.cppA simple class inherited from the gameobject class and draw the background space
Update() overrideUpdate the position of the background
Draw() overrideUpdate the render of the background
This project is on the way, physics base movement is happening but the collision isn’t detecting.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Languages