The god damm programm wont crash anymore but still is crappy af
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "Background_image.h"
|
||||
#include "testChart.h"
|
||||
#include "Ship_1.h"
|
||||
#include "Ship_3.h"
|
||||
|
||||
const int SCREEN_WIDTH = 240;
|
||||
const int SCREEN_HEIGHT = 320;
|
||||
@@ -253,7 +254,13 @@ void scroll(uint16_t scroll){
|
||||
}
|
||||
|
||||
void Get_Color_From_Background(Point whereToLook,Color *color){
|
||||
if(whereToLook.Y < 0)
|
||||
whereToLook.Y = whereToLook.Y % SCREEN_HEIGHT;
|
||||
int index = (whereToLook.Y*SCREEN_WIDTH+whereToLook.X)*3;
|
||||
|
||||
if(index < 0)
|
||||
index = 1;
|
||||
|
||||
color->Red = SMPTE.pixel_data[index];
|
||||
color->Green = SMPTE.pixel_data[index+1];
|
||||
color->Blue = SMPTE.pixel_data[index+2];
|
||||
@@ -301,12 +308,15 @@ void Refresh_Player_Area(Rectangle area,Rectangle Hitbox){
|
||||
&& x + area.Position.X < Hitbox.Position.X + Hitbox.Size.Width){
|
||||
|
||||
Get_Color_From_Sprite(sprite,(Point){x-(Hitbox.Position.X - area.Position.X),y-(Hitbox.Position.Y-area.Position.Y)},&color);
|
||||
SendPixel(color.Red,color.Green,color.Blue);
|
||||
|
||||
if(color.Red == 0 && color.Green == 0 && color.Blue == 0)
|
||||
Get_Color_From_Background((Point){area.Position.X+x,(area.Position.Y+y)%SCREEN_HEIGHT},&color);
|
||||
}else{
|
||||
//Get_Color_From_Background((Point){area.Position.X+x,(area.Position.Y+y)%SCREEN_HEIGHT},&color);
|
||||
//SendPixel(color.Red,color.Green,color.Blue);
|
||||
SendPixel(0,0,0);
|
||||
Get_Color_From_Background((Point){area.Position.X+x,(area.Position.Y+y)%SCREEN_HEIGHT},&color);
|
||||
if(y == 0 || y == area.Size.Height -1 || x == 0 || x == area.Size.Width -1)
|
||||
color = (Color){255,0,0};
|
||||
}
|
||||
SendPixel(color.Red,color.Green,color.Blue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user