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

Pages: [1]
1
General / Re: Linking Error
« on: July 06, 2013, 06:31:31 pm »
Thank you, Laurent! I've completely forgotten that I have copied SFML/include into Visual Studio/include folder. Problem solved ;D

2
General / Re: Linking Error
« on: July 06, 2013, 05:09:38 pm »
Yes! Also there are many linkage errors(not just one) if I don't link any libraries at all, so it seems like I'm linking them correctly.

3
General / [SOLVED]Linking Error
« on: July 06, 2013, 12:35:00 pm »
Hi, I've been using SFML for quite a long time and didn't have any linker-related errors. Today I downloaded SFML 2.0 for vs2012 x64, set up project(include and lib folders, input libs for linker, x64 platform setting etc.) and tried to compile this tutorial code example, but I get following error:

Error   1       error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl 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@@QEAA@VVideoMode@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEBUContextSettings@1@@Z) referenced in function main      E:\dev\Projects\arcadium\arcadium\EntryPoint.obj

But if I change constructor for sf::RenderWindow window to default like this:
#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window;
        window.setActive(true);
        window.setVisible(true);
        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;
}
 
This code compiles without errors but evidently doesn't create any window. Am I missing something here?
Any help will be appreciated.

4
Graphics / SFML 2.0 flickering textures
« on: April 20, 2011, 06:32:55 pm »
Hi There! I've started using SFML 2.0 a few days ago and realized that it's awesome :D sf::View::SetRotation is also great.
Now I'm trying to create simple flight simulator.
When camera moves with constant speed everything is ok, but when I set speed according to App.GetFrameTime() grass texture starts flickering. Any help?

Code: [Select]

#include <SFML/Graphics.hpp>
#define TEXTURE_WIDTH 1200
#define TEXTTURE_HEIGHT 798
#define PI 3.141592654
#define SPEED 111
int main()
{
sf::VideoMode dm = sf::VideoMode::GetDesktopMode();
sf::RenderWindow App(dm, "SFML Views", sf::Style::Fullscreen);
App.EnableVerticalSync(true);
App.SetFramerateLimit(60);
sf::Image BackgroundImage;
if (!BackgroundImage.LoadFromFile("Grass.jpg" )) //http://www.dizayner.ucoz.com/3ddd/3dmitri/Grass_from_cg_textures.jpg
return 1;
sf::Sprite Background(BackgroundImage);
Background.Resize(TEXTURE_WIDTH , TEXTTURE_HEIGHT);
sf::Vector2f Center(1000, 1000); //init position
sf::Vector2f HalfSize(dm.Width / 2, dm.Height/ 2);
sf::View View(Center, HalfSize);
float angle = 45; // init camera angle
sf::Vector2f position;

position.x = Background.GetPosition().x + Background.GetSize().x / 2;
position.y = Background.GetPosition().y + Background.GetSize().y / 2;
while (App.IsOpened())
{
float time = App.GetFrameTime();
sf::Event Event;
while (App.GetEvent(Event))
{
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}

//flickering

//position.x += SPEED * time * cos((angle - 90) * 2 * PI / 360);
//position.y += SPEED * time * sin((angle - 90) * 2 * PI / 360);

//no flickering
const float MYSPEED = 3; // depends on your hardware
position.x += MYSPEED * cos((angle - 90) * 2 * PI / 360);
position.y += MYSPEED * sin((angle - 90) * 2 * PI / 360);


if (App.GetInput().IsKeyDown(sf::Key::Left)) angle -= 1.5f;
if (App.GetInput().IsKeyDown(sf::Key::Right)) angle += 1.5f;


View.SetCenter(position.x, position.y);
View.SetRotation(angle);
App.SetView(View);
App.Clear();

for(int w = 0; w < 5; w++)
for(int j = 0; j < 5; j++)
{
Background.SetPosition(TEXTURE_WIDTH * w, TEXTTURE_HEIGHT * j);
App.Draw(Background);
}
App.Display();
}
return 0;
}

Pages: [1]