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

Pages: [1]
1
General / Re: displaying multiple sprites
« on: September 16, 2014, 10:05:22 pm »
unfortunately, none of the suggestions have worked.


all of them are throwing some sort of error

2
General / Re: displaying multiple sprites
« on: September 16, 2014, 12:13:40 am »
thanks for the answers and i took a look at the link you sent. I think i'm more familiar with them than I was before.

so here's an update on what I did.

 std::vector<sf::Sprite> object_list;


    sf::Sprite Box;

    Box.setTexture(myTexture);
    object_list.push_back(Box);

        for(int i = 0; i <= object_list.size(); ++i){
        myWindow.draw(object_list[i]);

        }


this does run without any errors but as soon as the application opens up it stays for about 2 seconds then crashes.

3
General / displaying multiple sprites
« on: September 15, 2014, 01:17:29 am »
so eventually im going to get drawing a lot of sprites at once for example: the environment that the player will be in: the trees, the grass, flowers, etc etc. tilesets in general.

so I thought of going about that through making an std::vector dedicated for holding only sprites and during the main loop there will be a for loop weeding out the sprites and drawing them. But I can't seem to get it to work!

Here's what I've got so far.

defined the vector early on around where i declare the window
std::vector<sf::Sprite> object_list;

then in my main loop its going to call this void im currently working on under a class called Physics which was also declared earlier "myWindow" being the window name.
gamePhysics.draw_objects(&myWindow,&object_list);

and finally the void function itself
void draw_objects(sf::RenderWindow *gameWindow,std::vector<sf::Sprite> *objects){

    for(int i = 0;objects->size();i++){

        &gameWindow->draw(&objects[i]);
    }

};

which keeps throwing this error at me
include\physics.h|19|error: no matching function for call to 'sf::RenderWindow::draw(std::vector<sf::Sprite>*)'|

highlighting this line
&gameWindow->draw(&objects[i]);

and yes im a little knew to C++ programming but on it here and there trying my best lately.
any suggestions would be greatly appreciated!

4
General / Re: SFML 2.1 error
« on: September 13, 2014, 03:27:57 pm »
wow thanks i really didnt know it was an easy fix how could i be so blind.
i thought that the fact im including the graphics lib then i would only need that.

thanks for clearing it up!

5
General / SFML 2.1 error
« on: September 13, 2014, 03:11:50 pm »
Hello, i've been experiencing this frustrating error for hours now, and I can't seem to fix it!

Here's the code (using the sample code from the site)
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}
 

here's the error.

Error   1       error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main     c:\Users\Ricky\documents\visual studio 2012\Projects\sfm-app\sfm-app\main.obj   sfm-app
Error   2       error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) referenced in function _main        c:\Users\Ricky\documents\visual studio 2012\Projects\sfm-app\sfm-app\main.obj   sfm-app
Error   3       error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main   c:\Users\Ricky\documents\visual studio 2012\Projects\sfm-app\sfm-app\main.obj   sfm-app
Error   4       error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ) referenced in function _main c:\Users\Ricky\documents\visual studio 2012\Projects\sfm-app\sfm-app\main.obj   sfm-app
Error   5       error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main        c:\Users\Ricky\documents\visual studio 2012\Projects\sfm-app\sfm-app\main.obj   sfm-app
Error   6       error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main        c:\Users\Ricky\documents\visual studio 2012\Projects\sfm-app\sfm-app\main.obj   sfm-app
Error   7       error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main     c:\Users\Ricky\documents\visual studio 2012\Projects\sfm-app\sfm-app\main.obj   sfm-app
Error   8       error LNK1120: 7 unresolved externals   c:\users\ricky\documents\visual studio 2012\Projects\sfm-app\Debug\sfm-app.exe  sfm-app

 

screenshots:





help and suggestions are much appreciated thanks for your time!


note: using sfml 2.1, vs 2012 express

6
Network / Problem with sf::UdpSocket
« on: July 17, 2014, 12:52:24 am »
So this error keeps raising up after hours of trying to find whats wrong..
Quote
Error   1   error C2248: 'sf::NonCopyable::operator =' : cannot access private member declared in class 'sf::NonCopyable'

I've narrowed down to where the problem occurs through the process of guess and check(keep in mind im using MSV13 if that makes a difference)

Quote
server::server(sf::UdpSocket surver, sf::IpAddress ip,
   int por, std::string stats){
   serverIP = ip;
   port = por;
   status = stats;
   serverSLSocket = surver;

specifically here:
Quote
serverSLSocket = surver;

Much help is appreciated!

Pages: [1]