Windows 7 – Changing desktop icon label colors
If you've ever disabled casting of shadows by desktop icons in Windows 7 (System - Additional system parameters - Performance), you might have noticed that it's not possible to set actual colour of icon/thumbnail captions.
It is said, that Windows decides that on it's own, judging from image colours (luminance?).
But is it always the right decision?
Probably not. Time to time I get things like these:
However, despite of it being said that this is automatic, there is is a way to influence decision of system on deciding with a colour. And it is actually a simple one.
Continue readingHaxe: Neko Server-client communication example (chat)

Recently I've been searching for examples of client-server communication in Haxe, however could not find anything specific. After some search and asking around, I was pointed to sys.net.Socket class, but the actual means of usage remained unclear. It was also confirmed to mirror POSIX socket functionality. Indeed it does that, though, given that Haxe implementation uses exceptions rather than return values, usage remained uneasy.
After some experimenting, I've figured a semi-simple way of using "blocking" sockets.
Continue readingMinecraft: all at once of ChestShop bugs
So I'm publishing a list of bugs with more or less comprehensive information, including measures that need to be taken to exclude these.
Here's a video demonstration (with version 3.46) and a description of each bug pictured in video:
Continue reading
GameMaker: Finding resources by name
Once in a while you might want to get a resource index out of it's string name, like so:
instance_create(x, y, 'obj_item' + string(irandom_range(1, 3)));
But, resource indexes aren't strings, so that wouldn't work.
You could add indexes into an array, or have a little switch-statement, but take a bit to set up.
So let's see what else you can do about this,
Continue readingGameMaker: Circular cooldown rectangle
I do not know the exact name of this visual effect (angular/clockwise fade-in/fade-out?), but it is one of the most common things that you can see in interface of RPG and RTS games, displaying progress of construction/upgrade/ability cooldown. So, to the point...
You can read how this is actually being implemented, or just scroll down to the bottom of post and grab the code and/or GMK file.
Implementation of such is actually pretty simple,
Continue reading
GameMaker: Bezier curve/path simulation
If you are working with GameMaker, you might have wandered, how to make paths similar to standard ones but in 3 dimensions, or how to efficiently draw path of non-1px width, or other things not covered by path functions.
For this reason, I have made the following function:
Continue readingLove2d: Haxe: Ray-circle intersection test
By user request on Love2d IRC channel, yesterday I've made this nice function to do intersection/collision check between a ray (for clearance, here, a ray is a infinite line with starting point but no end point) and a circle.
Underlying code is fairly simple, though it does not even require understanding to use the function.
Love2d version takes advantage of multi-return values.
Haxe version has slightly longer code due for more optimal implementation of interface.
Download Haxe .hx Download Love2d .love
Snip:
--[[ Does a ray-circle intersection test. Parameters: x1, y1, di - x, y, direction (radians) of ray x, y, r - position & radius of circle Returns: result - whether collision occurred x - collision X y - collision Y distance - distance from ray start to collision point ]] function ray2circle(x1, y1, di, x, y, r) local vx = math.cos(di) local vy = math.sin(di) -- get relative XY of circle (relative to ray origin): x = x - x1 y = y - y1 -- rotate it based on ray direction (as if ray starts at XY=0 and goes at +X): local tx = x * vx + y * vy local ty = x * vy + y * -vx -- clear misses: if (tx < -r) or (ty > r) or (ty < -r) then return false, nil, nil, nil end -- find X coordinate that line hits rotated circle at th = math.abs(math.cos(math.asin(ty / r))) * r -- too far behind if (tx + th < 0) then return false, nil, nil, nil end -- line start is inside the circle: tx = tx - th if (tx < 0) then return true, x1, y1, 0 end -- return true, x1 + tx * vx, y1 + tx * vy, tx end
Love2d: Semi-turn-based platformer
A very rushed Haxe version to demonstrate how it looks in motion.
Does not necessarily represent features of love2d version in this post.
This was originally going to be a short reply-fix for a topic on love2d forum, but it seems that author did get somewhere with figuring that out on ones own, and I've quite overdone it in terms of a simple answer, so I formatted the code nicely, added several more features, and made this example.
Just in case above demonstration does not work, this example demonstrates a specific approach to game dynamic, where game logic occurs once per interval, while things are drawn and receive input at higher rate. I do not recall any actual platformer games that would use this principle, but a good example of such game is Snake (original grid-based version).
Example includes grid-to-point collision checking, actual specific platformer behaviour (with adjustable values), and value tweening (to make player movement nice & smooth).
Notepad++: Haxe syntax highlighting
Definition file in action, displaying syntax for function of fancy purpose.
In past few days I've spent some time to update an existing user definition file to UDL2, which was introduced in Notepad++ v6.2.
UDL2 improves possibilities of creating user defined languages slightly, introducing configurable delimiters, non-symbol operators, foldable comments, and other things.
For the case of Haxe, UDL2 improves detection of symbols, and made it possible to include hexadecimal number declarations, and separate highlighting for regular expressions. A thing that is currently missing out is preprocessor instructions (#if, #else, #end, ...), however, due to nature of these, highlighting is not always needed anyway.
Update: Someone has set up a repository with a more up-to-date version of the UDL file, so you should take a look at that as well.
Alternatively, UDL .xml' contents:
<NotepadPlus> <UserLang name="Haxe" ext="hx" udlVersion="2.0"> <Settings> <Global caseIgnored="no" allowFoldOfComments="yes" forceLineCommentsAtBOL="no" foldCompact="no" /> <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" /> </Settings> <KeywordLists> <Keywords name="Comments" id="0">00// 01 02 03/* 04*/</Keywords> <Keywords name="Numbers, additional" id="1"></Keywords> <Keywords name="Numbers, prefixes" id="2">0x</Keywords> <Keywords name="Numbers, extras with prefixes" id="3">a b c d e f A B C D E F</Keywords> <Keywords name="Numbers, suffixes" id="4"></Keywords> <Keywords name="Operators1" id="5">' - ! " $ & ( ) , . : ; ? @ [ ] ^ ` | + < = > ~</Keywords> <Keywords name="Operators2" id="6"></Keywords> <Keywords name="Folders in code1, open" id="7">{</Keywords> <Keywords name="Folders in code1, middle" id="8"></Keywords> <Keywords name="Folders in code1, close" id="9">}</Keywords> <Keywords name="Folders in code2, open" id="10"></Keywords> <Keywords name="Folders in code2, middle" id="11"></Keywords> <Keywords name="Folders in code2, close" id="12"></Keywords> <Keywords name="Folders in comment, open" id="13">//{</Keywords> <Keywords name="Folders in comment, middle" id="14"></Keywords> <Keywords name="Folders in comment, close" id="15">//}</Keywords> <Keywords name="Keywords1" id="16">break callback case catch class continue default do else enum extends for function if implements import in interface new package return switch throw try typedef using var while</Keywords> <Keywords name="Keywords2" id="17">null true false</Keywords> <Keywords name="Keywords3" id="18">Void Int Float Dynamic Bool UInt Iterator Array List Hash IntHash Date String Xml</Keywords> <Keywords name="Keywords4" id="19">dynamic extern inline override private public static untyped cast trace super this arguments</Keywords> <Keywords name="Keywords5" id="20"></Keywords> <Keywords name="Keywords6" id="21"></Keywords> <Keywords name="Keywords7" id="22"></Keywords> <Keywords name="Keywords8" id="23"></Keywords> <Keywords name="Delimiters" id="24">00' 01\ 02' 03" 04\ 05" 06~/ 07\ 08/ 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords> </KeywordLists> <Styles> <WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="COMMENTS" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="LINE COMMENTS" styleID="2" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="NUMBERS" styleID="3" fgColor="FA3232" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS1" styleID="4" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS2" styleID="5" fgColor="004080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS3" styleID="6" fgColor="0080AA" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS4" styleID="7" fgColor="0064FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS5" styleID="8" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS6" styleID="9" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS7" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS8" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="OPERATORS" styleID="12" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE1" styleID="13" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE2" styleID="14" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN COMMENT" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS1" styleID="16" fgColor="A31515" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS2" styleID="17" fgColor="A31515" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS3" styleID="18" fgColor="7049B6" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS4" styleID="19" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS5" styleID="20" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS6" styleID="21" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS7" styleID="22" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS8" styleID="23" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> </Styles> </UserLang> </NotepadPlus>