Start Adding Game Sequencer
This commit is contained in:
parent
ed95b0c307
commit
630e6d7bba
|
@ -32,6 +32,7 @@ add_custom_command(
|
|||
set(SOURCES
|
||||
|
||||
src/main.cpp
|
||||
src/sequencer/sequencer.cpp
|
||||
|
||||
src/utilities/fast_trig.cpp
|
||||
src/utilities/extrakeyboard.cpp
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
|
||||
#define DEBUG_MODE 0
|
||||
#define USB 0
|
||||
#define MORE_RAM 0
|
||||
#define CALCEMU 1
|
||||
#define MORE_RAM 1
|
||||
#define CALCEMU 0
|
||||
#define OVERCLOCK 1
|
||||
|
||||
|
||||
|
||||
/* usual colors*/
|
||||
|
|
41
src/main.cpp
41
src/main.cpp
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include "shaders/MyAzurShaders.h"
|
||||
|
||||
#include "sequencer/sequencer.h"
|
||||
|
||||
#include "shmup/player.h"
|
||||
|
||||
#include "shmup/particles.h"
|
||||
|
@ -57,7 +59,7 @@ bool screenshot = false;
|
|||
bool record = false;
|
||||
bool textoutput = false;
|
||||
bool exitToOS = false;
|
||||
uint8_t texttodraw=1;
|
||||
uint8_t verbosity=1;
|
||||
|
||||
|
||||
|
||||
|
@ -334,18 +336,18 @@ static void render( void )
|
|||
}
|
||||
|
||||
#if(BIAS)
|
||||
if (texttodraw>=1) Azur_draw_text_shmup(0, 0, "FPS = %.0f", (float) (1000000.0f / elapsedTime) );
|
||||
if (texttodraw>=1) Azur_draw_text_shmup(0, 15, "LAZ = %d", MyPlayer->Lasers.size() );
|
||||
if (texttodraw>=1) Azur_draw_text_shmup(0, 30, "Part.= %d - Bull.= %d", MyParticles.size(), MyPlayerBullets.size() );
|
||||
if (verbosity>=1) Azur_draw_text_shmup(0, 0, "FPS = %.0f", (float) (1000000.0f / elapsedTime) );
|
||||
if (verbosity>=2) Azur_draw_text_shmup(0, 15, "LAZ = %d", MyPlayer->Lasers.size() );
|
||||
if (verbosity>=2) Azur_draw_text_shmup(0, 30, "Part.= %d - Bull.= %d", MyParticles.size(), MyPlayerBullets.size() );
|
||||
|
||||
if (texttodraw>=2) Azur_draw_text_shmup(0,45, "Update = %.3f ms", (float) time_update / 1000.0f );
|
||||
if (texttodraw>=2) Azur_draw_text_shmup(0,60, "Render = %.3f ms", (float) time_render / 1000.0f );
|
||||
if (texttodraw>=2) Azur_draw_text_shmup(0,75, ">Total = %.0f ms", (float) elapsedTime / 1000.0f );
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,45, "Update = %.3f ms", (float) time_update / 1000.0f );
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,60, "Render = %.3f ms", (float) time_render / 1000.0f );
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,75, ">Total = %.0f ms", (float) elapsedTime / 1000.0f );
|
||||
|
||||
#if(MORE_RAM)
|
||||
if (texttodraw>=3) Azur_draw_text_shmup(0,90, "Mem Used : %d", _uram_stats->used_memory + extram_stats->used_memory);
|
||||
if (texttodraw>=3) Azur_draw_text_shmup(0,105, "Mem Free : %d", _uram_stats->free_memory + extram_stats->free_memory);
|
||||
if (texttodraw>=3) Azur_draw_text_shmup(0,120, "Mem Peak Used : %d", _uram_stats->peak_used_memory + extram_stats->peak_used_memory );
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,90, "Mem Used : %d", _uram_stats->used_memory + extram_stats->used_memory);
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,105, "Mem Free : %d", _uram_stats->free_memory + extram_stats->free_memory);
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,120, "Mem Peak Used : %d", _uram_stats->peak_used_memory + extram_stats->peak_used_memory );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -390,10 +392,10 @@ static void get_inputs( float dt )
|
|||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_DEL) && usb_is_open()) {textoutput = true;};
|
||||
#endif
|
||||
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F1)) {texttodraw=0;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) {texttodraw=1;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) {texttodraw=2;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F4)) {texttodraw=3;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F1)) {verbosity=0;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) {verbosity=1;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) {verbosity=2;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F4)) {verbosity=3;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F5))
|
||||
{
|
||||
drawback = !drawback;
|
||||
|
@ -514,7 +516,7 @@ int EntryClockLevel;
|
|||
void InitOverClock( void )
|
||||
{
|
||||
EntryClockLevel = clock_get_speed();
|
||||
clock_set_speed( CLOCK_SPEED_F4 );
|
||||
clock_set_speed( CLOCK_SPEED_F5 );
|
||||
}
|
||||
|
||||
void RestoreOVerClock( void )
|
||||
|
@ -546,7 +548,9 @@ int main(void)
|
|||
|
||||
azrp_starfield_init( 250 );
|
||||
|
||||
InitOverClock();
|
||||
#if(OVERCLOCK)
|
||||
InitOverClock();
|
||||
#endif
|
||||
|
||||
//Create_Enemies( );
|
||||
|
||||
|
@ -672,7 +676,10 @@ int main(void)
|
|||
|
||||
if (canWeAllocateMoreRam) FreeMoreRAM( );
|
||||
|
||||
RestoreOVerClock();
|
||||
|
||||
#if(OVERCLOCK)
|
||||
RestoreOVerClock();
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#include "sequencer.h"
|
||||
|
||||
Sequencer::Sequencer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Sequencer::~Sequencer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sequencer::Load_Sequence( uint16_t sequence )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sequencer::Update( float dt )
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef SEQUENCER_H
|
||||
#define SEQUENCER_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t ID;
|
||||
uint16_t Item;
|
||||
uint16_t Duration;
|
||||
} SequenceItem;
|
||||
|
||||
|
||||
class Sequencer
|
||||
{
|
||||
public:
|
||||
|
||||
Sequencer();
|
||||
~Sequencer();
|
||||
|
||||
void Load_Sequence( uint16_t sequence );
|
||||
void Update( float dt );
|
||||
|
||||
private:
|
||||
uint64_t timecursor;
|
||||
|
||||
std::vector< SequenceItem > GamePlay;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -28,6 +28,10 @@ extern bopti_image_t img_Satellite_Lvl1;
|
|||
extern Background MyBackground;
|
||||
|
||||
|
||||
int laser_angle = 0;
|
||||
int laser_incre = 1;
|
||||
|
||||
|
||||
Player::Player( int16_t _x, int16_t _y, uint8_t _id )
|
||||
{
|
||||
img_mainship1 = &img_player_ship7;
|
||||
|
@ -92,6 +96,15 @@ void Player::Update( float dt )
|
|||
Lasers[i]->sx = libnum::num(xmax);
|
||||
Lasers[i]->sy = y;
|
||||
}
|
||||
|
||||
laser_angle += laser_incre;
|
||||
if (laser_angle>15 || laser_angle<0) laser_incre *= -1;
|
||||
|
||||
Lasers[1]->dx = FastCosInt( laser_angle );
|
||||
Lasers[1]->dy = FastSinInt( laser_angle );
|
||||
|
||||
Lasers[2]->dx = FastCosInt( laser_angle );
|
||||
Lasers[2]->dy = - FastSinInt( laser_angle );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +309,13 @@ void Player::Activate_Laser( void )
|
|||
isLaser = true;
|
||||
|
||||
Laser *mylaser1 = new Laser( (int) xmax, (int) y, 1, 0, LASER );
|
||||
Lasers.push_back( mylaser1 );
|
||||
Lasers.push_back( mylaser1 );
|
||||
|
||||
Laser *mylaser2 = new Laser( (int) xmax, (int) y, 1, 0, LASER );
|
||||
Lasers.push_back( mylaser2 );
|
||||
|
||||
Laser *mylaser3 = new Laser( (int) xmax, (int) y, 1, 0, LASER );
|
||||
Lasers.push_back( mylaser3 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue