Imports System.Drawing
Imports System.Windows.Forms
Imports Wakaba

Module Module1

    Private Const STAR_SPEED As Integer = 8
    Private Const STAR_ZOOM As Single = 0.5
    Private Const STAR_ROLL As Integer = 4
    Private Const STAR_TRANSPARENT As Integer = 4

    Private w As Wakaba.Helper

    Sub Main()

        Try
            Dim intX As Integer = 288
            Dim intY As Integer = 208
            Dim sngZoom As Single = 1.0
            Dim intRoll As Integer
            Dim bytTransparent As Byte = 255

            w = New Wakaba.Helper

            w.Initialize()

            w.SpriteCreate("wi", My.Resources.wall, Helper.TransparentColor.None)
            w.SpritePosition("wi", 3, 0, 0)
            w.SpriteShow("wi")

            w.SpriteCreate("", My.Resources.star, Helper.TransparentColor.Blue)
            w.SpriteShow("")

            Do

                Select Case w.JoyPadDirection(0)
                    Case Helper.Direction.Down
                        intY += STAR_SPEED
                    Case Helper.Direction.Left
                        intX -= STAR_SPEED
                    Case Helper.Direction.LeftDown
                        intX -= STAR_SPEED
                        intY += STAR_SPEED
                    Case Helper.Direction.LeftUp
                        intX -= STAR_SPEED
                        intY -= STAR_SPEED
                    Case Helper.Direction.Right
                        intX += STAR_SPEED
                    Case Helper.Direction.RightDown
                        intX += STAR_SPEED
                        intY += STAR_SPEED
                    Case Helper.Direction.RightUp
                        intX += STAR_SPEED
                        intY -= STAR_SPEED
                    Case Helper.Direction.Up
                        intY -= STAR_SPEED
                End Select

                w.SpritePosition("", 2, intX, intY)

                Dim bytButtons() As Byte = w.JoyPushButton(0)

                If bytButtons(0) Then
                    sngZoom += STAR_ZOOM
                End If

                If bytButtons(1) Then
                    sngZoom -= STAR_ZOOM
                End If

                w.SpriteScale("", sngZoom)

                If bytButtons(2) Then
                    intRoll += STAR_ROLL
                End If

                If bytButtons(3) Then
                    intRoll -= STAR_ROLL
                End If

                w.SpriteRotation("", intRoll)

                If bytButtons(4) Then
                    If CInt(bytTransparent - STAR_TRANSPARENT) < 0 Then
                        bytTransparent = 0
                    Else
                        bytTransparent -= STAR_TRANSPARENT
                    End If
                End If

                If bytButtons(5) Then
                    If CInt(bytTransparent + STAR_TRANSPARENT) > Byte.MaxValue Then
                        bytTransparent = Byte.MaxValue
                    Else
                        bytTransparent += STAR_TRANSPARENT
                    End If
                End If

                w.SpriteTransparent("", bytTransparent)

                w.ScreenRefresh(True)

            Loop While Not w.WindowClosing

        Catch ex As Exception
            MessageBox.Show(ex.Message & ex.StackTrace)
        End Try

        w.Dispose()

    End Sub

End Module