Since the codemap was never committed, here it is from Dec 28 '14
parent
cd85493495
commit
4e51f26559
|
@ -0,0 +1,66 @@
|
|||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Code Map
|
||||
````````````````````````````````
|
||||
This file provides a basic code map for Petite Juliet. It describes each source file and its inteded purpose.
|
||||
|
||||
It should be noted that Petite Juliet only uses C++ classes when they make more sense - as in, for objects such as Sprites or Entities. C functions are used for the basic "game", as there is no need for a state machine or any complex switching between modes.
|
||||
|
||||
Classes could have been used for textures, sounds, etc., but given the smaller scope of Petite Juliet, it was less effort and much cleaner to just implement predefined data in a C-style manner.
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Files
|
||||
````````````````````````
|
||||
main:
|
||||
This file contains, as the name indicates, the main function. The main function handles the initializing of SDL2, the SDL2 libraries, and OpenGL. It is also responsible for loading in the graphics, audio, and shaders. Majority of the variables from the *common libraries are populated from here.
|
||||
After all loading is complete, runGame, as contained in game, is called.
|
||||
|
||||
game:
|
||||
This file contains the runGame function that is effectively the main game loop. It handles input from SDL2, runs physics and game logic, and draws the graphics.
|
||||
|
||||
g_common:
|
||||
These files contain the _game_ variables, such as waves, victory state, entity list, physics constants, and similar.
|
||||
|
||||
v_common:
|
||||
These files contain the graphics-related system variables. This includes the SDL2 and OpenGL context, the width and height of the window, the shader programs, the OpenGL uniform and attribute variables, as well as the texture references.
|
||||
|
||||
a_common:
|
||||
These files contain the audio-related variables. This includes the audio rate, format, channels, and buffers. It also contains the array that holds the game sounds, along with the corresponding constants.
|
||||
|
||||
shader:
|
||||
Functions for compiling a shader from a file, and linking said shaders into a program.
|
||||
|
||||
texture:
|
||||
Contains the functions for loading textures from a file into an OpenGL texture.
|
||||
|
||||
Entity:
|
||||
Contains the base class for Enemy and Juliet. Holds basic properties related to modifying the sprite graphics, moving the Entity, checking collision pixels, taking damage, and running think operations.
|
||||
Enemy:
|
||||
Contains the base class for Enemies. Mainly redefines the think operation of Entity.
|
||||
|
||||
Juliet:
|
||||
Contains the class for the player. As per Enemy, mainly redefines the think operation. Player actions are handled via byte flags.
|
||||
|
||||
World:
|
||||
Poorly named class that defines how a particular Julia Set is handled.
|
||||
|
||||
Sprite:
|
||||
Class responsible for holding the data objects to draw to the screen, such as the sprite quad, spritesheet texture, sprite offset, and frame/animation offsets.
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
How Juliet Works
|
||||
````````````````````````
|
||||
To begin with, the basic "game logic" structure of the engine is:
|
||||
|
||||
* load game data
|
||||
* game loop
|
||||
* handle events such as user input
|
||||
* run the physics loop
|
||||
* check for special conditions such as end-game
|
||||
* set flags based on user input
|
||||
* check wave spawn times
|
||||
* For each entity, run physics, then call entity's doThink function
|
||||
* draw game to screen
|
||||
* draw/process each julia set
|
||||
* grab collision box for next game tick
|
||||
* draw each entity
|
||||
* draw overlays
|
||||
* render!
|
||||
* clean up game data
|
Loading…
Reference in New Issue