You might remember SMG Studio from such games as OTTTD, and as such be pleased to learn that a couple of videos just popped up from PAX Australia showing off some upcoming madness of theirs.
Read More →
More SMG madness
The power of Sheng: Super Mario Bros
This has been sitting in my “to post” bucket for a couple of months now, so better late than never I guess. Just watch this video of young musician Li-chin LI from the Taiwan Philharmonic playing the Super Mario Bros theme on a towering obsidian cathedral Chinese mouth organ.
The letter ‘V’ 0.06 times
Remember about a year ago I mentioned a speedrun of VVVVVV, where someone beat the game in under 14 minutes? And compared that to the tool-assisted run of under 13 minutes? And then I said something almost prescient…
Barring a disruptive new glitch or strategy, that run is an indication of the theoretical fastest possible time that can be achieved, by a computer or a human.
Well…
Read More →
And the 2014 award for “Most Generic Fantasy Trailer” goes to…
Elder Scrolls Online!
It was kind of inevitable really. By all accounts the game is a mediocre MMO and an awful Elder Scrolls game, and the marketing has been less than effective. That the cinematic trailer would fail to inspire is unsurprising, but the level of mediocrity exceeds expectations.
Read More →
Mouse events on DirectX.AudioVideoPlayback Controls
This is the issue that finally pushed me over the edge to setting up this blog. Normally when you have a coding problem, you find the answer fairly quickly and move on. Sometimes though, the solution remains elusive. Then you put the answer on a page of your own, to help out the next weary traveler.
Which bring me neatly to…
AudioVideoPlayback
I recently posted my lightweight media viewer, Picsie. As well as images, it also handles some formats of videos. The video playback was largely on a whim when I stumbled across the wonders of Microsoft.DirectX.AudioVideoPlayback. The code to set it up and use it is endearingly simple:
Microsoft.DirectX.AudioVideoPlayback.Video videoPlayer = new Microsoft.DirectX.AudioVideoPlayback.Video(filename); videoPlayer.Owner = videoPanel; videoPlayer.Play();
Give it a video file and a control to draw on, and tell it to start. Some form of error handling is probably wise too.
All well and good so far. A few buttons to control playback, and you’ve got a basic but functional video player. My problem came when I wanted the video to have the same control system as the rest of Picsie – left-double-click to centre, right-click to exit, drag to move. These all worked for images, but when I came to test it on videos, only the drag code seemed to work.
It was pretty simple to diagnose. MouseDown, MouseMove and MousePress all continued to function as before. For reasons unknown, the Video object ate any Click, MouseClick, DoubleClick and MouseDoubleClick events.
At this point the Internet failed me. No solutions, and I had two features no longer working:
- Right-click to exit
- Double-click to centre
Not able to find a way to get my events back, it was fairly trivial, if a little messy, to move the right-click code to the MouseUp event, with a little jiggery pokery to make sure it was a click and not a drag. On the other hand, did I really want to write all the code to check for and handle double clicks myself? No, no I didn’t. Thankfully, I didn’t have to. MouseEventArgs has a “Clicks” property (when did that appear, and why did nobody tell me?), which you can use to fake a double-click event:
private void Panel_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && e.Clicks == 2) { //Double-click } }
And there you go. I never did find out why the Video object ate my events. There’s probably a really simple solution somewhere, or I did something boneheaded, but more than one person faced this problem and never found an answer, so here’s mine. Fake clicks and double-clicks.
tldr/
Problem: AudioVideoPlayback.Video eats MouseClick and MouseDoubleClick events.
Solution: Check for double-clicks using the MouseEventArgs “Clicks” property in the MouseDown/MouseUp events which aren’t eaten.