so i've been trying out some super basic stuff with SDL 2 in Xcode. I can't quite figure out how to get the image file path correct. I've done some searching on the subject that led to advice for telling the build phase what files to copy over. That hasn't helped me though. Here's what I currently in terms of file structure & settings:
However, when i try to grab the file like so:
//
// Image.h
// SDLTest
//
// Created by Aaron McLeod on 2013-10-17.
// Copyright (c) 2013 Aaron McLeod. All rights reserved.
//
#ifndef SDLTest_Image_h
#define SDLTest_Image_h
#include <SDL2/SDL.h>
#include <iostream>
class Image {
public:
static SDL_Texture* load_image(const char * filename, SDL_Renderer* renderer) {
SDL_Surface* loaded_image = nullptr;
SDL_Texture* texture = nullptr;
loaded_image = SDL_LoadBMP(filename);
if(loaded_image != nullptr) {
texture = SDL_CreateTextureFromSurface(renderer, loaded_image);
SDL_FreeSurface(loaded_image);
std::cout << "loaded image" << std::endl;
}
else {
std::cout << SDL_GetError() << std::endl;
}
return texture;
}
};
#endif
The else condition gets hit, and i see the error that it could not find the file. The string i pass is "resources/paddle.png"