WideBoyDixon Posted May 28, 2009 Share Posted May 28, 2009 (edited) I'm starting to get the hang of this GDI+ I think although I'm still learning. Here's another application that I've ported from a C# example. It's a goldfish that swims across your desktop from left to right and then from right to left. If you click on the fish then it swims a bit faster to get away. Something for a bit of fun only really.Source code and required resources can be downloaded HERE.There's some issues with trying to pick up and move the fish which I haven't yet investigated further. There's also an issue with the tray menu which doesn't seem to work at all. However, you can get rid of the fish by right-clicking it with the mouse.If anyone can fix up the script or suggest better ways of doing this then I'm interested to hear them.Have fun.WBDUPDATE: 29-May-2009You can now add in extra fish from the tray menu. The initial number of fish can be changed at the top of the script. I still haven't solved the issue with moving the window with the mouse.UPDATE: 1-June-2009I've added a couple of new fish. Not as nice as the original but I'm no artist. There's also an INI file where you can configure the application. I still (still!) haven't solved the issue with moving the window with the mouse. Also fixed a HUGE memory leak. Edited June 1, 2009 by WideBoyDixon [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
ProgAndy Posted May 28, 2009 Share Posted May 28, 2009 You should use these flags when moving the window then the context menu will work BitOr($SWP_NOZORDER, $SWP_NOSIZE, $SWP_NOREDRAW, $SWP_NOACTIVATE) and add this ro your window class, then double click works. $CS_DBLCLKS = 8 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 28, 2009 Author Share Posted May 28, 2009 Of course! I've updated the window moving and also the class creation as you suggested. I've re-uploaded the modified script to the original location. Dragging the fish with the mouse still doesn't work very well but I might leave this for now. Thanks for the pointers ProgAndy WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
UEZ Posted May 28, 2009 Share Posted May 28, 2009 (edited) Looks great WBD But why only one fish? Next step an aquarium? Nice WinAPI stuff! UEZ Edited May 28, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
billthecreator Posted May 28, 2009 Share Posted May 28, 2009 thats really cool. i was trying to figure out how to do moving pngs for a while. thanks [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
James Posted May 28, 2009 Share Posted May 28, 2009 Fishy cool! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
myspacee Posted May 29, 2009 Share Posted May 29, 2009 very cool, next step not aquarium but a game! cacth the fish ! is possible to add second object on screen ? speak abot have your fish swim around desktop, and onother object moved by cursor ? thank you, m. Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 29, 2009 Author Share Posted May 29, 2009 Looks great WBD Praise indeed from a GDI+ master But why only one fish? Next step an aquarium? See the original post. You can add in as many fish as you like. I've had 25 on screen at the same time.WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
storme Posted May 29, 2009 Share Posted May 29, 2009 G'day WideBoyDixon Gota ask. Does the "I'm gonna eat you little fishy" mean anything? When I saw it I remembered an epesode from "Red Dwarf" when Cat tries to eat a robot fish and uses exactly that phrase. :-) Great program :-) John Morrison Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 29, 2009 Author Share Posted May 29, 2009 When I saw it I remembered an epesode from "Red Dwarf" when Cat tries to eat a robot fish and uses exactly that phrase. :-)You got the exact reference . Smoke me a kipper, I'll be back for breakfast.WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
WideBoyDixon Posted June 1, 2009 Author Share Posted June 1, 2009 Updated with a couple of extra fish. The application is now controlled by an INI file. I also fixed a HUGE memory leak which was caused by some incorrect documentation in the help file. _GDIPlus_BitmapCreateFromGraphics needs to be paired with _GDIPlus_ImageDispose and not _WinAPI_DeleteObject. WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
UEZ Posted June 1, 2009 Share Posted June 1, 2009 My desktop is turning now into an aquarium. When I double click on a fish then the program is closing. Is it your intension? UEZ PS: btw, I'm not a GDI+ master!!! Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
ProgAndy Posted June 1, 2009 Share Posted June 1, 2009 It is Really great There's some issues with trying to pick up and move the fish which I haven't yet investigated further.just call _WinAPI_SetWindowPos(...) after the assignment $gaFish[$nIndex][11] = $newPos[1] . *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
WideBoyDixon Posted June 2, 2009 Author Share Posted June 2, 2009 (edited) When I double click on a fish then the program is closing. Is it your intension?Actually, it was my intention (I copied that from the original program). However, it can be a little overzealous so it's probably worth changing the code from this: Case $WM_RBUTTONDOWN, $WM_LBUTTONDBLCLK _ShutDown(); Done to this: Case $WM_RBUTTONDOWN _ShutDown(); Done You could even remove those two lines entirely if you want to only exit from the system tray. just call _WinAPI_SetWindowPos(...) after the assignment $gaFish[$nIndex][11] = $newPos[1] .Of course! Sometimes that answer is just a little *too* obvious. Thanks ProgAndy. I may add some more fish yet or even adapt to other things. There's a great site for animated GIFs which I can convert in to suitable PNGs : http://www.sevenoaksart.co.uk/ WBD Edited June 2, 2009 by WideBoyDixon [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
Triblade Posted June 2, 2009 Share Posted June 2, 2009 Looks very cool I'm using Windows 7 RC1 But it's really eating up my proc. Im using one core completely. Also, somehow the traymenu doesn't work. But that may be due to my Win 7... My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
WideBoyDixon Posted June 2, 2009 Author Share Posted June 2, 2009 Lots of fish = lots of proc unfortunately. Each individual fish has its own timer rather than moving them all on the same timer. I guess I could change that. The traymenu *will* work ... you just need to keep clicking on it until you manage to hit an idle loop. I'll take a look at possibly getting all the fish to run on the same global timer. WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
martin Posted June 2, 2009 Share Posted June 2, 2009 Lots of fish = lots of proc unfortunately. Each individual fish has its own timer rather than moving them all on the same timer. I guess I could change that.The traymenu *will* work ... you just need to keep clicking on it until you manage to hit an idle loop.I'll take a look at possibly getting all the fish to run on the same global timer.WBDThe fish look great WBD. But there is a little bug because on my PC the fish get chopped up sometimes when they reverse direction, a sort of "fish and chops". Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Triblade Posted June 3, 2009 Share Posted June 3, 2009 Lots of fish = lots of proc unfortunately. Each individual fish has its own timer rather than moving them all on the same timer. I guess I could change that.The traymenu *will* work ... you just need to keep clicking on it until you manage to hit an idle loop.I'll take a look at possibly getting all the fish to run on the same global timer.WBDYeah I guessed as much Thanks for the info.Looks great indeed My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now