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.


Messages - KyleGBC

Pages: [1]
1
General / Re: Storing Textures
« on: February 01, 2019, 12:01:25 am »
viewBox and Background are defined in game.h.
If getTexture returns a pointer, is there a way to accomplish what I'm trying to do?
(Sorry if this is a stupid question, I'm very much a novice)

2
General / Storing Textures
« on: January 30, 2019, 04:50:45 am »
So I have this class and it wants to be able to store the texture of a sprite, change the texture, and then when the object passes out of scope, change the texture back to the original. The problem I'm having is that I can't find a way to store the original texture.
Details
=====
  • Using dynamic SFML 2.4.2
  • Using Visual Studio 2015 community
Here is the header file:
#pragma once
#include "game.h"
using namespace sf;
const Vector2f DEFUALT_START_POSISTION = Vector2f(800, 450);
class Battle {
public:
        Battle(Sprite& controlledCharacter, float playerXNew, float playerYNew, float cameraXNew, float cameraYNew, Texture& area);
        ~Battle();
        float m_playerXInit;
        float m_playerYInit;
        float m_cameraXInit;
        float m_cameraYInit;
        Sprite m_controlledCharacter;
        Texture m_area;
        Texture m_backgroundInit;
};
Here is the .cpp:
#include "Battle.h"
using namespace sf;
Battle::Battle(Sprite& controlledCharacter, float playerXNew, float playerYNew, float cameraXNew, float cameraYNew, Texture& area)
        : m_controlledCharacter(controlledCharacter), m_area(area)
{
        m_playerXInit = controlledCharacter.getPosition().x;
        m_playerYInit = controlledCharacter.getPosition().y;
        m_cameraXInit = viewBox.getCenter().x;
        m_cameraYInit = viewBox.getCenter().y;
       
        Texture m_backgroundInit = Background.getTexture();

        controlledCharacter.setPosition(Vector2f(playerXNew, playerYNew));
        viewBox.setCenter(Vector2f(cameraXNew, cameraYNew));
        Background.setTexture(area);
}
Battle::~Battle() {
        m_controlledCharacter.setPosition(Vector2f(m_playerXInit, m_playerYInit));
        viewBox.setCenter(Vector2f(m_cameraXInit, m_cameraYInit));
        Background.setTexture(m_backgroundInit);
}
The line "Texture m_backgroundInit = Background.getTexture();" has the problem:"No suitable constructor exists to convert from 'const sf::Texture' to 'sf::Texture'"
How can I store the texture info?

3
General / Re: Problem with sprites/textures
« on: March 29, 2018, 05:44:05 am »
The suggested solution worked, no runtime error, no weird characters, but there is still no sprite drawn, and there are still the debug messages seen in the original post.

4
General / Problem with sprites/textures
« on: March 29, 2018, 12:44:45 am »
When I try to load a texture, create a sprite with that texture, and then draw that sprite, I get a bunch of weird characters in the console and then a runtime error.
==Details==
  • I am running Windows 10, with a Nvidia quadro K5000M graphics card
  • Using dynamic SMFL 2.4.2
  • Using Visual Studio 2015 community
Here is the code:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream>

int main()
{
        sf::Texture myTexture;
        myTexture.loadFromFile("Images/profilePicture.jpg");
        sf::Sprite mySprite;
        mySprite.setTexture(myTexture);
        sf::RenderWindow window(sf::VideoMode(200, 200), "SFMLgame");
        sf::Clock clock;
        sf::CircleShape shape(100.f);
        while (window.isOpen())
        {
                sf::Time theTime = clock.getElapsedTime();
                std::cout << theTime.asSeconds() << std::endl;
                sf::Event event;
                while (window.pollEvent(event))
                {
                       
                        switch (event.type)
                        {

                        case sf::Event::Closed:
                                window.close();
                                break;


                        case sf::Event::MouseMoved:
                                break;

                        }
                       
                }

                window.clear(sf::Color::Cyan);
                window.draw(mySprite);
                window.display();
        }
       
        system("pause");
        return 0;
}
The console is attached, no other window is created
The debug text is this:
Code: [Select]
'SFMLgame.exe' (Win32): Loaded 'C:\Users\Kyle\Documents\Visual Studio 2015\Projects\SFMLgame\Debug\SFMLgame.exe'. Symbols loaded.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Users\Kyle\Documents\Visual Studio 2015\Projects\SFMLgame\SFMLgame\sfml-graphics-2.dll'. Module was built without symbols.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Users\Kyle\Documents\Visual Studio 2015\Projects\SFMLgame\SFMLgame\sfml-system-2.dll'. Module was built without symbols.
'SFMLgame.exe' (Win32): Loaded 'C:\Users\Kyle\Documents\Visual Studio 2015\Projects\SFMLgame\SFMLgame\sfml-window-2.dll'. Module was built without symbols.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ucrtbased.dll'
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ucrtbased.dll'
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_d7a8661bc29bbf05\nvinit.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig7icd32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igdusc32.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'SFMLgame.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'SFMLgame.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvdm.inf_amd64_d7a8661bc29bbf05\nvinit.dll'
The thread 0x2a30 has exited with code 0 (0x0).
'SFMLgame.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
Exception thrown at 0x73DEE37D (vcruntime140.dll) in SFMLgame.exe: 0xC0000005: Access violation reading location 0x02BAF000.



Pages: [1]