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 - Kamaitachi

Pages: [1] 2
1
Audio / Re: Errors when trying to link sfml-audio
« on: July 10, 2016, 06:17:12 pm »
I am using SFML-2.2.

2
Audio / Re: Errors when trying to link sfml-audio
« on: July 10, 2016, 08:04:56 am »
Went back, added all dependencies again, seems like they are being linked to... however, I am still getting errors with the audio, related to linking:

Quote
Error   4   error LNK2019: unresolved external symbol sf_open referenced in function "public: bool __cdecl sf::priv::SoundFile::openRead(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?openRead@SoundFile@priv@sf@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   5   error LNK2019: unresolved external symbol sf_open_virtual referenced in function "public: bool __cdecl sf::priv::SoundFile::openRead(void const *,unsigned __int64)" (?openRead@SoundFile@priv@sf@@QEAA_NPEBX_K@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   6   error LNK2019: unresolved external symbol sf_strerror referenced in function "public: bool __cdecl sf::priv::SoundFile::openRead(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?openRead@SoundFile@priv@sf@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   7   error LNK2019: unresolved external symbol sf_seek referenced in function "public: void __cdecl sf::priv::SoundFile::seek(class sf::Time)" (?seek@SoundFile@priv@sf@@QEAAXVTime@3@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   8   error LNK2019: unresolved external symbol sf_read_short referenced in function "public: unsigned __int64 __cdecl sf::priv::SoundFile::read(short *,unsigned __int64)" (?read@SoundFile@priv@sf@@QEAA_KPEAF_K@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   9   error LNK2019: unresolved external symbol sf_write_short referenced in function "public: void __cdecl sf::priv::SoundFile::write(short const *,unsigned __int64)" (?write@SoundFile@priv@sf@@QEAAXPEBF_K@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   10   error LNK2019: unresolved external symbol sf_close referenced in function "public: __cdecl sf::priv::SoundFile::~SoundFile(void)" (??1SoundFile@priv@sf@@QEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject

Full build command is:
Quote
/OUT:"C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\x64\Debug\AIProject.exe" /MANIFEST /NXCOMPAT /PDB:"C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\x64\Debug\AIProject.pdb" /DYNAMICBASE "winmm.lib" "opengl32.lib" "gdi32.lib" "glew.lib" "jpeg.lib" "freetype.lib" "openal32.lib" "flac.lib" "vorbisenc.lib" "vorbisfile.lib" "vorbis.lib" "ogg.lib" "sfml-audio-s-d.lib" "sfml-graphics-s-d.lib" "sfml-window-s-d.lib" "sfml-system-s-d.lib" "kernel32.lib" "user32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /INCREMENTAL /PGD:"C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\x64\Debug\AIProject.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Debug\AIProject.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:".\SFML-2.2\lib" /TLBID:1

(Is that the command you wanted?)

BTW, this is the exact order of the dependencies:
Quote
winmm.lib
opengl32.lib
gdi32.lib
glew.lib
jpeg.lib
freetype.lib
openal32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib
sfml-audio-s-d.lib
sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-system-s-d.lib
kernel32.lib
user32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib

3
Audio / Re: Errors when trying to link sfml-audio
« on: July 10, 2016, 02:59:42 am »
Yes, I linked all the ones present in the "Setting up SFML" page (and FAQ), so openal32, etc should all be linked. Also yes, I am using VC2013.

4
Audio / Errors when trying to link sfml-audio
« on: July 10, 2016, 12:14:42 am »
I get the following errors when I try to link the sfml-audio library:

Quote
Error   4   error LNK2019: unresolved external symbol __imp_alSourcei referenced in function "private: void __cdecl sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   5   error LNK2001: unresolved external symbol __imp_alSourcei   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   6   error LNK2019: unresolved external symbol __imp_alGetSourcef referenced in function "public: class sf::Time __cdecl sf::SoundStream::getPlayingOffset(void)const " (?getPlayingOffset@SoundStream@sf@@QEBA?AVTime@2@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   7   error LNK2001: unresolved external symbol __imp_alGetSourcef   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   8   error LNK2019: unresolved external symbol __imp_alGetSourcei referenced in function "private: void __cdecl sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   9   error LNK2001: unresolved external symbol __imp_alGetSourcei   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   10   error LNK2019: unresolved external symbol __imp_alSourcePlay referenced in function "public: void __cdecl sf::SoundStream::play(void)" (?play@SoundStream@sf@@QEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   11   error LNK2019: unresolved external symbol __imp_alSourceStop referenced in function "private: void __cdecl sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   12   error LNK2019: unresolved external symbol __imp_alSourcePause referenced in function "public: void __cdecl sf::SoundStream::pause(void)" (?pause@SoundStream@sf@@QEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   13   error LNK2019: unresolved external symbol __imp_alSourceQueueBuffers referenced in function "private: bool __cdecl sf::SoundStream::fillAndPushBuffer(unsigned int)" (?fillAndPushBuffer@SoundStream@sf@@AEAA_NI@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   14   error LNK2019: unresolved external symbol __imp_alSourceUnqueueBuffers referenced in function "private: void __cdecl sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   15   error LNK2019: unresolved external symbol __imp_alGenBuffers referenced in function "private: void __cdecl sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   16   error LNK2019: unresolved external symbol __imp_alDeleteBuffers referenced in function "private: void __cdecl sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   17   error LNK2019: unresolved external symbol __imp_alBufferData referenced in function "private: bool __cdecl sf::SoundStream::fillAndPushBuffer(unsigned int)" (?fillAndPushBuffer@SoundStream@sf@@AEAA_NI@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   18   error LNK2019: unresolved external symbol __imp_alGetBufferi referenced in function "private: void __cdecl sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AEAAXXZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundStream.cpp.obj)   AIProject
Error   19   error LNK2019: unresolved external symbol __imp_alGenSources referenced in function "public: __cdecl sf::SoundSource::SoundSource(class sf::SoundSource const &)" (??0SoundSource@sf@@QEAA@AEBV01@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   20   error LNK2019: unresolved external symbol __imp_alDeleteSources referenced in function "public: virtual __cdecl sf::SoundSource::~SoundSource(void)" (??1SoundSource@sf@@UEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   21   error LNK2019: unresolved external symbol __imp_alSourcef referenced in function "public: void __cdecl sf::SoundSource::setPitch(float)" (?setPitch@SoundSource@sf@@QEAAXM@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   22   error LNK2019: unresolved external symbol __imp_alSource3f referenced in function "public: void __cdecl sf::SoundSource::setPosition(float,float,float)" (?setPosition@SoundSource@sf@@QEAAXMMM@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   23   error LNK2019: unresolved external symbol __imp_alGetSource3f referenced in function "public: class sf::Vector3<float> __cdecl sf::SoundSource::getPosition(void)const " (?getPosition@SoundSource@sf@@QEBA?AV?$Vector3@M@2@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundSource.cpp.obj)   AIProject
Error   24   error LNK2019: unresolved external symbol __imp_alIsExtensionPresent referenced in function "public: static bool __cdecl sf::priv::AudioDevice::isExtensionSupported(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?isExtensionSupported@AudioDevice@priv@sf@@SA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   25   error LNK2019: unresolved external symbol __imp_alGetEnumValue referenced in function "public: static int __cdecl sf::priv::AudioDevice::getFormatFromChannelCount(unsigned int)" (?getFormatFromChannelCount@AudioDevice@priv@sf@@SAHI@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   26   error LNK2019: unresolved external symbol __imp_alcCreateContext referenced in function "public: __cdecl sf::priv::AudioDevice::AudioDevice(void)" (??0AudioDevice@priv@sf@@QEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   27   error LNK2019: unresolved external symbol __imp_alcMakeContextCurrent referenced in function "public: __cdecl sf::priv::AudioDevice::AudioDevice(void)" (??0AudioDevice@priv@sf@@QEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   28   error LNK2019: unresolved external symbol __imp_alcDestroyContext referenced in function "public: __cdecl sf::priv::AudioDevice::~AudioDevice(void)" (??1AudioDevice@priv@sf@@QEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   29   error LNK2019: unresolved external symbol __imp_alcOpenDevice referenced in function "public: __cdecl sf::priv::AudioDevice::AudioDevice(void)" (??0AudioDevice@priv@sf@@QEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   30   error LNK2019: unresolved external symbol __imp_alcCloseDevice referenced in function "public: __cdecl sf::priv::AudioDevice::~AudioDevice(void)" (??1AudioDevice@priv@sf@@QEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   31   error LNK2019: unresolved external symbol __imp_alcIsExtensionPresent referenced in function "public: static bool __cdecl sf::priv::AudioDevice::isExtensionSupported(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?isExtensionSupported@AudioDevice@priv@sf@@SA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(AudioDevice.cpp.obj)   AIProject
Error   32   error LNK2019: unresolved external symbol __imp_alGetError referenced in function "void __cdecl sf::priv::alCheckError(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int)" (?alCheckError@priv@sf@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(ALCheck.cpp.obj)   AIProject
Error   33   error LNK2019: unresolved external symbol sf_open referenced in function "public: bool __cdecl sf::priv::SoundFile::openRead(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?openRead@SoundFile@priv@sf@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   34   error LNK2019: unresolved external symbol sf_open_virtual referenced in function "public: bool __cdecl sf::priv::SoundFile::openRead(void const *,unsigned __int64)" (?openRead@SoundFile@priv@sf@@QEAA_NPEBX_K@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   35   error LNK2019: unresolved external symbol sf_strerror referenced in function "public: bool __cdecl sf::priv::SoundFile::openRead(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?openRead@SoundFile@priv@sf@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   36   error LNK2019: unresolved external symbol sf_seek referenced in function "public: void __cdecl sf::priv::SoundFile::seek(class sf::Time)" (?seek@SoundFile@priv@sf@@QEAAXVTime@3@@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   37   error LNK2019: unresolved external symbol sf_read_short referenced in function "public: unsigned __int64 __cdecl sf::priv::SoundFile::read(short *,unsigned __int64)" (?read@SoundFile@priv@sf@@QEAA_KPEAF_K@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   38   error LNK2019: unresolved external symbol sf_write_short referenced in function "public: void __cdecl sf::priv::SoundFile::write(short const *,unsigned __int64)" (?write@SoundFile@priv@sf@@QEAAXPEBF_K@Z)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   39   error LNK2019: unresolved external symbol sf_close referenced in function "public: __cdecl sf::priv::SoundFile::~SoundFile(void)" (??1SoundFile@priv@sf@@QEAA@XZ)   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\AIProject\sfml-audio-s-d.lib(SoundFile.cpp.obj)   AIProject
Error   40   error LNK1120: 33 unresolved externals   C:\Users\MKH\Desktop\MMBN - The AI\AIProject\AIProject\x64\Debug\AIProject.exe   AIProject

I added all the libraries mentioned in the tutorial, and I made sure to be running the correct build. Any ideas?

5
Thank you!

6
General / [SFML 1.6] Trying to access a class through a pointer
« on: July 27, 2012, 09:47:46 pm »
The situation is like this:

I have a class that handles the window and all the drawings, Window, and one to take care of the level, Level. Level takes as an argument in its constructor a Window object, and handles it with a pointer, using the arrow operator to access the public AddtoDraw() function, a function to allow adding elements to be drawn to a queue. The problems I get are the following:

||=== AI_Fighter, Debug ===|
C:\...\SFML-1.6\include\SFML\System\NonCopyable.hpp|57|error: 'sf::NonCopyable::NonCopyable(const sf::NonCopyable&)' is private|
C:\...\SFML-1.6\include\SFML\Window\Window.hpp|56|error: within this context|
C:\...\SFML-1.6\include\SFML\System\NonCopyable.hpp|57|error: 'sf::NonCopyable::NonCopyable(const sf::NonCopyable&)' is private|
C:\...\SFML-1.6\include\SFML\Window\Input.hpp|45|error: within this context|
C:\...\SFML-1.6\include\SFML\Window\Window.hpp|56|note: synthesized method 'sf::Input::Input(const sf::Input&)' first required here |
C:\...\SFML-1.6\include\SFML\Graphics\RenderWindow.hpp|46|note: synthesized method 'sf::Window::Window(const sf::Window&)' first required here |
C:\....\Window.hpp|8|note: synthesized method 'sf::RenderWindow::RenderWindow(const sf::RenderWindow&)' first required here |
C:\....\Main.cpp||In function 'int main()':|
C:\....\Main.cpp|12|note: synthesized method 'Window::Window(const Window&)' first required here |
C:\....\Main.cpp|12|error:   initializing argument 1 of 'Level::Level(Window)'|
||=== Build finished: 5 errors, 0 warnings ===|

I suppose, by the name NonCopyable,  that the sf::RenderWindow cannot be copied, and if I try to I will get an error. If such supposition is correct how I do what I described above (access a method of my rendering class, Window, so I can add elements to the queue, from an external class)?

Level.hpp
#ifndef Level_hpp
#define Level_hpp

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>

#include "Window.hpp"
#include "Level.hpp"

class Level
{
    Window *ResultScreen;
    sf::Image levelIMG;
    sf::Sprite levelSprite;
    std::vector<sf::Sprite> level;

    public:
    Level( Window );
    void PassDrawLevel();
};

#endif

Level.cpp
#include "Level.hpp"
#include "Window.hpp"

Level::Level( Window app )
{
    *ResultScreen = app;

    if( !levelIMG.LoadFromFile("TileSet.png") )
    {
        std::cout << "Problem opening file 'TileSet.png'";
    }

    levelIMG.SetSmooth(false);

    levelSprite.SetImage( levelIMG );
};

void Level::PassDrawLevel ()
{
    ResultScreen->AddtoDraw( level );
}

7
General / App.Draw() coordinates
« on: April 13, 2011, 05:43:33 pm »
Why the following code doesn't draw the image in the point defined by (pos1, pos2)?

Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <sstream>
#include <string>

class Field
{
    sf::RenderWindow App;
    sf::Image image;
    sf::Sprite sprite;
    public:
    Field(int x, int y) {App.Create(sf::VideoMode(x, y), "SFML");};
    void FEvent();
    void FDisplay (int, int, std::string);
};

void Field::FEvent ()
{
    while(App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::MouseButtonPressed)
            FDisplay(Event.MouseMove.X, Event.MouseMove.Y, "X.bmp");
        }
    }
}

void Field::FDisplay (int pos1, int pos2, std::string filename)
{
    if(!image.LoadFromFile(filename))
    {
        App.Close();
    }
    sprite.SetImage(image);

    App.Clear();
    sprite.SetPosition(pos1, pos2);
    App.Draw(sprite);
    App.Display();
}

int main()
{
    Field F(315, 315);
    F.FEvent();
}

8
General / App.Draw() trouble
« on: March 20, 2011, 02:18:58 pm »
This was FEvent():

Code: [Select]
void Field::FEvent ()
{
    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
            if (Event.Type == sf::Event::MouseButtonPressed)
                App.Close();
        }
    }
}

9
General / App.Draw() trouble
« on: March 16, 2011, 06:32:08 pm »
Found the problem, while "minimizing" the problem:
The order of these two functions:

Code: [Select]
while(App.IsOpened())
{
        FEvent();
        FDisplay(1.f, 1.f, 1);
}


Makes it so that FDisplay is never called. If I call FEvent(), FDisplay() isn't called, and nothing is displayed. If FDisplay() is called first (and FEvent() is slightly tweaked, making a FDisplay call), everything works fine. I should have noticed that before... Anyway, thanks for the help!

10
General / App.Draw() trouble
« on: March 16, 2011, 05:17:09 pm »
I think so. The array is initialized before the use of FDisplay, and no function modifies it afterwards.

11
General / App.Draw() trouble
« on: March 16, 2011, 02:48:05 pm »
Okay:
1- sprite[0] contain a black and white sprite (the background).
2- They were initialized with the following code:

Code: [Select]
void Field::FDImage(std::string filename, int arpos)
{
    if(!image[arpos].LoadFromFile(filename))
    {
        App.Close();
    }
    sprite[arpos].SetImage(image[arpos]);
}


and

Code: [Select]
FDImage("Field.bmp", 0);
    FDImage("O.bmp", 1);
    FDImage("X.bmp", 2);


3- That was an error I corrected already.

12
General / App.Draw() trouble
« on: March 16, 2011, 02:08:09 pm »
Added App.Display, as following:

Code: [Select]
   App.Clear();

    sprite[1].SetX(pos1);
    sprite[1].SetY(pos2);
    App.Draw(sprite[1]);

    App.Display();


Still not drawing anything.[/code]

13
General / App.Draw() trouble
« on: March 16, 2011, 01:20:26 pm »
:( Another problem came up. The following (I believe) piece of code isn't drawing anything. What is wrong this time?

Code: [Select]
void Field::FDisplay (float pos1, float pos2, int pl)
{
    for(int i = 0; i < 3; i++)
    {
        if (Farray[i] != 0 && Farray[i] != 1)
        {
            Farray[i] = 0;
        }
    }

    App.Clear();

    sprite[1].SetX(0.f);
    sprite[1].SetY(0.f);
    App.Draw(sprite[1]); //Corrected
}

//...

F.FDisplay(1.f, 1.f, 1);

14
General / Problems with GetImage()
« on: March 15, 2011, 07:36:21 pm »
Oh... d'oh! Thank you.

15
General / Problems with GetImage()
« on: March 15, 2011, 07:03:30 pm »
Why won't the following won't work?

Code: [Select]
sf::Image image[3];
sf::Sprite sprite[3];

void Field::FDImage(std::string filename, int arpos)
{
    if (!image[arpos].LoadFromFile(filename))
    {
        App.Close();
    }
    if (!sprite[arpos].SetImage(image[arpos]))
    {
        App.Close();
    }
}


The error returned is
Quote
C:\...\SFML_Project\main.cpp
||In member function 'void Field::FDImage(std::string, int)':
|C:\...\SFML_Project\main.cpp|52|error:
could not convert '((Field*)this)->Field::sprite[arpos].sf::Sprite::SetImage(((const sf::Image&)((const sf::Image*)(&((Field*)this)->Field::image[arpos]))))' to 'bool' in argument to unary !

Pages: [1] 2