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.


Topics - FRex

Pages: 1 ... 3 4 [5]
61
General / Visual pop-up from intelisense shows enum values instead of names
« on: November 03, 2012, 05:47:09 pm »
Hi. :)
This is quite stupid but I couldn't find it by googling or anywhere in options.
I recently upgraded to vs2010 from vs 2008 and now in code completion, functions default parameters that are integrals but use enum constants(the bit flags approach with enums being 1<<x and |s to specify few options in one function parameter, like window style in sf and sfg) are shown as values.
Ie. I see sfg::Window::Create(int style=7) instead of sfg::Window::Create(int style=TOPLEVEL).

62
Graphics / Quads that are not rectangles
« on: October 22, 2012, 11:18:38 pm »
Hi. ;D
Ok, so I have a quad, that is not a retangle nor square. It's a trapezoid.
Basically, the quad act as if it's a pair of triangles and texture becomes deformed the farer its' shape goes away from a square.
In case problem is on my end I attached the screens of what I see.
In case problem is not on my end, is this the desired and/or expected behaviour?
I didn't look very carefully through documentation but only thing I could notice is the warning about integer texture coords(but irrelevant here).
Here the code and image to reproduce the problem, press any key to increase the trapezoidness of the quad, press any mouse button to toggle texture smoothing(doesn't help):
#include <SFML/Graphics.hpp>
int main(int argc,char * argv[])
{
        sf::RenderWindow app(sf::VideoMode(600,600),"");
        sf::VertexArray arr(sf::Quads);
        sf::Vector2f pts[4];
        pts[0]=sf::Vector2f(0.f,0.f);
        pts[1]=sf::Vector2f(0.f,64.f);
        pts[2]=sf::Vector2f(64.f,64.f);
        pts[3]=sf::Vector2f(64.f,0.f);
        sf::Texture tex;
        tex.loadFromFile("laser.tga");
        tex.setSmooth(true);
        float test=0.f,max=512.f;
        arr.append(sf::Vertex(sf::Vector2f(0.f,0.f),pts[0]));
        arr.append(sf::Vertex(sf::Vector2f(0.f,max),pts[1]));
        arr.append(sf::Vertex(sf::Vector2f(max,max-test),pts[2]));
        arr.append(sf::Vertex(sf::Vector2f(max,test),pts[3]));
        while(1)
        {
                sf::Event eve;
                while(app.pollEvent(eve))
                {
                        if(eve.type==sf::Event::KeyPressed)
                        {
                                test+=1.f;
                                arr.clear();
                                arr.append(sf::Vertex(sf::Vector2f(0.f,0.f),pts[0]));
                                arr.append(sf::Vertex(sf::Vector2f(0.f,max),pts[1]));
                                arr.append(sf::Vertex(sf::Vector2f(max,max-test),pts[2]));
                                arr.append(sf::Vertex(sf::Vector2f(max,test),pts[3]));
                        }
                        if(eve.type==sf::Event::MouseButtonPressed)
                        {
                                tex.setSmooth(!tex.isSmooth());
                        }

                }
                app.clear(sf::Color::Green);
                app.draw(arr,&tex);
                app.display();
        }
}

[attachment deleted by admin]

63
General / Where to put manager classes
« on: October 20, 2012, 02:28:32 am »
Hey, for example: textures manager, that holds map of strings to textures. Where to put it? It should be accesible from anywhere sf::Texture is... so.. everywhere, that's the problem. What are the options even? A static pointer of a class that also has static method GetReference()? Externs? Creating in main and passing pointer around anyone who is likely to request duplicates of already loaded texture?

64
SFML wiki / Tiled map with arrays
« on: September 25, 2012, 04:00:44 pm »
I've added totally basic tiled map example to source section:

https://github.com/SFML/SFML/wiki/Source%3A-TileMap

The wiki is quite... painful to work with.
I don't know how to make 'real' name disappear.
If I do "# Basic Tiled Map using SFML's VertexArrays" like other pages seem to, it doesn't show up at all and real name is still there.
Also I like how I had to kind of 'guess' that ```cpp makes code c++ while helper text says to indent entire block with at least 4 spaces or 1 tab.

65
General / Punching holes in const corectness (of sf::Drawable)
« on: September 19, 2012, 01:19:08 am »
Do you ever do that? It at times does get annoying how draw is const method.
Things like updating position of a sprite, updating animation count, updating frame count, ect. become a bit problematic, especially if the reason for derieving from drawable in the first place was for polymorphism.
It seems the only other way around that would be to create own drawable abc and then derieve all the sfml drawables from it.

66
Feature requests / More controll over sf::VertexArray's vector
« on: September 16, 2012, 05:55:35 pm »
If we know how many vertices we will load we could reserve() space instead of relying on appends(push_backs) that will :
1. reallocate few times
2. possibly reserve more memory than they need
How bad these two will be depends on implementation of the vector.
The un-solution is using resize but it still feels like there are unnecessary restrictions.

Possible changes I think of:
- reserve(vector's reserve) and/or trim(Scott Meyer's ranged swap on the underlying vector) methods
- method to return non-const pointer/reference to underlying vector since it seems nothing in the vertex array code will break no matter what is done to the vector(except deletion, but really, delete &something; can be done on anything and there are more dangerous things in sfml already).

67
SFML projects / Eduard Engine 0.0.1
« on: September 05, 2012, 01:22:25 am »
Just a little something I've been messing around with during last month to brush my c++, SFML, Box2D and interfacing-all-of-them-together-into-easy-to-manage-structure skills.

Download (Wins32 Relase compilation):
https://docs.google.com/open?id=0B8dEkQw1a4WvZERTbmdDMDZoT2c

Choose to download entire .rar(File-download or press Ctrl+S), then unpack and run the exe.
I don't know what will happen if you remove some of resources, I tried to make checks for fstreams but I might have missed a spot.  :)

Corners that have been cut:
-Options and Load Game are placeholders  :(
-Click on these two buttons and background creates a floating text 'Test'  :)
-The menu buttons are plain images  :(
-Only thing that is implemented so far are tiles and terrain
-Tiles are ugly placeholders
-Game and Editor automagically load the testing map
-Algorithm to change editor data into box2d data is not too good but well abstarcted away so if I come up with better one I can convert map with new one using 3 command lines

Controlls:
-Editor is controlled by tilde to toggle console, command lines(full list in Resources/Main/EditorDictionary.txt), mouse for editing and escape and wasdqd for camera, it's better and safer to avoid it for the time being, I might write instruction
-Game is controlled by W S A D keys, press E to toggle Box2D debug draw

SFML part:
-Windowing
-Time control with clocks
-Input, rendering
-Extremely easy Box2d debug draw rendering with vertices
-Not using the default font altho I didn't upgrade to the latest version and still have it  8)

Box2D part:
-Everything physics related ie movement, collision, callbacks(currently only very few, for example the jumping sensor that allows jumping only from top of something solid)

P.S. No, my name's not Eduard.  ;)
P.P.S. I wonder if someone reached this point.  :-\

68
Window / Github Keyboard.hpp mistake
« on: September 01, 2012, 09:57:26 pm »
Comment of line 144 in Keyboard.hpp at github says   "///< The F8 key" while it should say "///< The F9 key"  :D

69
Graphics / setFramerateLimit(x) vs. setVerticalSyncEnabled(true)
« on: August 09, 2012, 03:01:47 am »
How do these two work together in a RenderWindow, mainly:
1. If both were called, is the limit used the the smaller/bigger one of them two, or one that was put on the screen with last call or something else?

2. Is there a way to get max fps that these two permit RenderWindow to have?

3. If setVerticalSyncEnable(true) is called first, then setFramerateLimit(x) with x being smaller than max fps permitted by vertical sync and then setFramerateLimit(0) is called, is limit now again what vertical sync permits or there is no limit at all?

70
Graphics / How to display texture on things drawn by sf::VertexArray
« on: August 05, 2012, 05:36:42 pm »
I understand all primitive types and how they treat every point but I don't think I understand how to texture anything.
Am I supposed to 'just' pass sf::RenderStates object with pointer to my texture in draw call like that?
        sf::RenderWindow app(sf::VideoMode(500,500),"test");
        sf::VertexArray ver(sf::Quads,4);
        sf::Texture test;
        test.loadFromFile("Old_Resources/est.tga");
        ver[0]=sf::Vertex(sf::Vector2f(0.f,0.f),sf::Vector2f(0.f,0.f));
        ver[1]=sf::Vertex(sf::Vector2f(128.f,0.f),sf::Vector2f(128.f,0.f));
        ver[2]=sf::Vertex(sf::Vector2f(128.f,128.f),sf::Vector2f(128.f,128.f));
        ver[3]=sf::Vertex(sf::Vector2f(0.f,128.f),sf::Vector2f(0.f,128.f));
        sf::RenderStates states;
        states.texture = &test;
while(1)
{
        app.clear();
        app.draw(ver,states);
        app.display();
}
 

Pages: 1 ... 3 4 [5]