Jump to content

Desktop Goldfish


Recommended Posts

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.

WBD

UPDATE: 29-May-2009

You 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-2009

I'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 by WideBoyDixon
Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

Looks great WBD :)

But why only one fish? Next step an aquarium? :party:

Nice WinAPI stuff!

UEZ

Edited 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

Looks great WBD :)

Praise indeed from a GDI+ master :party:

But why only one fish? Next step an aquarium? :idea:

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Posted Image

WBD

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!!! :party:

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

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

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 by WideBoyDixon
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

The 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". :D
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

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

Yeah I guessed as much :D

Thanks for the info.

Looks great indeed :D

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...