Completely trash game but I might end my days soon so I push now

This commit is contained in:
Rohmer Maxime
2024-06-13 20:41:18 +02:00
parent e8a745860d
commit e6c9b8d272
11 changed files with 748 additions and 175 deletions
Binary file not shown.
+668 -139
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@
* Generated linker script file for LPC1769
* Created from linkscript.ldt by FMCreateLinkLibraries
* Using Freemarker v2.3.30
* MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 5:58:09 PM
* MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 8:40:30 PM
*/
INCLUDE "MyProject_Debug_library.ld"
+1 -1
View File
@@ -5,7 +5,7 @@
* Generated linker script file for LPC1769
* Created from library.ldt by FMCreateLinkLibraries
* Using Freemarker v2.3.30
* MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 5:58:09 PM
* MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 8:40:30 PM
*/
GROUP (
+1 -1
View File
@@ -5,7 +5,7 @@
* Generated linker script file for LPC1769
* Created from memory.ldt by FMCreateLinkMemory
* Using Freemarker v2.3.30
* MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 5:58:09 PM
* MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 8:40:30 PM
*/
MEMORY
BIN
View File
Binary file not shown.
+8 -7
View File
@@ -14,10 +14,11 @@
../src/SPI.c:262:6:Get_Color_From_Sprite 16 static
../src/SPI.c:268:6:auto_screen_roloff 64 static
../src/SPI.c:278:6:Refresh_Area 72 static
../src/SPI.c:290:6:DrawPlayer 6232 static
../src/SPI.c:310:6:Draw_stars 32 static
../src/SPI.c:320:5:strLen 24 static
../src/SPI.c:330:6:DrawChar 72 static
../src/SPI.c:351:6:DrawText 72 static
../src/SPI.c:359:6:DrawSolidBackground 24 static
../src/SPI.c:367:6:Fill_Gradient 48 static
../src/SPI.c:290:6:Refresh_Player_Area 6240 static
../src/SPI.c:313:6:DrawPlayer 6232 static
../src/SPI.c:334:6:Draw_stars 32 static
../src/SPI.c:344:5:strLen 24 static
../src/SPI.c:354:6:DrawChar 72 static
../src/SPI.c:375:6:DrawText 72 static
../src/SPI.c:383:6:DrawSolidBackground 24 static
../src/SPI.c:391:6:Fill_Gradient 48 static
BIN
View File
Binary file not shown.
+12 -11
View File
@@ -1,11 +1,12 @@
../src/main.c:24:6:init 8 static
../src/main.c:33:6:TIMER0_IRQHandler 8 static
../src/main.c:42:6:EINT3_IRQHandler 16 static
../src/main.c:55:6:increment_scroll 16 static
../src/main.c:62:6:SysTick_Handler 8 static
../src/main.c:72:5:number_of_digits 24 static
../src/main.c:82:6:convert_to_string 40 static
../src/main.c:93:6:scroll_array 32 static
../src/main.c:102:8:CreatePlayer 80 static
../src/main.c:111:6:RefreshPlayer 72 static
../src/main.c:136:5:main 144 dynamic
../src/main.c:25:6:init 8 static
../src/main.c:34:6:TIMER0_IRQHandler 8 static
../src/main.c:43:6:EINT3_IRQHandler 16 static
../src/main.c:56:6:increment_scroll 16 static
../src/main.c:63:6:SysTick_Handler 8 static
../src/main.c:73:5:number_of_digits 24 static
../src/main.c:83:6:convert_to_string 40 static
../src/main.c:94:6:scroll_array 32 static
../src/main.c:103:8:CreatePlayer 80 static
../src/main.c:112:5:min 16 static
../src/main.c:120:6:RefreshPlayer 72 static
../src/main.c:155:5:main 144 dynamic
+24
View File
@@ -287,6 +287,29 @@ void Refresh_Area(Rectangle area){
}
}
}
void Refresh_Player_Area(Rectangle area,Rectangle Hitbox){
Sprite_32x32 sprite = ShipSprite1;
Resize_Window(area);
Write_Cmd(0x2C);
Color color;
for(int y= 0; y < area.Size.Height;y++){
auto_screen_roloff(area,(Point){0,y});
for(int x = 0; x < area.Size.Width+1;x++){
if(y + area.Position.Y >= Hitbox.Position.Y
&& y + area.Position.Y < Hitbox.Position.Y + Hitbox.Size.Height
&& x + area.Position.X >= Hitbox.Position.X
&& 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);
}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);
}
}
}
}
void DrawPlayer(Player player, Rectangle areaToDraw){
Sprite_32x32 sprite = ShipSprite1;
Color color;
@@ -307,6 +330,7 @@ void DrawPlayer(Player player, Rectangle areaToDraw){
}
}
}
void Draw_stars(){
Write_Cmd(0x2C);
for(int y = 0; y < SCREEN_HEIGHT;y++){
+33 -15
View File
@@ -11,6 +11,7 @@
#include "config_LPC1769.h"
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include "GPIO.h"
#include "SPI.h"
@@ -108,9 +109,18 @@ Player CreatePlayer(){
return player;
}
int min(int x,int y){
if(x > y){
return y;
}else{
return x;
}
}
void RefreshPlayer(Point vector){
if(player.Hitbox.Position.Y + vector.Y < 0){
player.Hitbox.Position.Y = SCREEN_SIZE.Height + (player.Hitbox.Position.Y - (0-vector.Y));
//player.Hitbox.Position.Y = SCREEN_SIZE.Height + (player.Hitbox.Position.Y - (0-vector.Y));
player.Hitbox.Position.Y = player.Hitbox.Position.Y & SCREEN_SIZE.Height;
}else{
if(player.Hitbox.Position.Y + vector.Y >= SCREEN_SIZE.Height){
player.Hitbox.Position.Y = vector.Y - (SCREEN_SIZE.Height - player.Hitbox.Position.Y);
@@ -126,14 +136,24 @@ void RefreshPlayer(Point vector){
if(player.Hitbox.Position.X < 0)
player.Hitbox.Position.X = 0;
Size bigSize = {0,0};
bigSize.Width = player.Hitbox.Size.Width + abs(vector.X);
bigSize.Height = player.Hitbox.Size.Height + abs(vector.Y);
Rectangle rect = player.Hitbox;
rect.Position = (Point){0,0};
DrawPlayer(player,rect);
Refresh_Area(player.Hitbox);
Point bigPos = {0,0};
bigPos.X = min(player.Hitbox.Position.X, player.Hitbox.Position.X - vector.X);
bigPos.Y = min(player.Hitbox.Position.Y, player.Hitbox.Position.Y - vector.Y);
bigPos.Y = bigPos.Y % SCREEN_SIZE.Height;
Refresh_Player_Area((Rectangle){bigPos,bigSize},player.Hitbox);
//Rectangle rect = player.Hitbox;
//rect.Position = (Point){0,0};
//DrawPlayer(player,rect);
}
int main(void) {
init();
InitButtons();
InitTimer();
@@ -189,18 +209,16 @@ int main(void) {
momentum.X += vec.X;
momentum.Y += vec.Y;
if(momentum.X > 35)
momentum.X = 35;
if(momentum.X < -40)
momentum.X = -40;
if(momentum.X > 20)
momentum.X = 20;
if(momentum.X < -25)
momentum.X = -25;
if(momentum.Y > 35)
momentum.Y = 35;
if(momentum.Y < -35)
momentum.Y = -35;
if(momentum.Y > 20)
momentum.Y = 20;
if(momentum.Y < -20)
momentum.Y = -20;
RefreshPlayer(momentum);
}
}