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

Pages: 1 2 [3] 4
31
Feature requests / Manually setting Z-order
« on: October 06, 2010, 08:29:53 pm »
My code is not fully optimize because as you say, using dichotomy is faster. However, my solution should be optimal enough and is very easy to code. Furthermore, when using dichotomie, you may not want to use a list anymore because accessing elements without an iterator is much slower.
With list, I don't know which one is quickest.
However, if you use vector, it migth be worse because of moving all the elements.
There might be a better container and it depends on the uses but it would be best if you could compare performance.
I'm using this method in my game and I have No problems since I insert/change z-order quite rarely.

32
General / Better way of enemy-list
« on: October 05, 2010, 08:50:38 pm »
if you are going to delete/add enemies very often and you almost never get them through there index (0,1,2,3,...), use a std::list. However, I do not think it should improve performance so much.

33
Feature requests / Manually setting Z-order
« on: October 05, 2010, 08:47:04 pm »
Personnaly, I don't use std::sort or std:::lists::sort.
Since elements are always inserted/changed z-order/... less than once per frame, the best performance solution is :
-each_time you add an element, you put it in the right place (insertion).
-each time you change an element's Z-order, you put it in the right place.

=>Your elements are always sorted even if you never sort them all

=> you can delete a Drawable without sorting anything.
=>You only use a bit of performance when you add/change a element.
=> to draw, just create an iterator and draw them all.

Pseudo code :

Code: [Select]
Class::inset_new(Drawable*d, unsigned plan)
    std::list<std::pair<Drawable*, unsigned int> >::iterator it;
    for(it=mylist.begin();it!=mylist.end();it++)
        if(it->second>plan)
            break;
    mylist.insert(std::make_pair(d,plan));


I let you guess the slution for changing Z-order.
This code is Pseudo code because I will not assure it will work (didn't check nor reread myself).

34
General discussions / Retro compatibility
« on: October 05, 2010, 06:19:41 pm »
Quote
You may also use the SVN version of SFML 2, such that you are able to keep the code constantly up-to-date.


I'm having enough trouble finishing my project with 1.6 to keep another version up to date with 2.0
I just wanted to have an idea to know where I might have problems and try to find a solution that wouldn't be to diffulcut to adapt for 2.0.
I've heard that rendering might be different in respect of OPENGL functions when displaying drwables. How much ? would it effect basic functions like GlClipPlane ?

I do not have any problems with naming changes, minor changes that just take a bit of search/replace to adapt.
However, I would like not to have to change a major part just because some things like threads don't exist (which would be quite unlickly : this is just an example).

35
Window / SFML interferes with SETCursor(win32 func)
« on: October 04, 2010, 08:05:54 pm »
extract from : msdn

Quote
Your application can change the design of the cursor by using the SetCursor function and specifying a different cursor handle. However, when the cursor moves, the system redraws the class cursor at the new location. To prevent the class cursor from being redrawn, you must process the WM_SETCURSOR message. Each time the cursor moves and mouse input is not captured, the system sends this message to the window in which the cursor is moving.


And when the crusor is redrawn, it is the arrow that is redrawn (found that somewhere else on msdn but having trouble finding it).

this link explains what I was saying.

Furthermore, I couldn't find a similar function for linux. Has someone got any Idea ?

36
Window / SFML interferes with SETCursor(win32 func)
« on: October 04, 2010, 07:26:46 pm »
Found a solution but i'm not completely satisfied.
So, here is the solution :
Code: [Select]

window_handle=FindWindow(NULL,TEXT("SFML Window"));
if(window_handle==0)
    std::cout<<"error";


and,

Code: [Select]
HCURSOR c;
switch(t)
{
     case Cursor::WAIT :
           c=LoadCursor(NULL, IDC_WAIT);
           break;
     case Cursor::HAND :
           c=LoadCursor(NULL, IDC_HAND);
           break;
     case Cursor::NORMAL :
            c=LoadCursor(NULL, IDC_ARROW);
            break;
      case Cursor::TEXT_EDIT :
            c=LoadCursor(NULL, IDC_IBEAM);
            break;
}
if(!c)
   std::cout<<"no cursor";
else
   SetClassLong(window_handle, GCL_HCURSOR, (LONG)c);


However, I do not like the way a get the window handle. Is there a better way ?
Can I do something similar with linux (if so, please lead me in the right direction)?

37
General discussions / Dealing with English and French languages
« on: October 03, 2010, 05:01:06 pm »
Should I translate the different topics I've posted in the english forum into french ?

38
Graphics / sf::String and size errors
« on: October 03, 2010, 04:59:17 pm »
How can I get the characters included in the Font file ?
Is there an option for charset=AllAvailableCharacters ?

Quote
Will there be a solution in 2.0 (it would be nice)?

Yes Smile


I'm very glad to here that. Nice (futur ?) job !
Quote

In fact it should be ok with GetSize(), I'll do some tests to see what's wrong.


Ok. Perfect.

I must say, you are doing a great job answering all those questions. Wouldn't think you would answer so much with CAMP and SFML as projects...

[EDIT] Does it take more memory to Load the whole charset (I guess the answer is yes). More time printing (accessing to the Sprties is longer) ?

39
Graphics / sf::String and size errors
« on: October 03, 2010, 04:43:30 pm »
Quote
This information depends on the font's metrics, and I don't think that you can retrieve the relevant values in SFML 1.


Will there be a solution in 2.0 (it would be nice)?

I don't really understand the idea of font metric's. Could you give me a clue of how to calculate the cursor's position ?

Quote
You need to check its Unicode code, and if it's not in range [0, 255] then you won't be able to display it with the default font.


Thanks, i'm dealing with Unicode strings, however i was using default font...
How can I know which font supports which characters ?



I'm using sf::String::GetSize() (i'm in 1.6 so no sf::Text::GetSize()).

40
General discussions / Dealing with English and French languages
« on: October 03, 2010, 04:39:34 pm »
Hi, personaly, I can speak english sufficiently well to write/understand what happens on the french and english forums. However, each time I write a new topic, I wonder if a should post it on the french, english or both forums.
Would it be possible to have an option saying "link these two subjects" which would say to any user who went on it :

"There is an equivalent subject on the French forum, please visit it if you want to see all the arguments." with a link to the French subject.

This would make it possible to know wether we are missing arguments.
Furthermore, for the project and source-code part of the wiki, I think they should be shown in both wikis because projects and source-code can be understood even if the language isn't the right one.

Thank you, please give me your opinions.

41
General discussions / Retro compatibility
« on: October 03, 2010, 04:29:25 pm »
Ok, thanks its just i'm doing a project on 1.6 and I want to be sure not to have to much problems when going to 2.0.

42
Graphics / sf::String and size errors
« on: October 03, 2010, 04:27:46 pm »
I can assure you (for I've just tried with Block note) that the cursor goes under the base line. The question is, by how much ?
Does somebody know why I can't display a € symbol with the default font ?
Thank you.

43
General discussions / Retro compatibility
« on: October 03, 2010, 03:49:44 pm »
Thanks for this little summary, I wonder why Rect changed, I always hated width/height Rects... If anybody has more information, please add...

44
Graphics / sf::String and size errors
« on: October 03, 2010, 03:47:15 pm »
If you look at the following Image, you will notice that the | seems to high compared to the j.


45
Window / SFML interferes with SETCursor(win32 func)
« on: October 03, 2010, 02:48:50 pm »
Hi, I've decided to use directly windows to deal with Cursors by doing this :

Code: [Select]
HCURSOR c=LoadCursor(NULL, IDC_WAIT);
if(!c)
      std::cout<<"no cursor";
SetCursor(c);


However, it works fine until an event (Keypress and Textentered don't cause any problem) is emitted. My question : How can I keep my cursor the way it is without having SFML changing it back just after ?

Thank you.

[EDIT] Found the problem : when a WM_SETCURSOR event is emitted, I must return true. However, this can't work because SFML hides the window events. Is there a way to make it so that SFML return true ?.

Pages: 1 2 [3] 4
anything