Flip the scrolling horizontally instead of vertically
Before Width: | Height: | Size: 808 B After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 97 B After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 20 KiB |
|
@ -22,20 +22,20 @@ Bullet::Bullet( uint16_t lx, uint16_t ly, uint8_t id )
|
|||
|
||||
if (ID==0)
|
||||
{
|
||||
sx = 0;
|
||||
sy = libnum::num( -6 );
|
||||
sx = libnum::num( 6 );
|
||||
sy = 0;
|
||||
strength = 5;
|
||||
}
|
||||
else if (ID==1)
|
||||
{
|
||||
sx = 0;
|
||||
sy = libnum::num( -3 );
|
||||
sx = libnum::num( 3 );
|
||||
sy = 0;
|
||||
strength = 2;
|
||||
}
|
||||
else if (ID==2)
|
||||
{
|
||||
sx = 0;
|
||||
sy = libnum::num( -6 );
|
||||
sx = libnum::num( 3 );
|
||||
sy = 0;
|
||||
strength = 1;
|
||||
}
|
||||
toberemoved = false;
|
||||
|
@ -53,7 +53,7 @@ void Bullet::Update( float dt )
|
|||
x += sx * a;
|
||||
y += sy * a;
|
||||
|
||||
if (y<-10) toberemoved=true;
|
||||
if (x<-10 || x>azrp_width+10 || y<-10 || y>azrp_height+10) toberemoved=true;
|
||||
}
|
||||
|
||||
void Bullet::Render( )
|
||||
|
@ -63,17 +63,17 @@ void Bullet::Render( )
|
|||
|
||||
if (ID==0)
|
||||
{
|
||||
azrp_image_p8( px-4, py-11, &img_bullet_normal, DIMAGE_NONE );
|
||||
azrp_image_p8( px-img_bullet_normal.width/2, py-img_bullet_normal.height/2, &img_bullet_normal, DIMAGE_NONE );
|
||||
return;
|
||||
}
|
||||
else if (ID==1)
|
||||
{
|
||||
azrp_image_p8( px-4, py-11, &img_bullet_blue, DIMAGE_NONE );
|
||||
azrp_image_p8( px-img_bullet_blue.width/2, py-img_bullet_blue.height/2, &img_bullet_blue, DIMAGE_NONE );
|
||||
return;
|
||||
}
|
||||
else if (ID==2)
|
||||
{
|
||||
azrp_image_p8( px-4, py-11, &img_bullet_laser, DIMAGE_NONE );
|
||||
azrp_image_p8( px-img_bullet_laser.width/2, py-img_bullet_laser.height/2, &img_bullet_laser, DIMAGE_NONE );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,45 +18,45 @@ void Create_Player_Shoot( uint8_t id )
|
|||
|
||||
if (id==0)
|
||||
{
|
||||
Bullet *b = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y-21, id );
|
||||
Bullet *b = new Bullet( (int) MyPlayer->x+21, (int) MyPlayer->y, id );
|
||||
MyPlayerBullets.push_back( b );
|
||||
}
|
||||
else if (id==1)
|
||||
{
|
||||
Bullet *b1 = new Bullet( (int) MyPlayer->x-17, (int) MyPlayer->y, id );
|
||||
Bullet *b1 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y-17, id );
|
||||
MyPlayerBullets.push_back( b1 );
|
||||
|
||||
Bullet *b2 = new Bullet( (int) MyPlayer->x+17, (int) MyPlayer->y, id );
|
||||
Bullet *b2 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y+17, id );
|
||||
MyPlayerBullets.push_back( b2 );
|
||||
}
|
||||
else if (id==2)
|
||||
{
|
||||
Bullet *b1 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y-21, id );
|
||||
Bullet *b1 = new Bullet( (int) MyPlayer->x+21, (int) MyPlayer->y, id );
|
||||
MyPlayerBullets.push_back( b1 );
|
||||
|
||||
Bullet *b2 = new Bullet( (int) MyPlayer->x+17, (int) MyPlayer->y, id );
|
||||
Bullet *b2 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y-17, id );
|
||||
MyPlayerBullets.push_back( b2 );
|
||||
|
||||
Bullet *b3 = new Bullet( (int) MyPlayer->x-17, (int) MyPlayer->y, id );
|
||||
Bullet *b3 = new Bullet( (int) MyPlayer->x, (int) MyPlayer->y+17, id );
|
||||
MyPlayerBullets.push_back( b3 );
|
||||
}
|
||||
}
|
||||
|
||||
void Create_Ennemies( void )
|
||||
{
|
||||
Enemy* e1 = new Enemy( 198, 50, 0);
|
||||
e1->Set_Speed_Vector( 1, -6, 1 );
|
||||
Enemy* e1 = new Enemy( 348, 112, 0);
|
||||
e1->Set_Speed_Vector( 1, 1, -6 );
|
||||
MyEnemies.push_back( e1 );
|
||||
|
||||
Enemy* e2 = new Enemy( 198, 50, 0);
|
||||
e2->Set_Speed_Vector( 1, 6, 1 );
|
||||
Enemy* e2 = new Enemy( 348, 112, 0);
|
||||
e2->Set_Speed_Vector( 1, 1, 6 );
|
||||
MyEnemies.push_back( e2 );
|
||||
|
||||
Enemy* e3 = new Enemy( 198, 50, 1);
|
||||
e3->Set_Speed_Vector( 1, -3, 3 );
|
||||
Enemy* e3 = new Enemy( 348, 112, 1);
|
||||
e3->Set_Speed_Vector( 1, 3, -3 );
|
||||
MyEnemies.push_back( e3 );
|
||||
|
||||
Enemy* e4 = new Enemy( 198, 50, 1);
|
||||
Enemy* e4 = new Enemy( 348, 112, 1);
|
||||
e4->Set_Speed_Vector( 1, 3, 3 );
|
||||
MyEnemies.push_back( e4 );
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ Enemy::Enemy( int16_t _x, int16_t _y, uint8_t _id )
|
|||
x = libnum::num( _x );
|
||||
y = libnum::num( _y );
|
||||
|
||||
dirx = -6;
|
||||
diry = 1;
|
||||
dirx = 1;
|
||||
diry = -6;
|
||||
|
||||
ID = _id;
|
||||
|
||||
|
|
|
@ -35,5 +35,5 @@ void Impact::Render( void )
|
|||
uint8_t dximg = framecount * 15;
|
||||
uint8_t sz = framecount;
|
||||
|
||||
azrp_subimage_p8( x-sz, y-sz, &img_emp_circ, dximg+7-sz, 7-sz, sz*2, sz*2, DIMAGE_NONE );
|
||||
azrp_subimage_p8( x-sz, y-sz, &img_emp_circ, dximg+7-sz, 7-sz, sz*2+1, sz*2+1, DIMAGE_NONE );
|
||||
};
|
|
@ -369,7 +369,7 @@ int main(void)
|
|||
Create_Ennemies( );
|
||||
|
||||
|
||||
MyPlayer = new Player( azrp_width/2, azrp_height/2, 0);
|
||||
MyPlayer = new Player( azrp_width/4, azrp_height/2, 0);
|
||||
|
||||
|
||||
usb_interface_t const *interfaces[] = { &usb_ff_bulk, NULL };
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
#include <azur/gint/render.h>
|
||||
#include "MyAzurShaders.h"
|
||||
#include "starfield.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
uint8_t AZRP_SHADER_PIXELLIST = -1;
|
||||
|
||||
|
||||
__attribute__((constructor))
|
||||
static void register_shader(void)
|
||||
{
|
||||
extern azrp_shader_t azrp_shader_pixellist;
|
||||
AZRP_SHADER_PIXELLIST = azrp_register_shader(azrp_shader_pixellist);
|
||||
}
|
||||
|
||||
|
||||
void azrp_shader_pixellist_configure(void)
|
||||
{
|
||||
azrp_set_uniforms(AZRP_SHADER_PIXELLIST, (void *)azrp_width);
|
||||
}
|
||||
|
||||
|
||||
struct command {
|
||||
uint8_t shader_id;
|
||||
uint16_t length;
|
||||
Pixel * const *data;
|
||||
};
|
||||
|
||||
|
||||
void azrp_pixellist(std::vector<Pixel*> const &list, int fragnum )
|
||||
{
|
||||
prof_enter(azrp_perf_cmdgen);
|
||||
|
||||
struct command cmd;
|
||||
cmd.shader_id = AZRP_SHADER_PIXELLIST;
|
||||
cmd.length = list.size();
|
||||
cmd.data = list.data();
|
||||
|
||||
azrp_queue_command(&cmd, sizeof cmd, fragnum, 1);
|
||||
prof_leave(azrp_perf_cmdgen);
|
||||
}
|
||||
|
||||
|
||||
void azrp_shader_pixellist( void *uniforms, void *comnd, void *fragment )
|
||||
{
|
||||
struct command *cmd = (struct command *) comnd;
|
||||
uint16_t *frag = (uint16_t *) fragment;
|
||||
|
||||
for(int i = 0; i < cmd->length; i++) {
|
||||
Pixel *pix = cmd->data[i];
|
||||
frag[azrp_width * pix->y + pix->x] = pix->c;
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
#include <azur/gint/render.h>
|
||||
#include "MyAzurShaders.h"
|
||||
|
||||
|
||||
uint8_t AZRP_SHADER_PIXEL = -1;
|
||||
|
||||
|
||||
__attribute__((constructor))
|
||||
static void register_shader(void)
|
||||
{
|
||||
extern azrp_shader_t azrp_shader_pixel;
|
||||
AZRP_SHADER_PIXEL = azrp_register_shader(azrp_shader_pixel);
|
||||
}
|
||||
|
||||
|
||||
void azrp_shader_pixel_configure(void)
|
||||
{
|
||||
azrp_set_uniforms(AZRP_SHADER_PIXEL, (void *)azrp_width);
|
||||
}
|
||||
|
||||
|
||||
struct command {
|
||||
uint8_t shader_id;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t color;
|
||||
};
|
||||
|
||||
|
||||
void azrp_pixel(int x1, int y1, int color)
|
||||
{
|
||||
prof_enter(azrp_perf_cmdgen);
|
||||
|
||||
if(x1 >= azrp_width || x1 < 0 || y1 >= azrp_height || y1 < 0) {
|
||||
prof_leave(azrp_perf_cmdgen);
|
||||
return;
|
||||
}
|
||||
|
||||
int frag_first = y1 >> 4;
|
||||
int frag_count = 1;
|
||||
int first_offset = y1 & 15;
|
||||
|
||||
struct command cmd;
|
||||
cmd.shader_id = AZRP_SHADER_PIXEL;
|
||||
cmd.y = first_offset;
|
||||
cmd.x = x1;
|
||||
cmd.color = color;
|
||||
|
||||
azrp_queue_command(&cmd, sizeof cmd, frag_first, 1);
|
||||
prof_leave(azrp_perf_cmdgen);
|
||||
}
|
||||
|
||||
|
||||
void azrp_shader_pixel( void *uniforms, void *command, void *fragment )
|
||||
{
|
||||
struct command *cmd = (struct command *) command;
|
||||
uint16_t *frag = (uint16_t *) fragment;
|
||||
|
||||
frag[azrp_width * cmd->y + cmd->x] = cmd->color;
|
||||
}
|
|
@ -15,12 +15,13 @@
|
|||
|
||||
Star::Star( void )
|
||||
{
|
||||
x = rand() % 396;
|
||||
x = libnum::num( rand() % 396 );
|
||||
y = libnum::num( rand() % 224 );
|
||||
|
||||
size = 1 + ( rand() % 4 );
|
||||
|
||||
sy = libnum::num( size );
|
||||
sx = libnum::num( -1*size );
|
||||
sy = 0;
|
||||
|
||||
int colorrandom = rand() % 4;
|
||||
|
||||
|
@ -43,12 +44,14 @@ void Star::Update( libnum::num dt )
|
|||
{
|
||||
//libnum::num a = libnum::num( dt / 12000.0f );
|
||||
//y += sy * a;
|
||||
y+= sy * dt;
|
||||
x += sx * dt;
|
||||
y += sy * dt;
|
||||
|
||||
if (y >= 224)
|
||||
|
||||
if (y<-3 || y > 226 || x<-3 || x>398)
|
||||
{
|
||||
x = rand() % 396;
|
||||
y = libnum::num( 0 );
|
||||
x = 396;
|
||||
y = libnum::num( rand() % 224 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,9 @@ class Star
|
|||
void Update( libnum::num dt );
|
||||
|
||||
|
||||
uint16_t x;
|
||||
libnum::num x;
|
||||
libnum::num y;
|
||||
libnum::num sx;
|
||||
libnum::num sy;
|
||||
uint8_t size;
|
||||
uint16_t color;
|
||||
|
|
|
@ -281,7 +281,7 @@ void azrp_starfield( void )
|
|||
|
||||
for(int i=0; i<pixels.size(); i++)
|
||||
{
|
||||
pixels[i]->y = (pixels[i]->y + pixels[i]->s) % 224;
|
||||
pixels[i]->x = (pixels[i]->x - pixels[i]->s) % 396;
|
||||
pixels[i]->frag = pixels[i]->y / 16;
|
||||
pixels[i]->off = pixels[i]->y & 15;
|
||||
}
|
||||
|
|