[SDL2]-SDL_Rect Problem In SDL_RenderCopyEx()

[SDL2]-SDL_Rect Problem In SDL_RenderCopyEx()…

Hi,

I am trying to draw an SDL texture to the screen with the texture’s default width and height.
This is the code I have:
Code:
//-------------------------------------------------------------------------------------------------
void Visuals::DrawSpriteOntoScreen(void)
{
SDL_Rect *destinationRect;
Uint32 *textureFormat;
int *textureAccess;
int *textureWidth;
int *textureHeight;

destinationRect->x = 0;
destinationRect->y = 0;
SDL_QueryTexture(Sprite, textureFormat, textureAccess, textureWidth, textureHeight);
destinationRect->w = *textureWidth;
destinationRect->h = *textureHeight;

SDL_RenderCopyEx(Renderer, Sprite, NULL, destinationRect, 0, NULL, SDL_FLIP_NONE);

SDL_RenderPresent(Renderer);

}

//-------------------------------------------------------------------------------------------------

It compiles fine, but the texture fills the screen?

Any help would be appreciated, thanks!------------------------
JeZ+Lee
JessePalser <AT> Gmail <DOT> com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com

Code:
//-------------------------------------------------------------------------------------------------
void Visuals::DrawSpriteOntoScreen(void)
{
SDL_Rect destinationRect;
Uint32 textureFormat;
int textureAccess;
int textureWidth;
int textureHeight;

destinationRect.x = 0;
destinationRect.y = 0;
SDL_QueryTexture(Sprite, &textureFormat, &textureAccess, &textureWidth, &textureHeight);
destinationRect.w = textureWidth;
destinationRect.h = textureHeight;

SDL_RenderCopyEx(Renderer, Sprite, NULL, &destinationRect, 0, NULL, SDL_FLIP_NONE);

SDL_RenderPresent(Renderer);

}

//-------------------------------------------------------------------------------------------------------------------------
JeZ+Lee
JessePalser <AT> Gmail <DOT> com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com

I’m more surprised that isn’t giving you a crash. You’re supposed to
pass pointers to the int variables where you want the data to be
stored to SDL_QueryTexture (i.e. use the & operator), not pointer
variables.

2013/8/13, JeZ-l-Lee :> [SDL2]-SDL_Rect Problem In SDL_RenderCopyEx()…

Hi,

I am trying to draw an SDL texture to the screen with the texture’s default
width and height.
This is the code I have:
Code:
//-------------------------------------------------------------------------------------------------
void Visuals::DrawSpriteOntoScreen(void)
{
SDL_Rect *destinationRect;
Uint32 *textureFormat;
int *textureAccess;
int *textureWidth;
int *textureHeight;

destinationRect->x = 0;
destinationRect->y = 0;
SDL_QueryTexture(Sprite, textureFormat, textureAccess, textureWidth,

textureHeight);
destinationRect->w = *textureWidth;
destinationRect->h = *textureHeight;

SDL_RenderCopyEx(Renderer, Sprite, NULL, destinationRect, 0, NULL,

SDL_FLIP_NONE);

SDL_RenderPresent(Renderer);

}

//-------------------------------------------------------------------------------------------------

It compiles fine, but the texture fills the screen?

Any help would be appreciated, thanks!


JeZ+Lee
JessePalser <AT> Gmail <DOT> com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com

Is there something wrong with the order in which the e-mails arrive to
the mailing list? Because they seem to be reaching out of order for me
:expressionless:

Is there something wrong with the order in which the e-mails arrive to
the mailing list? Because they seem to be reaching out of order for me
:expressionless:

This is pretty standard for email. Also, if your client
orders the mail by date, it may well use the OP’s date
not the list reflector dates.On 13/08/2013, at 5:35 PM, Sik the hedgehog wrote:


john skaller
@john_skaller
http://felix-lang.org

Yeah, but I mean, I see a message, I reply, and then later I get the
following message which was from before I replied but I didn’t get
until later. That’s the issue.

2013/8/13, john skaller :>

On 13/08/2013, at 5:35 PM, Sik the hedgehog wrote:

Is there something wrong with the order in which the e-mails arrive to
the mailing list? Because they seem to be reaching out of order for me
:expressionless:

This is pretty standard for email. Also, if your client
orders the mail by date, it may well use the OP’s date
not the list reflector dates.


john skaller
skaller at users.sourceforge.net
http://felix-lang.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah, but I mean, I see a message, I reply, and then later I get the
following message which was from before I replied but I didn’t get
until later. That’s the issue.

Yes, I sometimes see the reply to a message I haven’t received yet.On 13/08/2013, at 7:57 PM, Sik the hedgehog wrote:


john skaller
@john_skaller
http://felix-lang.org