Build Your Own Arcade Controls Forum
Main => Software Forum => Topic started by: Spartan on September 22, 2006, 05:25:07 pm
-
...specifically for dual control panels on cocktail tables?
-
Nope, not yet.
-
damn -- any plans for it?
-
"Not yet" doesn't give you any clue?
-
Well, just for the "fun of it" I decided to dust out the old VB6 and try and write something that would rotate a form 90 degrees. From memory Johnny5 uses form controls like labels to draw the CP. To rotate a GDI+ created CP would be very easy using one line of code. To rotate the contents of a form with user controls it's a little more tricky. I'll paste my code here for demonstration purposes. It uses the very slow GetPixel() and SetPixel() methods as I think the Direct Memory Access routines written by BillSoo require a picture loaded using LoadPicture() but I could be wrong. Anyway, it may give you a starting point if you havn't tried it already.
The form must have AutoRedraw set to false and ScaleMode set to 3 - Pixel...
Private Declare Function BitBlt Lib "gdi32" (ByVal hDCDest As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hDCSrc As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal dwRop As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, ByRef lpObject As Any) As Long
Dim hDCSour As Long, hBMPSour As Long
Dim hDCDest As Long, hBMPDest As Long
Private Sub Form_Load()
' Show form and refresh form
Me.Show
Me.Refresh
' Create DC's for reading & writing the pixels
hDCSour = CreateCompatibleDC(Me.hDC)
hBMPSour = CreateCompatibleBitmap(Me.hDC, Me.ScaleWidth, Me.ScaleHeight)
hDCDest = CreateCompatibleDC(Me.hDC)
hBMPDest = CreateCompatibleBitmap(Me.hDC, Me.ScaleWidth, Me.ScaleHeight)
SelectObject hDCSour, hBMPSour
SelectObject hDCDest, hBMPDest
' BitBlt the form's pixels to the source DC
BitBlt hDCSour, 0, 0, Me.ScaleWidth, Me.ScaleHeight, Me.hDC, 0, 0, vbSrcCopy
' Rotate the pixels using slow GetPixel() and SetPixel()
For Y = 0 To Me.ScaleHeight - 1
For X = 0 To Me.ScaleWidth - 1
Dim Col As Long
Col = GetPixel(hDCSour, X, Y)
SetPixel hDCDest, Me.ScaleHeight - Y - 1, X, Col
Next
Next
' Remove form controls so they stop being painted
Dim Control As Control
For Each Control In Me
Control.Visible = False
Next Control
' Refresh form to call Form_Paint()
Me.Refresh
End Sub
Private Sub Form_Paint()
' BitBlt the rotated form to the forms hDC
BitBlt Me.hDC, 0, 0, Me.ScaleWidth, Me.ScaleHeight, hDCDest, 0, 0, vbSrcCopy
End Sub
Private Sub Form_Unload(Cancel As Integer)
DeleteObject hBMPSour
DeleteDC hDCSour
DeleteObject hBMPDest
DeleteDC hDCDest
End Sub
-
I was just going to use the new freeimage dll I recently added to take a snapshot of the regular layout, then rotate it with the included function twice (once for each player) and display them both in picture boxes on top of the actual layout.
It means no animations, but seeing as how there isn't an easy way to rotate things speedily in gdi, it's a nice solution.
-
...specifically for dual control panels on cocktail tables?
Holy Crap! Cocktails typically have simple control panels hence no need for a tool like J5.
What sort of Panel have you got that needs such a thing?
-
...specifically for dual control panels on cocktail tables?
Holy Crap! Cocktails typically have simple control panels hence no need for a tool like J5.
What sort of Panel have you got that needs such a thing?
Well that was kind of why it's so low on my list and I haven't bothered to implement it yet, I just wasn't going to say anything.
-
"Not yet" doesn't give you any clue?
Apparently not.
Holy Crap! Cocktails typically have simple control panels hence no need for a tool like J5.
What sort of Panel have you got that needs such a thing?
(http://www.municade.com/municade/images/Municade%20Player%202%20Panel.jpg)
It's a simple panel with 2 buttons on the left (think left/right for space invaders, an 8 way stick, and 3 buttons on the right) I was more interested in checking out its capabilties. I had already modified (long ago) my MaLa theme to display the proper controls and to show which buttons do what, so I have the functionality already.