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

Pages: 1 [2] 3
16
Graphics / Won't load image
« on: March 09, 2011, 05:15:49 am »
Code: [Select]
if(Image.LoadFromFile("sprite.png"))
      return EXIT_FAILURE;


It should be:

Code: [Select]
if(!Image.LoadFromFile("sprite.png"))
      return EXIT_FAILURE;

17
Graphics / Rendering differences between XP / 7
« on: March 07, 2011, 07:05:29 am »
If the application is just the same on both OSs (PCs), may be it's a graphic driver issue on Windows 7?

18
Graphics / Drawing thousands of sprites
« on: March 07, 2011, 06:13:35 am »
@ SuperV1234:
Quote
How do I look at the MSIL code? And what should I look for?

To get MSIL code out of a built managed assembly you may use MS utility IL DASM (IL disassembler).
An example of what ILDASM gives:
Code: [Select]

.....
IL_000c: ldloc.0
IL_000d: box [mscorlib]System.Int32
IL_0012: ldstr ", "
IL_0017: ldloc.1
IL_0018: unbox.any [mscorlib]System.In32
.....

You can see box and unbox operations. They are performed when value types are converted to reference types (to place objects in the managed heap) and vice versa. Depending on your code there may be lots of these operations. They may be rather time-consuming and make your loops heavy. I'm afraid I can't give you detailed explanation as English is not my native language. You may use googling to find relevant info on this topic.  :wink:

19
Graphics / Drawing thousands of sprites
« on: March 05, 2011, 05:47:48 am »
Quote
I think it's not a problem related to .Net

Not for sure. In fact .Net may slowdown the loops due to intensive boxing/unboxing that may implicitly occur in the code. Did you look through MSIL code?

20
Quote
Also these programs will highlight the opposite brace such as
{
}

Quote
it's pretty surprising that these features aren't standard in such an expensive and widely used IDE, am i wrong?

At least in VS Pro+ brace matching is highlighted out of the box and may be configured. IIRC, in Express it is configurable as well. Something like: Tools->Options->Environment->Fonts and Colors->Brace Matching. In Express not all options are available by default but they may be turned on.

21
General / getting SFML to work with Visual Studio 2010
« on: February 28, 2011, 05:48:42 pm »
1. To be more precise, there is one dependency for SFML-1.6 that must be re-built in vs2010. Sfml-graphics library depends on freetype.lib and is statically linked to it. Thus it must be rebuilt. Other dependencies /openal32.lib and sndfile.lib for sfml-audio library/ are linked dynamically and may be used "as is".
2. I mean that the linker must know where to find sfml-sytem-d.lib. Using linker section in project settings you can set up the right path to the library. I don't think it's a good practice to move *.lib files to a project's folder. You'll get lots of copies of the same file scattered here and there if you have more than one project.

22
General / getting SFML to work with Visual Studio 2010
« on: February 28, 2011, 04:16:10 pm »
Quote
...and rebuilt the libs in VS 2010

1. Did you re-build all sfml dependensies in vs2010 as well?
2. I think, you should add the path to your sfml-system-d.lib in the project settings /Linker->General->Additional Library Directories/.

23
Window / [SOLVED] Toggling input language...
« on: February 21, 2011, 06:43:15 am »
A hidden topmost window this message is posted to, instead of main SFML render window would somehow explain this behaviour. But the windows utility Spy++ does not show that this is the case. I don't know what gives. :( To delve deeper and investigate the problem, I think I need to set up hooks for this message and its companions, but so far my solution works for me, and I'm gonna put the investigation on the back burner.
BTW, WM_INPUTLANGCHANGEREQUEST seems to be the most misterious message in Windows. Out of curiosity I made the same investigation on my laptop with Vista instead of XP, and found that this message was NEVER posted to an SFML window. But my application with patched WindowImplWin32.cpp works fine. :shock:
At the bottom part of MSDN page http://msdn.microsoft.com/en-us/library/ms632630%28v=vs.85%29.aspx with description of WM_INPUTLANGCHANGEREQUEST I found an interesting info (please find the paragraph 'Community Content' if you are interested). At least a few guys already had problems with this message before. :)

24
Window / [SOLVED] Toggling input language...
« on: February 20, 2011, 02:56:14 pm »
Finally I managed to solve this issue. I had to make a small change in SFML source (WindowImplWin32.cpp). I changed the second parameter value from myHandle to NULL in WinAPI function PeekMessage. Now it peeks every message from the current thread's queue. I don't like to change 3d-party's libraries because of maintenance problems. But here it was the only way I had found.  :?

25
Window / [SOLVED] Toggling input language...
« on: February 18, 2011, 07:27:34 am »
I'm still stuck with this issue. To delve deeper I traced windows messages that are being sent (posted) while I'm toggling input language. Using some tricks I managed to force my sfml window to react properly. This case is called 'Normal sequence'. But without tricks the issue still remains ('Abnormal sequence').
Quote
Normal sequence:

1. Press and release Ctrl+Shift to toggle input language to native. We can see windows messages, both WM_INPUTLANGCHANGEREQUEST and WM_INPUTLANGCHANGE.
Pay attention to the fact that toggling occurs after the key Ctrl is released and before the key Shift is released.
Charset successfully changed to 204, and the 'Q' key gives us the code 233.


P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:1 fUp:1
P WM_INPUTLANGCHANGEREQUEST fSysCharset:True hkl:04190419
S WM_IME_NOTIFY dwCommand:IMN_CLOSESTATUSWINDOW dwCommand:00000001 dwData:00000000
R WM_IME_NOTIFY
S WM_IME_NOTIFY dwCommand:IMN_OPENSTATUSWINDOW dwCommand:00000002 dwData:00000000
R WM_IME_NOTIFY
S WM_INPUTLANGCHANGE charset:204 hkl:04190419
R WM_INPUTLANGCHANGE
P WM_KEYUP nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:1

P WM_KEYDOWN nVirtKey:'Q' cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_CHAR chCharCode:'233' (233) cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:'Q' cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:1 fUp:1

2. Again press and release Ctrl+Shift to toggle input language back to english. As above we can see both messages.
Charset successfully changed to 0, and the 'Q' key gives us the code 113.

 
P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:1 fUp:1
P WM_INPUTLANGCHANGEREQUEST fSysCharset:True hkl:04090409
S WM_IME_NOTIFY dwCommand:IMN_CLOSESTATUSWINDOW dwCommand:00000001 dwData:00000000
R WM_IME_NOTIFY
S WM_IME_NOTIFY dwCommand:IMN_OPENSTATUSWINDOW dwCommand:00000002 dwData:00000000
R WM_IME_NOTIFY
S WM_INPUTLANGCHANGE charset:0 hkl:04090409
R WM_INPUTLANGCHANGE
P WM_KEYUP nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:1

P WM_KEYDOWN nVirtKey:'Q' cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_CHAR chCharCode:'113' (113) cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:'Q' cRepeat:1 ScanCode:10 fExtended:0 fAltDown:0 fRepeat:1 fUp:1

Abnormal sequence (no toggling):

P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_INPUTLANGCHANGEREQUEST fSysCharset:True hkl:04190419
P WM_KEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYUP nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:1

Or this (the real order of key pressing does not matter):

P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_INPUTLANGCHANGEREQUEST fSysCharset:True hkl:04190419
P WM_KEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYUP nVirtKey:VK_SHIFT cRepeat:1 ScanCode:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:1

26
Window / [SOLVED] Toggling input language...
« on: February 10, 2011, 08:57:10 am »
I've got a problem while toggling input language (Native/English) on the keyboard in my SFML application. In my OS Windows XP SP3 I set up the shortcut Shift+Ctrl for this option. But the language does not toggle. Other apps work fine. To do the trick I'm using the following key sequence: press Shift, press Ctrl, release Ctrl, press Alt, release Alt, release Shift.

Here is the test code:
Code: [Select]
#include "stdafx.h"
#include "SFML/Graphics.hpp"


int _tmain(int argc, _TCHAR* argv[])
{
  sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

sf::String str;
sf::Text text;

  while (window.IsOpened())
  {
    sf::Event evnt;
    while (window.GetEvent(evnt))
    {
      if (evnt.Type == sf::Event::Closed)
        window.Close();

      if (evnt.Type == sf::Event::TextEntered)
      {
str += evnt.Text.Unicode;
text.SetString(str);
      }
    }
 
    window.Clear();
    window.Draw(text);
    window.Display();
  }


return 0;
}

I guess there's something wrong with keyboard events handling. Is there any workaround for this behaviour? :?

27
General discussions / Lua and C++
« on: January 29, 2011, 03:46:54 pm »
There is a good alternative to Luabind called MLuabind. It uses Loki library instead of Boost. Though it is rather dated and currently not maintained it works fine. Using MLuabind compile time is shorter than with Luabind & Boost.

28
General / Help me use SFML on VC++ 2010 please! (:
« on: December 14, 2010, 11:01:45 am »
@Lawgiver:
Look at the content of your library sfml-window-s-d.lib:
 
Quote
Longnames:
   00000   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\Joystick.obj
   00093   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\VideoModeSupport.obj
   00194   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\WindowImplWin32.obj
   00294   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\Context.obj
   00386   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\Input.obj
   00476   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\VideoMode.obj
   00570   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\Window.obj
   00661   : H:\Programmierung\trunk\build\vc2008\..\..\Temp\vc2008\sfml-window\Debug static\WindowImpl.obj
   00756   : sfml-window.dir\Debug\WindowImplWin32.obj
   00798   : sfml-window.dir\Debug\VideoModeImpl.obj
   00838   : sfml-window.dir\Debug\Joystick.obj
   00873   : sfml-window.dir\Debug\WglContext.obj
   00910   : sfml-window.dir\Debug\WindowImpl.obj
   00947   : sfml-window.dir\Debug\Window.obj
   00980   : sfml-window.dir\Debug\VideoMode.obj
   01016   : sfml-window.dir\Debug\Input.obj
   01048   : sfml-window.dir\Debug\GlContext.obj
   01084   : sfml-window.dir\Debug\Context.ob

It looks like you somehow linked some obj files twice from two different places. And compare it with the following content of your sfml-system-s-d.lib.
Here everything is allright.
Quote
Longnames:
   00000   : sfml-system.dir\Debug\ThreadLocalImpl.obj
   00042   : sfml-system.dir\Debug\ThreadImpl.obj
   00079   : sfml-system.dir\Debug\Platform.obj
   00114   : sfml-system.dir\Debug\MutexImpl.obj
   00150   : sfml-system.dir\Debug\Utf.obj
   00180   : sfml-system.dir\Debug\ThreadLocal.obj
   00218   : sfml-system.dir\Debug\Thread.obj
   00251   : sfml-system.dir\Debug\String.obj
   00284   : sfml-system.dir\Debug\Sleep.obj
   00316   : sfml-system.dir\Debug\Randomizer.obj
   00353   : sfml-system.dir\Debug\Mutex.obj
   00385   : sfml-system.dir\Debug\Lock.obj
   00416   : sfml-system.dir\Debug\Err.obj
   00446   : sfml-system.dir\Debug\Clock.obj

29
Window / OpenGL not Working
« on: December 10, 2010, 07:29:25 am »
Quote
Laurent wrote:
You must link to sfml-window.lib and opengl32.lib.

Shouldn't it be sfml-window-S.lib if he uses SFML_STATIC?

30
General discussions / Help with .dll's...
« on: November 26, 2010, 09:51:13 am »
Yes. But as for vc runtime libraries it depends on the settings in your library project and its dependencies projects. If they was compiled with Multi-threaded DLL (/MD) set, then you have to distribute vc runtime dlls with your application. Besides, there are two SFML's dependency dlls (libsndfile-1.dll and openal32.dll). If your application uses sfml-audio library, they must be distributed as well.

Pages: 1 [2] 3