1
thanks man. i looked back at the code for our project and that was also there :oops:
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
You get a white sprite because the associate sf::Image is no more available.
Your Background::Load function is good as it returns a copy of the image but then on the line 'sf::Sprite background(Background::Load("Data/background.bmp"));' the returned image is not stored anywhere and is destroyed on the same line.
You can fix this with this "great" solution (using an image manager is way better as soon as you have multiple image) : repalce the above line by these two :Code: [Select]sf::Image background_image = Background::Load("Data/background.bmp");
sf::Sprite background(background_image);
#include <SFML/Graphics.hpp>
#include"Background.hpp"
int main()
{
// Create the main window-width, hieght
sf::RenderWindow window(sf::VideoMode(800, 600), "Connect 4");
window.SetFramerateLimit(15);
//load images
sf::Sprite background(Background::Load("Data/background.bmp"));
background.Move(200,200);
// Start the game loop
while (window.IsOpened())
{
// Process events
sf::Event event;
while (window.PollEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
window.Close();
}
// Clear screen
window.Clear();
window.Draw(background);
// Update the window
window.Display();
}
return EXIT_SUCCESS;
}
sf::Image Background::Load(string filename)
{
sf::Image image;
if( !image.LoadFromFile(filename) )
{
//fail
}
else
{
return image;
}
}
Quote from: "grandmasterhack"radeons work with 1.6 you must be on something older.Not if you're using recent drivers.
Quote from: "grandmasterhack"i've read that but when i do use that how do i detect collision since every thing is off?Game logics like collision detection and response are normally independent of the graphical representation (i.e. also of the sf::View).
Yes, don't worry about that. It's like this since several months, maybe years. And indeed the only place where people talk about SFML is the official website, because I put many efforts in providing all the resources that users need here.
Actually, sf::View does everything you need for a 2D camera. How it works is explained in the tutorials and in the documentation.
[pseudo code]
if(key_press.RIGHT)
offset_x++;
tile.setpostion(x + offset_x);
Of Linux/packaging, probably
Well, this is a forum about SFML, not about Linux packages. You'd better post in a dedicated forum.
Use proper CMake install paths and then just use CPack to create deb and rpm packages for you.