# Image/Player Fills Whole Screen

**URL:** <https://discourse.libsdl.org/t/image-player-fills-whole-screen/56561>\
**Category:** Game Development\
**Created:** [January 5, 2025, 9:04pm UTC](https://discourse.libsdl.org/t/image-player-fills-whole-screen/56561 "2025-01-05T21:04:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garrett85](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/f1d935/32.png) [@garrett85](https://discourse.libsdl.org/u/garrett85)\
**Post date:** [January 5, 2025, 9:04pm UTC](https://discourse.libsdl.org/t/image-player-fills-whole-screen/56561/1 "2025-01-05T21:04:28Z")

</div>

Studdying C and learning SDL at the same time, trying to at least. In my program below, if I compile and run as is, my tank object fills the entire screen rather than just being placed on top of it, and the image for the player is just 75x75 pixels.

```auto
#include <SDL2/SDL.h>
#include <stdio.h>
#include <stdbool.h>

#define TANKPATH "./assets/tank.bmp"
#define ENEMYPATH "./assets/enemy.bmp"

void moveEntity(Player);

int main(int argc, char *argv[])
{
    if(SDL_Init(SDL_INIT_EVERYTHING) != 0) {
        printf("Failed to initialize SDL\n");
        return false;
    }

    SDL_Window *window = SDL_CreateWindow("Tank", 0, 0, 800, 600, 0);

    SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);

    // SDL_SetRenderDrawColor(renderer, 219, 213, 212, 100);
    SDL_SetRenderDrawColor(renderer, 174, 213, 129, 100);
    SDL_RenderClear(renderer);    

    typedef struct {
        int x;
        int y;
        SDL_Texture *face;
    } Player, Enemy;

    Player tankPlayer;
    tankPlayer.x = 20;
    tankPlayer.y = 20;
    tankPlayer.face = SDL_CreateTextureFromSurface(renderer, SDL_LoadBMP(TANKPATH));

    bool gameRunning = true;

    SDL_Event event;
    
    do {
        SDL_PollEvent(&event);
        if(event.type == SDL_WINDOWEVENT) {
            if(event.window.event == SDL_WINDOWEVENT_CLOSE)
                gameRunning = false;
        }
        else if(event.type == SDL_QUIT)
            gameRunning = false;
        else {
            
            SDL_Delay(1000/60);
            SDL_RenderCopy(renderer, tankPlayer.face, NULL, NULL);
            SDL_RenderPresent(renderer);
        }            
    }
    while(gameRunning);

    SDL_DestroyWindow( window );
    SDL_Quit();

    return 0;
}

void moveEntity(Player)
{
    //
}

```

---

<div class="post-metadata">

**Author:** ![elefantinho](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/e0b2c6/32.png) [@elefantinho](https://discourse.libsdl.org/u/elefantinho)\
**Post date:** [January 5, 2025, 9:28pm UTC](https://discourse.libsdl.org/t/image-player-fills-whole-screen/56561/2 "2025-01-05T21:28:51Z")

</div>

hey, the behavior you described is exactly is expected when you pass NULL as fourth argument of [`SDL_RenderCopy`:](https://wiki.libsdl.org/SDL2/SDL_RenderCopy)

what you want is to create a [`SDL_Rect`](https://wiki.libsdl.org/SDL2/SDL_Rect) with the position in the screen you want to draw. you’d probably put the value 75 for the members `w` and `h`. read the documentation and pay attention to where the origin is. you can keep this rectangle around for when you implement your `moveEntity` function
