diff --git a/bin/assets/images/return_button.png b/bin/assets/images/return_button.png new file mode 100644 index 0000000..373be1c Binary files /dev/null and b/bin/assets/images/return_button.png differ diff --git a/bin/assets/images/skins_button.png b/bin/assets/images/skins_button.png index 02cb30f..5ec1873 100644 Binary files a/bin/assets/images/skins_button.png and b/bin/assets/images/skins_button.png differ diff --git a/settings.c b/settings.c index 6e4d55b..106c744 100644 --- a/settings.c +++ b/settings.c @@ -4,6 +4,7 @@ #include #include +#include "breakout.h" #include "settings.h" #define Slider_height 100 @@ -13,9 +14,14 @@ SDL_Texture * Settings_Texture; SDL_Texture * Settings_Ball_Texture; +SDL_Texture * Settings_Skins_Texture; +SDL_Texture * Return_Button_Texture; SDL_Rect Settings_rect; SDL_Rect Settings_Ball_rect; +SDL_Rect Settings_Skins_rect; +SDL_Rect Return_Button_rect; + Slider BV; Slider BS; Slider BT; @@ -25,11 +31,18 @@ bool Settings_IsInit = false; void Settings_Initialize (SDL_Renderer* renderer) { Initialize_Slider(400,300,Scalar_width,Bar_width,Slider_height,1,2,&BV); Initialize_Slider(400,500,Scalar_width,Bar_width,Slider_height,10.0f,20.0f,&BS); - Initialize_Slider(400,700,Scalar_width,Bar_width,Slider_height,0,1,&BT); + Initialize_Slider(400,700,Scalar_width,Bar_width,Slider_height,0,8,&BT); Settings_Texture = IMG_LoadTexture(renderer, "assets/images/settings_title.png"); - Settings_rect = (SDL_Rect){.x = 800, .y = 130, .w=470, .h=150}; - Settings_Ball_Texture = IMG_LoadTexture(renderer, "assets/images/ball.png"); - Settings_Ball_rect = (SDL_Rect){.x = 1200, .y = 300, .w=100, .h=100}; + Settings_rect = (SDL_Rect){.x = 647, .y = 50, .w=626, .h=200}; + + Settings_Ball_rect = (SDL_Rect){.x = 1200, .y = 700, .w=90, .h=90}; + + Settings_Skins_Texture = IMG_LoadTexture(renderer, "assets/images/skins_button.png"); + Settings_Skins_rect = (SDL_Rect){.x = 50, .y = 710, .w=315, .h=70}; + + Return_Button_Texture = IMG_LoadTexture(renderer, "assets/images/return_button.png"); + Return_Button_rect = (SDL_Rect){.x = 30, .y = 30, .w=261, .h=100}; + Settings_IsInit = true; } @@ -38,10 +51,14 @@ void Settings_Draw(SDL_Renderer * renderer, Scenery * scenery) { SDL_RenderCopy(renderer, Settings_Texture, NULL, &Settings_rect); SDL_RenderCopy(renderer, Settings_Ball_Texture, NULL, &Settings_Ball_rect); + SDL_RenderCopy(renderer, Settings_Skins_Texture, NULL, &Settings_Skins_rect); + SDL_RenderCopy(renderer, Return_Button_Texture, NULL, &Return_Button_rect); + Draw_Slider(renderer, &BV); Draw_Slider(renderer, &BS); Draw_Slider(renderer, &BT); - Draw_Ballstate(renderer, scenery); + //Draw_Ballstate(renderer, scenery); + BALL_DrawTexture(renderer, &Settings_Ball_rect, scenery->ball.TextureIndex); mapping(&x, &BS); scenery->ball.Speed = x; mapping(&x, &BT); diff --git a/startmenu.c b/startmenu.c index caf7192..5e21a33 100644 --- a/startmenu.c +++ b/startmenu.c @@ -6,6 +6,7 @@ #include "main.h" extern float XScale, YScale; +extern SDL_Rect Return_Button_rect; SDL_Texture * TITLE_Texture; SDL_Texture * PLAYBUTTON_Texture; @@ -64,4 +65,9 @@ void button_clicked(SDL_MouseButtonEvent b, GameState gameState) { GAME_Escape(); } } + if (gameState == Settings) { + if (clickInRect(b, &Return_Button_rect) == 1) { + GAME_ChangeState(MainMenu); + } + } }