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

Pages: 1 [2] 3 4 5
16
Graphics / Re: View only moves once
« on: June 29, 2013, 05:11:50 pm »
Yup, that was it.

You can probably tell I haven't used SFML for a while :D

Thanks.

17
Graphics / Re: View only moves once
« on: June 29, 2013, 04:55:07 pm »
Ok. What I expected to happen is that the gradient would keep moving left (or rather, the view moving right and the gradient "falls out" the left), leaving only black. But... it doesn't change visually at all.

Here is that class:

#include "Drawer.h"
#include "BlockSizeCalculator.h"
#include <iostream>

Drawer::Drawer()
{
        window.create(sf::VideoMode(500, 500),  "");

        view.reset(sf::FloatRect(0, 0, window.getSize().x, window.getSize().y));
               
        view.setViewport(sf::FloatRect(0, 0, 1, 1));
}

void Drawer::drawWorld(World world)
{
        int blockSize = BlockSizeCalculator::getBlockSize();

        sf::RectangleShape rectangle;

        rectangle.setSize(sf::Vector2f(blockSize, blockSize));

        for (int x = 0; x < world.getWidth() ; ++x)
                for (int y = 0; y < world.getHeight() ; ++y)
                {
                        rectangle.setFillColor(world.getColor(x, y));

                        rectangle.setPosition(x*blockSize, window.getSize().y - (y*blockSize + blockSize));

                        window.draw(rectangle);
                }

                window.display();
}

bool Drawer::draw(World world)
{
        view.move(100, 0);

        std::cout << view.getCenter().x << "\n";

        window.setView(view);

        drawWorld(world);

        std::cout << window.getView().getCenter().x << "\n";

        return false;
}

const sf::RenderWindow & Drawer::getWindow() {return window;}

 

And called like so:

while (true)
{
        drawer.draw(world);

        std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
 

18
Graphics / [Solved] View only moves once
« on: June 29, 2013, 04:20:11 pm »
Greetings. Well, I basically have something that draws a 2D array of colored squares. Easy enough, and that part works. I wanted it to scroll, however, as I plan for the random generation to be much wider than a single screen.

        view.move(100, 0);

        std::cout << view.getCenter().x << "\n";

        window.setView(view);

        drawWorld(world);

        std::cout << window.getView().getCenter().x << "\n";

Simple enough. Now, according to the debug lines, the window does have the same view as what it was set to. The view's center does move.



That is what it looks like. It started with the gradient in full view. The black space shows that the view moved. Changing the value (From 100) leaves different amounts of black space. However, it always looks like in the picture. It doesn't scroll.

What am I missing?

Also, the view (and the window) are members of a class, and the view is initialized like so, in the constructor:

view.reset(sf::FloatRect(0, 0, window.getSize().x, window.getSize().y));
               
view.setViewport(sf::FloatRect(0, 0, 1, 1));
[code]

19
Window / Error on window declaration
« on: June 02, 2013, 02:47:56 am »
Greetings. Anyway...yup. Another problem.

If I use a window in a function (local), it works fine. However, when I made a global container, with it as a static member, its declaration (in the cpp), it threw an exception:

Unhandled exception at 0x772222B2 (ntdll.dll) in BlockScreensaver.exe: 0xC0000005: Access violation writing location 0x00000004.

http://pastebin.com/9gZVpxn2

^the two files related to this. Anyway, it throws on the cpp, on the declaration of the window.

Any ideas?

20
General / Re: Building SFML 2.0-rc for use with VS2012
« on: April 07, 2013, 01:09:04 am »
Ok. I had resorted to using C::B again, but the lack of intellisense, among other things - well, I realized, those things are incredibly helpful to my productivity.

That being said, I still have no idea what the problem is. I decided to scrap it, and try to restart. Note that this included reinstalling VS, and it wasn't the problem. (after uninstalling, that is). So, a corrupt install is not the issue at play here.

I decided to try dynamic first. If I can get that to work, then I might try static, but not untill then. (and if one works, both should, in theory). Here are the details:

I am using the Visual 11 win64 build, from the unofficial nightly builds, to rule out my building the libs incorrectly.

I decided to just include both that, and the entire project file, which would have the source, paths, and what have you, which should help resolve... about everything, I think. This is here: http://www.mediafire.com/?6869f117dqsrudt.

Assuming it is not the paths, and not the libs, what could it be? As I said (I think), I am on Windows 7, 64-bit.  Perhaps using the 64-bit is incorrect (the nightly build), for whatever reason. Any ideas on this? I really, really, want to get this to work. Both for making games, and as a windowing utility for openGL. And input. And, say, even sound. As far as I see, it really is the best thing to use, in this case.

EDIT: the error would probably helpful, wouldn't it?

Error   1   error LNK2019: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Time::asSeconds(void)const " (__imp_?asSeconds@Time@sf@@QBEMXZ) referenced in function _main   

There are two others that are the same but about different aspects of the time or clock objects.

21
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 17, 2013, 02:41:32 pm »
Any idea what those changes could be? I would hope to not do that as I feel it would leave something behind, and the download took... a long time. And then the installation.

Anyway, asked over on Stack Overflow, no answers. Not sure what to try next. I wouldn't think VS would be currupt in seemingly just this case (works fine otherwise). I have no idea what the settings would be, though, however I don't think anything is wrong with the libraries, I think it is more of linking to them. Yet,the linker settings seem perfect, so I don't know what to look at.

22
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 16, 2013, 07:16:05 pm »
#include <SFML/System.hpp>
#include <iostream>

int main()
{
        sf::Clock clock;


        while (true)
        {
                if (clock.getElapsedTime().asSeconds() > 2)
                {
                        clock.restart();

                        std::cout << "Hello world!\n";
                }
        }
}
 

There used to be creating a TcpSocket and Sound in there as well, but this is the simple part. Still errors.

23
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 16, 2013, 05:09:54 pm »
Ah. I had been, but while looking through the VS setup for the fifth time, it occured to me, what if I had set them for debug but was on release, so I tried that. No fix, unfortuately.

So if this is linked correctly... what gives? I linked to the nightly builds as well as my own, and neither worked... does it work for you?

24
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 16, 2013, 04:57:59 pm »
Oh. Sorry. For some reason, I reused, partially accidentally, an old project folder of Pong (from minGW and C::B). Apparently, there was a Pong folder WITHIN the Pong folder, which had the project file. There were just vs-related files in the upper directory as well.

http://www.mediafire.com/?re2m17t9r37ar4k

25
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 16, 2013, 02:24:50 pm »
http://www.mediafire.com/?2x59c9aw4bpxxzk - project file.

Note, in this case, that the SFML-vs-real directory is from the nightly builds for the appropriate case (VS2012, most recent). I was trying to see if it fixed it or not, same error. Otherwise, the built ones were in the normal location in SFML-VS, as well as the include as the nightly builds don't have it, and I don't think ALL of the API changed. Or, at least, that is not the error, I hope.


26
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 16, 2013, 02:10:06 am »
That is the thing. I tried it with those... same errors. Which I hope is it, because if I built them wrong, I have no idea where. But I don't know what it could be. I followed the tutorial to a T - adding the paths - and I know that works - specifying SFML_STATIC for the preprocessor, and adding the libraries in dependencies. It finds those files... I don't know what else there could be.

I tried taking pictures of the subwindows in VS, but it only grabs the main window instead.

27
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 16, 2013, 01:43:47 am »
Yes - sfml-system-s-d.lib, specifically, in additional dependencies. It finds the file, so... I beleive the .lib part is correct.

28
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 15, 2013, 11:36:27 pm »
Hm... when I did that, it gave me the window-s.lib this time, but seemingly deleted the other three. So I ran it again the shared way, and now got all four of everything.

Added include/lib paths, added dependencies... defined SFML_STATIC...

and got a boatload of unresolved external system errors related to any SFML object I used. Apparently I screwed up. What now?



I doubt this error will help, but who knows, so here is one of them:

Error   1   error LNK2019: unresolved external symbol "public: float __thiscall sf::Time::asSeconds(void)const " (?asSeconds@Time@sf@@QBEMXZ) referenced in function _main   (path\filename.obj here)   Pong




29
General / Re: Building SFML 2.0-rc for use with VS2012
« on: March 15, 2013, 11:18:50 pm »
Ah... the stench if my ignorance burns, it is so bad this time :)

I think, in hindsight, I missed it. For whatever reason, I was comparing the list there with mine, and expected to see it in the middle, while it was on the top of the list (in cmake-gui). Pretty bad failure, there.

I seem to have the static libs now, except... one. In the release build, there are four of each: the DLL, the exp file (not sure what this is for, will ignore it), the .lib file, and the -s.lib file. Except... window has three. It only has the DLL, exp, and .lib, but no -s.lib. Am I missing something?

I tried to re-run it, but visual studio does not want to rebuild (up to date). I tried changing a comment line, and it re-ran then, but still no -s.lib for window.

Is this normal?


30
General / Building SFML 2.0-rc for use with VS2012
« on: March 15, 2013, 09:46:29 pm »
Greetings. I switched IDEs, and after trying out JSFML, I figured knowing how to build things will be useful in the future, such as if I ever try a Linux distribution.

Anyway, I am now using Visual Studio (I don't need to hear whether or not it sucks). In this case, 2012, which apparently is actually version 11. Anyway,  the RC had libs for 2010, but I got the different versions of it error. So, I was on a quest to build it.

After downloading the snapshot from the download page (with the source), and followed the tutorial for 2.0 using cmake. I made a Visual Studio Win64 project (on 64-bit system). I was able to  build it in Release and Debug, which generated the debug and non-debug DLLS, as well as the static dll-initializing/loading libraries (without the s).

But there were no static builds. I asked around, and I heard there were supposed to be other build options, namely Debug-Static and Release-Static, but they are not listed in VS2012 in build -> configuration manager -> active solution configeration. Listed is Release, Debug, MinSizeRel and RelWithDebInfo.

How can I make the static libraries? I don't think this would make a difference according to the wording of the tutorial, but CMAKE_BUILD_OPTION was Release.

Pages: 1 [2] 3 4 5