Changed texture count in settings

This commit is contained in:
Michael Chen 2018-01-24 14:53:42 +01:00
parent 6aefc442d7
commit 1c227c0dce

View File

@ -25,7 +25,7 @@ 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 = 180, .w = 313, .h = 100 };
Settings_Ball_Texture = IMG_LoadTexture(renderer, "assets/images/ball.png");
@ -35,6 +35,7 @@ void Settings_Initialize (SDL_Renderer* renderer) {
void Settings_Draw(SDL_Renderer * renderer, Scenery * scenery) {
double x;
SDL_RenderCopy(renderer, Settings_Texture, NULL, &Settings_rect);
SDL_RenderCopy(renderer, Settings_Ball_Texture, NULL, &Settings_Ball_rect);
Draw_Slider(renderer, &BV);
@ -67,20 +68,17 @@ void Draw_Slider(SDL_Renderer* renderer,Slider* beta){
if (x > (beta->Bar_rect.x + beta->Bar_rect.w - (beta->Scalar_rect.w) / 2)) {
beta->Scalar_rect.x = (beta->Bar_rect.x + beta->Bar_rect.w - (beta->Scalar_rect.w));
beta->Slider_value = (beta->Bar_rect.x + beta->Bar_rect.w - (beta->Scalar_rect.w) / 2);
}
else if(x<beta->Bar_rect.x+(beta->Scalar_rect.w)/2){
} else if (x < beta->Bar_rect.x + (beta->Scalar_rect.w) / 2) {
beta->Scalar_rect.x = beta->Bar_rect.x;
beta->Slider_value = beta->Bar_rect.x + (beta->Scalar_rect.w) / 2;
}
else{
} else {
beta->Scalar_rect.x = x - (beta->Scalar_rect.w / 2);
beta->Slider_value = x;
}
}
else{
} else {
SDL_RenderDrawRect(renderer, &beta->Scalar_rect);
}
}
} /* Draw_Slider */
void Draw_Ballstate(SDL_Renderer * renderer, Scenery * scenery){
BALL_Draw(renderer, &(scenery->ball));