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

Pages: [1]
1
Window / 'Print' window to file?
« on: June 09, 2014, 03:27:39 pm »
Is it possible in SFML to print the current window to a file format that can be converted to a picture e.g. png?

E.g.
...
window.clear();
window.draw(...);
window.print(...); // place holder for any implementation
window.display()
...

Thanks

2
General / Re: QuadTree is adding objects to only one children
« on: May 10, 2014, 05:08:13 pm »
as a first step, have you looked at outcome of the position comparisons inside void game::QuadTree::insert(sf::Sprite *other)?

if the position x and y of 'other' is larger than x and y (in that order) of the existing values (from constructor or init()) it would simply end up at SE -> insert(other); i.e. SouthEast as you say

3
General / Re: Compiling SFGUI with nmake install
« on: May 09, 2014, 08:41:03 pm »
sorry if this is off the mark, with regards to the CMAKE tutorial: start/run the CMAKE gui from the commandline (as opposed to from a shortcut), might make a big difference

4
General / Re: fps spikes
« on: May 09, 2014, 08:30:44 pm »
try standardising the time passed per iteration so that when things are being delayed the excess elapsed time is 'lost' and not used to update the game.

e.g. check out this post:
http://gafferongames.com/game-physics/fix-your-timestep/

5
General / Re: Help me a game snake
« on: May 09, 2014, 07:36:17 pm »
e.g. method moveSnake(sf::time dt, ...) could take a time parameter so that it moves proportional to the time elapsed in between being called (as opposed to fully each iteration, as shown). check out the tutorial on 'handling time':

sf::Clock clock;
while (window.isOpen())
{
    sf::Time elapsed = clock.restart();
    moveSnake(elapsed, ...);
    ...
}

with

moveSnake(sf::time dt, ...)
{
   ...
   snake[0].snakeSprite.move(dir.x * dt.asSeconds(), dir.y * dt.asSeconds());
}

6
General / Re: VS2013 - release build error LNK1181
« on: May 09, 2014, 06:40:09 pm »
ok, the .dlls (and .libs) created by CMAKE (including sfml-audio-2.dll and sfml-audio.lib) are in the build directory, which is referenced in the project's additional library directory for the release config i.e. C:\SFML-2.1-build\lib. and a copy of those .dlls is in the project's release folder.

update/resolution: unlike in the debug config's project settings, the release config's linker/input/additional dependencies/ still referred to .dlls (including "sfml-audio.dll") as opposed to, correctly, .lib files (including "sfml-audio.lib")

7
General / VS2013 - release build error LNK1181
« on: May 09, 2014, 05:10:10 pm »
1. built the SFML 2.1 files using CMAKE into separate /debug and /build folders;
2. referenced the include and library folders in the vs2013 project separately for debug and release config to its respective folder, with each config's correct path showing up in additional library directory;
3. copied the .dlls into the project's executive output's respective folder for both configs;
4. built the debug version fine;
5. the release build shows 'lnk1181 cannot open input file "sfml-audio.dll"' (which is the top one in the list of the additional [build] dependencies).

search turns up many references relating to linker errors but i don't see what i'm missing. any help much appreciated, thanks

8
General / Re: CMake doesn't work for VS 2013
« on: April 22, 2014, 10:08:47 pm »
sorry if this has been mentioned, but are you starting cmake gui from the command line (as opposed to stand-alone from shortcut, which may not work)?

9
Graphics / Re: Infinitely repeated tile as background sprite
« on: February 13, 2014, 07:21:20 pm »
It is useful, much more universal, I'll get back to it when my project evolves - thanks

10
Graphics / Re: Infinitely repeated tile as background sprite
« on: February 11, 2014, 11:21:18 pm »
Thanks, I'll stretch it to a max (though not leave it open-ended)

11
Graphics / Re: Infinitely repeated tile as background sprite
« on: February 11, 2014, 09:28:46 pm »
Many thanks to both of you - I was hoping for some kind of ray/open end option but this will do.

A second identical sprite involves moving just as well, so as per your initial suggestion I added a move counter

float   accumulatemoves(View.getSize().y); // simply for speed of 1.f

which increments inside the game loop

    ++accumulatemoves; // must be adjusted for varying speeds

and is checked against the View's travelled distance

 if (Sprite.getTextureRect().height <= accumulatemoves) {

                        Sprite.move(0.f, -Sprite.getTextureRect().height+View.getSize().y);
                        accumulatemoves = View.getSize().y;
                }

(which should be similar to what you show, though only along y.)

Many thanks for your help

12
Graphics / Infinitely repeated tile as background sprite
« on: February 11, 2014, 07:46:59 pm »
What I've got is

        sf::RenderWindow        Window(sf::VideoMode(1536, 768), "", sf::Style::Close);
        sf::View                        View(Window.getDefaultView());
        sf::FloatRect           fBounds(0.f, 0.f, 10.f, 1000.f); // arbitrary > view height
        sf::Texture             Texture;

        Texture.loadFromFile("C:/.../.png");
        sf::IntRect                     iBounds(fBounds);
        Texture.setRepeated(true); // repeat tile over sprite height
        sf::Sprite                      Sprite(Texture, iBounds);
        // move sprite 'up' by its height except the view height for start:
        Sprite.setPosition(fBounds.left, fBounds.top - 1000.f + View.getSize().y);

        while (Window.isOpen()) {

                View.move(0.f, -1.f); // negative y to move 'up' along sprite height

                Window.clear();
                Window.setView(View);
                Window.draw(Sprite);
                Window.display();
        }

Although I got confused with the y-axis pointing downward and the .png upward, this now repeatedly tiles the sprite (vertically), up to sprite height only however.

Is it possible, and how, to make the .png tiling truly infinite, or at least overcome the iBounds restriction?

Thanks

13
SFML projects / Re: SFML book run-time error - CMAKE NMAKE for VS2013
« on: January 16, 2014, 05:23:36 pm »
Thank you all for your comments - it's up and running (for now anyway)  :)

Configuring CMAKE for both 'debug' and 'release' produced the respective .dlls (using separate build folders and libsndfile and openal32 .dlls as before from the sfml source folder). (- I think that the tutorial saying "if you generate a workspace for an IDE that supports multiple configurations, such as Visual Studio, this option is ignored and you automatically get all the available build types in it" about CMAKE_BUILD_TYPE tempted me to tick it off, but no excuses.)

Again, many thanks everyone

14
SFML projects / SFML book run-time error - CMAKE NMAKE for VS2013
« on: January 15, 2014, 07:44:13 pm »
Hi - On my way into SFML, got the book, now trying to run the game.

As per the SFML tutorial page, I used CMAKE to configure (NMAKE makefiles) and compile the source files (NMAKE all), which resulted in 5 dlls, from sfml-audio-2.dll to sfml-window-2.dll (no sfml-main-2.dll). All dlls (including b. below) are copied into the project's .exe folder. The project compiles but when I try run the build solution in debug mode, an unhandled access violation occurs when calling sfml's '.LoadFromFile()', in the memcpy.asm file, apparently. Two issues, maybe:

a. There's no sfml-xxx-d-2.dll to set the link dependencies in debug mode;
b. The project still relies on the libsndfile-1 and openal32 dlls from the originally sfml download.

As much as I can tell, a. in particular causes a discrepancy and maybe the crash; I don't know about b.

Are sfml-xxx-d-2 dlls expected from NMAKE? Or am I going wrong somewhere else? VS2013?

Thanks

Pages: [1]