Jump to content

  • Log In with Google      Sign In   
  • Create Account

xycsoscyx

Member Since 15 Aug 2005
Offline Last Active Today, 02:31 PM

Posts I've Made

In Topic: About resouce files

24 May 2016 - 03:48 PM

A type of ico in the RC file, and "ico" in FindResource call, should result in a custom resource type.  "ico" is not an existing resource type (https://msdn.microsoft.com/en-us/library/ms648009(v=vs.85).aspx), which means it's being imported and compiled in as a regular blob in the resources.  This is why it gets found when finding it, there's no special handling going on and you're matching the RC type when finding it.

 

ICON and RT_ICON will do it's own special handling, and I've found that icons can be pretty tricky when used as resources.  Have you made sure that the icon is valid and supported (no odd sizes/laters/color depths/etc)?  Open the icon in Visual Studio and make sure it loads/looks correct, and try actually saving it there as well.  Make sure you save it explicitly (Save As and overwrite, or save to a new name), otherwise it might not think it needs to save.


In Topic: About resouce files

23 May 2016 - 03:49 PM

Look up Image on MSDN, you'll see a list of functions that you can use from it.  In particular, you should be able to use GetRawFormat to get the GUID of the image format that was loaded.

 

GetRawFormat: https://msdn.microsoft.com/en-us/library/windows/desktop/ms535393(v=vs.85).aspx

Image formats: https://msdn.microsoft.com/en-us/library/windows/desktop/ms534410(v=vs.85).aspx


In Topic: Create holes in plane dynamically

04 April 2016 - 12:54 PM

Try searching for information about Constructive Solid Geometry.  That lets you do boolean operations of shapes, so you could setup a ground mesh then subtract the spheres from it.  You could also look into voxels, setup a big array of voxels for the terrain, then just start removing the voxels as the user digs.  With voxels, you'd still need to look into some way of calculating the mesh from the voxels though, but there should be a lot of information about that online as well.


In Topic: SpriteFont render Umlaute

04 April 2016 - 08:12 AM

Correct, std::locale::global() sets some global values that std::regex (and other things) will use under the hood.  Since your string seems to get converted into UTF-8 during compile, setting the global locale to a UTF-8 variant means it will do proper handling when doing the regex expressions.  You shouldn't even need to reset to the old value, if you're using UTF-8 then you might as well use it across the board.  Set it and forget it.


In Topic: SpriteFont render Umlaute

01 April 2016 - 03:51 PM

It looks like it's auto converting to utf-8, but doing straight character comparisons.  There's a lot going on under the hood when working with STL and regex and etc, including dealing with locale.  Here's a good example of setting the locale to support utf-8:  http://stackoverflow.com/questions/11254232/do-c11-regular-expressions-work-with-utf-8-strings

 

char strings typically are simple strings, but utf-8 is a type of encoding.  You can store a utf-8 string in a std:string, but at that point it's really not human readable anymore.  A lot of editors know that the string is utf-8 and auto convert when displaying the value, but if you look at the raw memory then you'll see that it's actually a buffer of utf-8 data under the hood.  That's what's happening with äüöß to Ã¤Ã¼Ã¶ÃŸ, Ã¤Ã¼Ã¶ÃŸ doesn't make any sense when reading, but the values in it are the utf-8 encoded data for äüöß.

 

EDIT: This is why your solution works, you're extending the regex to check the encoded utf-8 values.  You won't need to do that if you set the locale ala the SO link, or if you switched to using wchar_t types (wregex/wstring).


PARTNERS