Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 650475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:03:25+00:00 2026-05-13T22:03:25+00:00

This is an SDL problem, however I have the strong feeling that the problem

  • 0

This is an SDL problem, however I have the strong feeling that the problem I came across is not related to SDL, but more to C++ / pointers in general.

To make a long story short, this code doesn’t work (edited to show what I really did):

player->picture = IMG_Load("player");
SDL_BlitSurface(player->picture, NULL, screen, &pictureLocation);

I see nothing on the screen. However, when I do it like this, it works:

SDL_Surface* picture = IMG_Load("player.png");
player->picture = picture;
SDL_BlitSurface(player->picture, NULL, screen, &pictureLocation);

I can see the little guy just fine.

The real problem is that I cannot instantiate Player::picture directly. Even when I try

picture = IMG_Load("player.png")

in player.cpp, I end up with a nullpointer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:03:25+00:00Added an answer on May 13, 2026 at 10:03 pm

    I am so stupid. Turns out like I forgot the file extension “.png” every time I tried to store the surface in Player::picture, and conveniently remembered to add it every time I stired it in an SDL_Surface declared in main.cpp.

    I had the feeling I was overlooking something really simple here, but this is just embarassing. What’s a fitting punishment for this?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 512k
  • Answers 512k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well I don't know about the winspool.drv, but you can… May 16, 2026 at 5:37 pm
  • Editorial Team
    Editorial Team added an answer Change if(!valid_image($_FILES['nstitle'],685 , 50)) { into if(!valid_image($tempFile,685 , 50)) {… May 16, 2026 at 5:37 pm
  • Editorial Team
    Editorial Team added an answer select r.id, count(a.id) as Count from ReporterTbl r left outer… May 16, 2026 at 5:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I have a general function that is supposed to handle any event in the
I've successfully built SDL from source using bcc 5.5.1 but any SDL test application
I'm looking for an alternative to SDL that supports multiple windows on multiple display
I have been making several projects to compile small SDL code tutorials from a
I have a game that I have made in C# and it installs and
This is a sort of trivial question but something I've been wondering about. In
This has been driving me crazy for 2 days. I have been trying to
This is my first post, so please be gentle. I've been playing around with
Using C++ I built a Class that has many setter functions, as well as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.