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 - Syntactic Fructose

Pages: 1 ... 3 4 [5] 6
61
Thanks for the reply guys, Just have another question regarding my input. I have my keyboard input working perfectly, and very responsive. Only problem is using my mouse in conjunction with my keys, at the moment I can only do one or the other, move with my keyboard or move with my mouse. Here is my controls function i use for the program
void computeMatricesFromInputs(sf::RenderWindow& window, float time){
        //get mouse position
        sf::Vector2i mousePos = sf::Mouse::getPosition(window);
                //set position of mouse so it does not move at all
        sf::Mouse::setPosition(sf::Vector2i(400, 300), window);
        //since the mouse position is always set to the center of the screen, any slight movements
        //      are added to the horizontal and vertical angle. (400,300) must also equal zero for the
        //      cube to remain still at origin, so that's why the mouse position is the subtractor to
        //      the center of the screen
        horizontalAngle += mouseSpeed * (800/2 - mousePos.x);
        verticalAngle   += mouseSpeed * (600/2 - mousePos.y);

        // Direction : Spherical coordinates to Cartesian coordinates conversion
        direction = glm::vec3(
                cos(verticalAngle) * sin(horizontalAngle),
                sin(verticalAngle),
                cos(verticalAngle) * cos(horizontalAngle)
        );
       
        // Right vector
        right = glm::vec3(
                sin(horizontalAngle - 3.14f/2.0f),
                0,
                cos(horizontalAngle - 3.14f/2.0f)
        );
        // Up vector
        glm::vec3 up = glm::cross( right, direction );
        // Projection matrix : 45° Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
        ProjectionMatrix = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f);
        // Camera matrix
        ViewMatrix = glm::lookAt(
                position,       //camera position
                position+direction,     //look at origin
                up      //head up
        );

        if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)){
                position += direction * time * speed;
        }else if(sf::Keyboard::isKeyPressed(sf::Keyboard::S)){
                position -= direction * time * speed;
        }else if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)){
                position += right * time * speed;
        }else if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)){
                position -= right * time * speed;
        }
}

what I can notice right now is that I check for keyboard function before my mouse, do I need to use threading in order to have these inputs work in conjunction? Thanks!

62
Window / SFML 2.0, handling multiple inputs at the same time in screen
« on: April 11, 2013, 07:26:52 pm »
I read up on sf::Input in the 1.6 documentation, but I can't seem to find it in 2.0RC. Was sf::Input removed? I'm trying to fix my event handling function to be able to handle multiple types of input at once(e.g. moving mouse and pressing w to go forward and also look around at the same time). How should I go about doing this? Thanks for any help!

63
did not put SFML_STATIC as a preprocessor definition.

Continue on everybody, sorry to waste time

64
While converting some openGL tutorial code from glfw to SFML i've run across an error i can't seem to get rid of, when I attempt to set the mouse position it gives me an unresolved external symbol error. The exact error is:

1>  All outputs are up-to-date.
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl sf::Mouse::setPosition(class sf::Vector2<int> const &,class sf::Window const &)" (__imp_?setPosition@Mouse@sf@@SAXABV?$Vector2@H@2@ABVWindow@2@@Z) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> __thiscall sf::RenderTarget::convertCoords(class sf::Vector2<int> const &)const " (__imp_?convertCoords@RenderTarget@sf@@QBE?AV?$Vector2@M@2@ABV?$Vector2@H@2@@Z) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<int> __thiscall sf::Window::getPosition(void)const " (__imp_?getPosition@Window@sf@@QBE?AV?$Vector2@H@2@XZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Time::asSeconds(void)const " (__imp_?asSeconds@Time@sf@@QBEMXZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Time __thiscall sf::Clock::getElapsedTime(void)const " (__imp_?getElapsedTime@Clock@sf@@QBE?AVTime@2@XZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>controls.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Clock::Clock(void)" (__imp_??0Clock@sf@@QAE@XZ) referenced in function "void __cdecl computeMatricesFromInputs(class sf::RenderWindow &,int &)" (?computeMatricesFromInputs@@YAXAAVRenderWindow@sf@@AAH@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<unsigned int> __thiscall sf::Image::getSize(void)const " (__imp_?getSize@Image@sf@@QBE?AV?$Vector2@I@2@XZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned char const * __thiscall sf::Image::getPixelsPtr(void)const " (__imp_?getPixelsPtr@Image@sf@@QBEPBEXZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::~Image(void)" (__imp_??1Image@sf@@QAE@XZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Image::loadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?loadFromFile@Image@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>texture.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::Image(void)" (__imp_??0Image@sf@@QAE@XZ) referenced in function "unsigned int __cdecl loadTGA_sfml(char const *)" (?loadTGA_sfml@@YAIPBD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : 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
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setVerticalSyncEnabled(bool)" (__imp_?setVerticalSyncEnabled@Window@sf@@QAEX_N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setMouseCursorVisible(bool)" (__imp_?setMouseCursorVisible@Window@sf@@QAEX_N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@1@@Z) referenced in function _main
1>main.obj : 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
 


I would think this is because i'm not including the right files, but i have all of my include files correct. Here is the bit of code:

void computeMatricesFromInputs(sf::RenderWindow& window, int& key){
        //going to need a clock for time and a mouse of position coordiantes
        sf::Clock clock;
        static double lastTime = (double)(clock.getElapsedTime()).asSeconds();

        // Compute time difference between current and last frame
        double currentTime = (double)(clock.getElapsedTime()).asSeconds();
        float deltaTime = float(currentTime - lastTime);

        //get mouse position
        sf::Vector2f mousePos = window.convertCoords(window.getPosition());
        // Reset mouse position for next frame
       
        //set position of mouse so it does not move at all
        sf::Mouse::setPosition(sf::Vector2i(512, 384), window);

        // Compute new orientation
        horizontalAngle += mouseSpeed * float(1024/2 - mousePos.x );
        verticalAngle   += mouseSpeed * float( 768/2 - mousePos.y );

        // Direction : Spherical coordinates to Cartesian coordinates conversion
        glm::vec3 direction(
                cos(verticalAngle) * sin(horizontalAngle),
                sin(verticalAngle),
                cos(verticalAngle) * cos(horizontalAngle)
        );
//goes on...

it must be a silly problem of mine, thanks for any help!

65
General discussions / Changes in 2.0 RC
« on: March 19, 2013, 10:58:08 pm »
Just downloaded 2.0 RC for vs 2010 and started playing around with it, and boy do I love what you did with 2.0. I was told a couple days ago to drop 1.6 and try out 2.0, so I decided to give it a shot and see whats new. Most noticeable for me would be the changes to the naming of functions. Thank you Laurent for using camelBack notation, no longer will my pinky fall off after writing with SFML for long periods of time. I haven't read to much on the entire changes though, but i'm wondering what everyone else's favorite change is in 2.0.

66
General / Re: What minGW version can i use for compiling 1.6 code?
« on: March 16, 2013, 01:56:46 am »
I've had a ton of trouble with trying to get 2.0 onto VS2010, which is what i'll be using to write a 3d graphical engine with a group of others. My main problem is being inexperienced with any 3rd party libraries, especially building from source code and linking properly. My plan was to wait it out until there are proper tutorials out there for setting up 2.0, thanks for the help.

67
General / What minGW version can i use for compiling 1.6 code?
« on: March 16, 2013, 01:45:11 am »
Trying to learn some SFML for the upcoming release in 2.0, so i've been reading in and setting up the 1.6 files on my laptop to play around with. Only problem is i'm getting this error:

Quote
'undefined reference to '_Unwind_Resume'

which means my compiler and the compiler used to compile 1.6 differ. What version(i use code::blocks) should i grab in order to run SFML code? Thanks!

68
General discussions / Using SFML in our 3d graphics engine
« on: February 27, 2013, 07:33:42 pm »
Me and 6-7 others are designing and writing a 3d graphics engine, and we plan on using SFML for handling the window and input. While reading about the 2.0 release i read this:
Quote
Will/does SFML support 3D?

No, and Laurent (SFML's developer) has decided to keep the library as a way to handle 2D graphics with ease and hardware acceleration, so in short there won't be support for 3D in the future either. However you can use Irrlicht with SFML as a window creator. You could also use raw OpenGL to implement 3D and have it alongside your 2D rendering in SFML without problems.

This worries me a bit, what does this mean by no 3d handling support? Is this for SFML's internal graphics, as in it shouldn't be a problem since we are writing completely in OpenGL 3.3. Or is this directly related to SFML's ability to render 3d objects to the screen? Thanks for any help!

69
Graphics / Re: DisplayingSprites using classes(tutorial help)
« on: April 13, 2012, 09:24:58 pm »
Hmm... Don't you think you should learn C++ first? :P

It not that i have no knowledge of c++(been learning it for 6 months now), its all of the SFML functions and types that confuse me. I read about how sprites and images should be handled in a class, but as this is my first real week of learning about SFML i know very little. I just like to learn the right way first instead of having to change my habits.

about the program: i added in the overloaded constructor and used that as a parameter to my first tank object, that works fine. Problem now is its telling me there is an undefined reference to sf::Image, most likely me just missing something obvious. Thanks for the help

70
Graphics / Re: DisplayingSprites using classes(tutorial help)
« on: April 13, 2012, 09:09:14 pm »
You must define a default constructor too; currently you can only create Tank instances by copying other instances.

What would the default constructor consist of? just nothing? then i would call a tank object using that object i created?

71
Graphics / Re: DisplayingSprites using classes(tutorial help)
« on: April 13, 2012, 08:59:51 pm »
Digital, your code did not work, and neither did mateandmetal. It just continues to give me this error:

Code: [Select]
J:\SFML\SFML_SmallGame\main.cpp||In function 'int main()':|
J:\SFML\SFML_SmallGame\main.cpp|9|error: no matching function for call to 'Tank::Tank()'|
J:\SFML\SFML_SmallGame\Tank.h|8|note: candidates are: Tank::Tank(const Tank&)|
||=== Build finished: 1 errors, 0 warnings ===|

Because i have no parameters when i create an object. Help!

72
Graphics / Re: DisplayingSprites using classes(tutorial help)
« on: April 13, 2012, 04:16:38 am »
Thanks for the reply! But im still just confused on how to go about declaring a tank object, could i ask you to maybe just write one line of code declaring the object in main? i have no clue what to put in for the parameter(does not work with zero). Ill update my main post with the code

73
Graphics / DisplayingSprites using classes(tutorial help)
« on: April 12, 2012, 09:41:37 pm »
I've been learning sfml lately and im trying to create just really simple games and applications to help learn. I saw on the sprite tutorial that puting the image and sprite into a class is much better programming and habit s. Here is the code:

UPDATED:
Code: [Select]
#ifndef TANK_H
#define TANK_H
#include <SFML/Graphics.hpp>

class Tank
{
    public:
        Tank(const Tank& Copy);
        bool LoadFile(const std::string ImageFile);
    protected:
    private:
        static sf::Image Image;
        sf::Sprite Tank1;
};

#endif // TANK_H


Code: [Select]
#include "Tank.h"
#include <iostream>
#include <SFML/Graphics.hpp>
Tank::Tank(const Tank& Copy):
Image(Copy.Image),
Tank1(Copy.Tank1)
{
    Tank1.SetImage(Image);
}

bool Tank::LoadFile(const std::string ImageFile)
{
    if(!Image.LoadFromFile(ImageFile))
    {
        return 1;
    }
    return 0;
}



But how would i go about loading an image and sprite into the class? I want to make a Tank object that holds the image i could display in the main loop, here is my guess:
main.cpp
Code: [Select]
#include <iostream>
#include "Tank.h"
#include <SFML/Graphics.hpp>


int main()
{
   sf::RenderWindow Window(sf::VideoMode(800,600,32), "TANKWARS");
   Tank Playerone(/* ??? */); //im still confused on how to declare this!
   if(!Playerone.LoadFile("Tank.tga"))
   {
       return EXIT_FAILURE;
   }
}


74
General / Displaying Integers?
« on: March 15, 2012, 08:34:11 pm »
Thanks for the replys, From what im hearing i need to use Win32 programming if i want to display varibles and create a GUI.

75
General / Displaying Integers?
« on: March 15, 2012, 08:20:46 pm »
From what i hear, C++ on the console can become a bad habit, so im trying to move away from it. If i want to say, run a complete application on a seperate window(adding, displaing and others) what would i use? Im imagining in my head running a program, it opens a different window and asks the user for input, does something with it and displays it.

Pages: 1 ... 3 4 [5] 6
anything