Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: New graphics API ready  (Read 93014 times)

0 Members and 1 Guest are viewing this topic.

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
New graphics API ready
« Reply #225 on: February 01, 2012, 12:48:12 am »
Laurent,

Code: [Select]
void DrawLine(sf::Vector2f a, sf::Vector2f b)
{
    sf::Vertex line[2] = {a, b};
    window.Draw(line, 2, sf::Lines);
}


How can I specify the line color this way?
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
New graphics API ready
« Reply #226 on: February 01, 2012, 12:50:10 am »
SFML / OS X developer

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
New graphics API ready
« Reply #227 on: February 02, 2012, 10:58:02 pm »
Is it normal that when inheriting from Shape, I need to call Update() to see anything? (If I don't, the virtual methods never get called.)
From the doc, it's not obvious that you need to call it for a static shape.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
New graphics API ready
« Reply #228 on: February 03, 2012, 08:02:00 am »
You need to call it at least once, in the constructor.
Laurent Gomila - SFML developer

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
New graphics API ready
« Reply #229 on: February 04, 2012, 01:06:17 am »
The only way I figured it out was to read SFML's shapes' source. Update()'s documentation says that you must call it when the geometry changes, and it's not obvious that this includes when you haven't set the geometry yet.
I think it should be in the introduction as well, currently it's easy to believe that you only need to override the two methods.

In my Python binding, RenderTarget.draw() takes a list instead of a Vertex* a vertex count, so I'm considering removing VertexArray. But I'm wondering, why not use let the user pass a vector<Vertex> in C++ then?
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
New graphics API ready
« Reply #230 on: February 04, 2012, 08:38:30 am »
Quote
The only way I figured it out was to read SFML's shapes' source. Update()'s documentation says that you must call it when the geometry changes, and it's not obvious that this includes when you haven't set the geometry yet.

I thought it was very obvious that the first time you define the geometry, it changes. I'll add something to the doc.

Quote
In my Python binding, RenderTarget.draw() takes a list instead of a Vertex* a vertex count, so I'm considering removing VertexArray. But I'm wondering, why not use let the user pass a vector<Vertex> in C++ then?

The C++ version allows to Draw a <Vertex*, count> too. So the user can pass anything he likes.
Laurent Gomila - SFML developer

  • Guest
Re: New graphics API ready
« Reply #231 on: February 27, 2012, 03:35:08 pm »
Quote from: "Laurent"
Hi

I've pushed a first version of the new graphics API, so that you can test it. Please focus on the API, there's no optimization yet so the performances are worse than before. I can't upload the documentation, so you'll have to either generate it yourself, or directly look into header files.

The new API is available in the 'drawables' branch of the main repository.

It is for testing only, if you want a final and optimized version then wait until it is merged into the master branch.

Thanks :)

Thanks for info

 

anything