Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Topics - iamsickinmymind

Pages: [1]
1
Graphics / [SOLVED] window.draw(sprite) White Screen
« on: March 03, 2018, 10:22:41 am »
Hello,

After searching the whole internet, I'm desperately asking for help.
While executing the code below, I'm getting a white screen instead of the texture!
What might be the cause?
I'm not destructing Texture anywhere, file is loaded into the texture...

Thank you anyway! :)

#include "stdafx.h"
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace sf;

int main()
{

        VideoMode vm(1280, 720);

        RenderWindow window(vm, "TIMBER_VS17", Style::Default);

        Texture backgroundTexture;

        //DEBUG LOADING TEXTURE FROM FILE//
        if (!backgroundTexture.loadFromFile("graphics/background.jpg"))
        {
                std::cout << "LOG:\tCANNOT OPEN THE FILE\n";
        }
        else if (backgroundTexture.loadFromFile("graphics/background.jpg"))
        {
                std::cout << "LOG:\tFILE LOADED SUCCESSFULLY\n";
        }

        Sprite spriteBackground;
        spriteBackground.setTexture(backgroundTexture);
        spriteBackground.setPosition(0, 0);
       
        while (window.isOpen())
        {
                if (Keyboard::isKeyPressed(Keyboard::Escape))
                {
                        window.close();
                }
        }
       
        window.clear();

        window.draw(spriteBackground);

        window.display();

        return 0;
}
 

2
Graphics / [SOLVED] Sprite draw unresolved externals
« on: March 01, 2018, 04:10:33 pm »
Hi there,
While declaring code, I got two errors - Unresolved external symbol and 1 unresolved externals. I see that the first causes the second one. The 'graphics' folder is located in the Project Location:
C:\Users\cpp_shared\documents\visual studio 2015\Projects\test004\graphics

SFML libraries declared in Project->Properties->Debug->Linker->Input:
sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-network-d.lib;sfml-audio-d.lib;

I would be very happy if anyone could help me :)

Code:

// SFML_default.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <SFML/Graphics.hpp>

using namespace sf;


int main()
{
        VideoMode vm(1280, 720);

        RenderWindow window(vm, "TEST", Style::Default);

        Texture backgroundTexture;

        backgroundTexture.loadFromFile("graphics/background");

        Sprite backgroundSprite;

        backgroundSprite.setTexture(backgroundTexture);

        backgroundSprite.setOrigin(0, 0);

        while (window.isOpen())
        {
                if (Keyboard::isKeyPressed(Keyboard::Escape))
                {
                        window.close();
                }
        }

        window.clear();

        window.draw(backgroundSprite); //<--|| Here goes the failure

        window.display();
       
        return 0;
}
 

Pages: [1]
anything