Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Feb 2002
Offline Last Active Today, 12:13 AM

#5316175 Moving from plain "ascii" to XML?

Posted by on 21 October 2016 - 11:33 PM

Another option would be using Lua. It's a full blown scripting language, that actually started out as being used for config files.

If you intend to add scripting support to your library as well this might be a good match.

#5314159 Why didn't somebody tell me?

Posted by on 06 October 2016 - 01:11 PM

Yeah, with no selection I want Cut/Copy to affect all. Esp. annoying in painting apps, that simply do nothing without selection instead of simply copying the whole image.

Did you know the (Windows) clipboard can contain different formats at once? You can insert an image as image (duh, but several kinds of image are possible) plus for example a custom type to contain more metadata. Normal programs can paste an image, your program can act on the custom type.

Also, at least in explorer, in the tree view, pressing left repeatly closes the folder you're in (if it's expanded) or moves to the next parent (if it's closed).
Alt-Numblock-* will open the next level of all sub folders under the selected one.

#5311733 Create a dynamic library in linux and link to it using Visual Studio Linux De...

Posted by on 20 September 2016 - 11:35 PM

Your linker input has "projects" in it, while the resulting path for the library doesn't. The paths don't match.

Simple check: Does a file "projects/foo/bin/x64/Debug/libfoo.so.1.0" exist where you expect it?

#5308783 Getting debug information using TextOut()

Posted by on 30 August 2016 - 11:33 PM

What value are you returning after handling WM_PAINT? It should be zero; do not pass it on to DefWindowProc, if you draw things yourself.

The flickering could well be WM_ERASEBKGND. If you do all your drawing in WM_PAINT, you can handle WM_ERASEBKGND doing nothing and return a non zero value.

Remember: The return value of a handled message is important. And, if not told otherwise in the messages docs, pass the message on to DefWindowProc. A good WindowProc looks like this:

switch ( MessageType )
  case WM_xxx:
    // do stuff
    return or break, depending on what the message docs say
  case WM_other_xxx:
    // do other stuff
    return or break, depending on what the message docs say
return DefWindowProc( arguments );

#5307783 Why wont my win32 program paint?

Posted by on 25 August 2016 - 12:31 AM

Just a reminder:

Don't rely on rect's top and left members being zero. For simple GetClientRect it'll pretty much always be, but the safe approach would be the one you almost had before:

width = r.right - r.left;
height = r.bottom - r.top;

#5306976 Win loop errors

Posted by on 20 August 2016 - 11:29 PM

The == also is required in the if conditions.

Otherwise the first if check always evaluates to true. Remember, in C/C++ any value other than zero is promoted to true if queried as boolean.

#5303277 2D Rpg Cutscenes

Posted by on 30 July 2016 - 11:36 PM

There's different solutions to this, the basic premise is:

* having some kind of scripting (either a real scripting language or a simple enum based scripting)
* allowing to run those scripts in slices (e.g. coroutines in Lua) or simply a set number of events per frame
* scripting events may actually be spread across several frames (e.g. an action move npc 17 to location 12,10 and wait until he arrived, etc.)

#5298076 Suggested patterns for declaring and detecting event triggers?

Posted by on 26 June 2016 - 01:13 AM

Wouldn't simple event handlers in Lua suffice? They could be simple functions (per map probably) that are called if the backend raises an event:


function ButtonPushed( ButtonName )
  -- do something
function TriggerAreaEntered( AreaName )
  -- do something else

#5297944 Including from the Standard C++ Library

Posted by on 24 June 2016 - 11:44 PM

Templates are a major reason. As pretty much all compilers can't separate template declaration from definition all code is inside the header file.


All these cmath, string, etc. are still regular headers, just without extension. At least VS automatically adds references to the C++ runtime libs, so all you need to do is to include the headers. The libs are imported "under the hood".

#5297175 VS2015 skipped reading glew.h file

Posted by on 18 June 2016 - 11:23 PM

You've got precompiled headers active. Turn it off in the options or include the glew headers in stdafx.h.

#5294583 WinAPI + OpenGL: Change window style and/or resolution

Posted by on 01 June 2016 - 11:37 PM

MSDN on SetWindowLong states:

Specifically, if you change any of the frame styles, you must call SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly.

#5285965 Input Polling - Low Latency API

Posted by on 09 April 2016 - 01:25 AM

Nobody mentioned the Raw Input API? That's what you ought to use for Windows nowadays. It's a bit complicated to set up, but you're not missing any key presses or controller events.

#5285730 My app cannot write files anywhere on Windows 10

Posted by on 08 April 2016 - 12:40 AM

So, have you actually checked the error code (GetLastError) after a create/write fails? This would be a real good indication on what exactly the issue is.


You might think it's an issue with access rights and it could be a wrong path or similar.

#5277482 Free painter program with transperent color

Posted by on 22 February 2016 - 01:18 PM

Paint.NET is also a decent free tool (http://www.getpaint.net/download.html)

#5272443 Desktop capturing with DirectX 11

Posted by on 24 January 2016 - 02:01 AM

The problem I think is that you can't simply access the desktop backbuffer (there might not even be one -> classic theme) from DirectX. You best bet is probably using GDI. It's not that performant, but you only need to grab it once:


Look at http://stackoverflow.com/questions/5069104/fastest-method-of-screen-capturing, the GID way.