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

Pages: 1 ... 616 617 [618] 619 620 ... 720
9256
Graphics / Re: [Solved]Possible to reuse pixels?
« on: November 10, 2012, 11:26:05 pm »
Would this be safe or even sane however for a pseudo-infinite world?
Obviously not, but your graphics card can handle quite a huge VertexArray with ease. And the thread here was never about pseudo-infinite worlds. ;)

Also sorry to inject a newbie question to a solved thread but, with a vertex array could that be used with all its benefits to draw tiles from a tileset texture. I see that vertices have texcoords but i see no way to define a texture to use for the vertex/array or even how to define the rectangle (i get the coords may be the x/y of a texture but how many pixels across or high?) of that texture to use or some such.
The texture coordinates get edited for each vertex of the vertex array (note a sf::Vertex is a element of the sf::VertexArray). The texture itself then gets passed via the sf::RenderState as second argument for the draw call. The conversion happens implicitly. ;)

9257
Graphics / Re: Get the focus of a window
« on: November 10, 2012, 06:37:35 pm »
This applies only to keys, not mouse buttons ;)
Oh well, right. :D
I was unsure if it really worked like that, but then I thought of the key event which has the same naming scheme, thus I guessed it would work the same.

So if I keep my mouse down for 10 seconds, will the MouseButtonPressed event be given every loop in that 10 seconds?
No the MouseButtonPressed event will only get triggered once, you press down the mouse button. ;)

9258
SFML website / Re: Slow and aborted loading of forum pages
« on: November 10, 2012, 06:07:13 pm »
Might it be related to the Tapatalk mod? The timing could be right, or have you recently changed other parts of the forum?
I'd say there were problems too before but I can't quite judge.
Also I'm not sure how the mod hooks itself into it, but I wouldn't see how this would cause the problem.

9259
Graphics / Re: Get the focus of a window
« on: November 10, 2012, 05:00:22 pm »
So if I keep my mouse down for 10 seconds, will the MouseButtonPressed event be given every loop in that 10 seconds?
Depends on what you imagine under 'every loop'.
The event MouseButtonPressed will get triggered with a certain interval (usually configurable in your OS settings) and thus it won't get process every frame iteration. If you want a more accurate way use sf::Mouse.

9260
Graphics / Re: Draw point
« on: November 10, 2012, 02:16:36 pm »
For registering single clicks or keyboard presses at a time events are easier to use than inputs. Inputs will register far more than one press each time.
In SFML 1.6 the difference between the two 'systems' are only on the surface and the sf::Input class also depends on events, but in SFML 2 the system are strictly separated and sf::Mouse/sf::Keyboard don't have anything to do with events and thus the sf::Keyboad/sf::Mouse method could in theory be slightly preciser. ;)

9261
General / Re: Syntax Help
« on: November 10, 2012, 02:02:18 pm »
What am i doing wrong?
I'd say everything... :-\

First don't use global object and second a unique_ptr does not equal a raw pointer, thus you extern sf::RenderWindow* window; doesn't make any sense.

For the actual compiler error the problem is obvious if you'd look at your code. Here I've colored your brackets:
window( new sf::RenderWindow( sf::VideoMode( (800,600,32), "Test") ) );

A way better design would be to use a class:

Application.hpp
#include <SFML/Graphics.hpp>

class Application
{
public:
    Application();
    void run();

private:
    void update();
    void draw();

private:
    sf::RenderWindow m_window;
};

Application.cpp
#include "Application.hpp"

Application::Application() :
    m_window(sf::VideoMode(800, 600), "Test")
{

}

void Application::run()
{
    while(m_window.isOpen()
    {
        update();
        draw();
    }
}

void Application::update()
{
    sf::Event event;
    while(m_window.pollEvent(event))
    {
        if(event.type == sf::Event::Closed)
            m_window.close();
    }
}

void Application::draw()
{
    m_window.clear();
    m_window.display();
}
 

Main.cpp
#include "Application.hpp"

int main()
{
    Application app;
    app.run();
}
 

AS you can see no need for any globals and everything is wrapped into a nice class.

9262
Graphics / AW: Possible to reuse pixels?
« on: November 10, 2012, 11:14:00 am »
What do you mean by 'pixels'?
A pixel in SFML is a sf::Uint8 (iirc) and you can draw thoase onto a sf:Image, but I don't think that's what you want...
Can you maybe rephrase the question and define what your idea of pixel is?

9263
SFML website / Re: Slow and aborted loading of forum pages
« on: November 10, 2012, 10:59:01 am »
I can confirm this as well and I'm using Chrome too. (See my PM from last week.) :-\

9264
General / Re: SFML 2.0 tutorials
« on: November 09, 2012, 03:24:40 pm »
Does the tutorials for 1.6 work with version 2.0?
Depends on your definition of "work". :P
You can't copy the code since there's a major API change between 1.6 and 2.0, but the principles are mostly the same, so the prinziples "work". ;)

Does the 2.0 tutorials only explain new stuff from previous versions?
No, they just haven't been finished yet.

In case I'm not really experienced with SFML, is it better to use version 1.6 and it's tutorials?
Well I'd advise you to start with SFML 2, because it's less than 1.6, has more features and you won't have to relearn everything once SFML 2 is stable. ;)

Also keep in mind that there's a very detailed documentation which will makes things much easier.

9265
General discussions / Re: Hi?Question...
« on: November 09, 2012, 10:39:21 am »
I would use Window.Draw(X) but that appears to have fallen off the face of the earth
What?? ???

Are you maybe looking for window.draw(x)?

9266
General discussions / AW: Hi?Question...
« on: November 09, 2012, 09:08:36 am »
So it's a help thread nevertheless... ;)

There aren't many popular engines that were developed on their own. The way you should go is writing a game and at the end you'll hace some sort of an engine that could be polished a bit further. Never try to create a generic game engine, it just leads nowhere. Take for example, Quake, CryEngine, Cube-Engine...

That indie games often don't have the nicest codebase is more a finacial problem. ;)

9267
General / Re: Can't get my sprites to display
« on: November 09, 2012, 01:37:54 am »
Can you link me the documentation about that boolean wondering what it does.
Seriously? Just go to the class overview, the sf::Sprite and see for youself on the setTexture function... ;)

So what did the trick?

9268
General / AW: Re: AW: Can't get my sprites to display
« on: November 09, 2012, 01:25:23 am »
When you set the texture to the sprite, do you reset the texture rect?
sprite.setTexture(tex, true);
;)

9269
General / AW: Can't get my sprites to display
« on: November 09, 2012, 01:17:41 am »
When you set the texture to the sprite, do you reset the texture rect?
sprite.setTexture(tex, true);

9270
General / Re: Can't get my sprites to display
« on: November 09, 2012, 12:58:16 am »
Any idea why it won't display? Even though i get no errors and the image is being loaded?
No because you don't show enough relevant code... ::)

To display stuff on the screen you need to:
window.clear();
window.draw(drawable);
window.display();

And the drawable needs to be setup to actually have some area that could get drawn onto the screen.

So somewhere in your code your doing something wrong. ;)

Pages: 1 ... 616 617 [618] 619 620 ... 720