Jump to content

The Whiteboard


Vindicator209
 Share

Recommended Posts

Well, I was just trying to make a control follow the mouse, when I decided to make this:

It's a little script where you can draw some stuff with a bunch of different options and buttons, hah.

it works by creating a new control everywhere makinging it seem like your "drawing"

I can't believe this took me 3 hours to finish....

it's super cpu-consuming but its still fun, theres a replay feature, color inverse, stuff like that... Heh...

#include <GUIConstants.au3>
#include <Misc.au3>
#include <WindowsConstants.au3>

$color = 0x000000
$lastcolor = 0x000000
$rad = 10
$lastrad = 10
$mode = 0
$archi = 0
$lastarchi = 0
$replay_speed = 5 ;delay between each control
Dim $arch[10000]
Dim $acol[10000]
$win = "The Whiteboard - By Vindicator"
$dll = DllOpen("user32.dll")
$Form1 = GUICreate($win, 800, 600, -1, -1, $WS_SIZEBOX)
GUISetBkColor(0xFFFFFFF,$Form1)
$Radbar = GUICtrlCreateLabel(" Pen size: 10", 0, 0, 100, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0xfffffff)
$Radslider = GUICtrlCreateSlider(0, 20, 200, 20)
GUICtrlSetData(-1, 10)
GUICtrlSetLimit(-1, 50, 1)
GUICtrlSetBkColor(-1, 0xfffffff)
$modebar = GUICtrlCreateLabel(" Pen Mode: Square", 100, 0, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0xfffffff)
$blackbutton = GUICtrlCreateLabel("", 300, 0, 20, 20)
GUICtrlSetBkColor(-1, 0x000000)
$redbutton = GUICtrlCreateLabel("", 320, 0, 20, 20)
GUICtrlSetBkColor(-1, 0xFF0000)
$greenbutton = GUICtrlCreateLabel("", 340, 0, 20, 20)
GUICtrlSetBkColor(-1, 0x00FF00)
$bluebutton = GUICtrlCreateLabel("", 360, 0, 20, 20)
GUICtrlSetBkColor(-1, 0x0000FF)
$choosebutton = GUICtrlCreateLabel(" Choose", 380, 0, 100, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0x0000FF)
$clearbutton = GUICtrlCreateLabel(" Clear", 480, 0, 120, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0xfffffff)
$progress = GUICtrlCreateLabel(" Controls used: 0/10000", 200, 20, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0xfffffff)
$progressbar = GUICtrlCreateProgress(400, 20, 200, 20)
GUICtrlSetLimit(-1, 100, 0)
GUICtrlSetBkColor(-1, 0xfffffff)
$replaybutton = GUICtrlCreateLabel(" Replay", 600, 0, 100, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0xfffffff)
$canvas = GUICtrlCreateLabel(" Resize canvas", 700, 0, 100, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0xfffffff)
$invert = GUICtrlCreateLabel(" Invert Colors", 600, 20, 200, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
GUICtrlSetBkColor(-1, 0xfffffff)
$cursor = GUICtrlCreateLabel("",0,0,10,10)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
While 1
    $Mpos = MouseGetPos()
    $Wpos = WinGetPos($Form1)
    If $Mpos[1] > $Wpos[1] + 70 Then
    $XCpos = $Mpos[0] - $Wpos[0] - 10 - ($rad / 2)
    $YCpos = $Mpos[1] - $Wpos[1] - 30 - ($rad / 2)
    GUICtrlSetBkColor($cursor, $color)
    If $mode = 0 Then
        ControlMove($win,"",$cursor,$XCpos,$YCpos,$rad,$rad)
    ElseIf $mode = 1 Then
        ControlMove($win,"",$cursor,$XCpos,$YCpos,$rad * 2,$rad)
    ElseIf $mode = 2 Then
        ControlMove($win,"",$cursor,$XCpos,$YCpos,$rad,$rad * 2)
    EndIf
    Else
    GUICtrlSetBkColor($cursor, 0xfffffff)
    EndIf
    $rad = GUICtrlRead($Radslider)
    If $rad <> $lastrad Then
        $lastrad = $rad
        GUICtrlSetData($Radbar, " Pen Size: " & $rad)
    EndIf
    If $archi <> $lastarchi Then
        $lastarchi = $archi
        GUICtrlSetData($progress, " Controls used: " & $archi & "/10000")
        GUICtrlSetData($progressbar, $archi / 100)
    EndIf
    If $color <> $lastcolor Then
        $lastcolor = $color
        GUICtrlSetBkColor($choosebutton, $color)
        GUICtrlSetBkColor($cursor, $color)
    EndIf
    If _IsPressed(01, $dll) Then
        $Mpos = MouseGetPos()
        $Wpos = WinGetPos($Form1)
        If $Mpos[1] > $Wpos[1] + 50 Then
            Do
                If $Mpos[1] > $Wpos[1] + 70 Then
                    $Mpos = MouseGetPos()
                    $Wpos = WinGetPos($Form1)
                    $XCpos = $Mpos[0] - $Wpos[0] - 10 - ($rad / 2)
                    $YCpos = $Mpos[1] - $Wpos[1] - 30 - ($rad / 2)
                    If $archi < 9999 Then
                    If $mode = 0 Then
                        $archi += 1
                        $arch[$archi] = GUICtrlCreateLabel("", $XCpos, $YCpos, $rad, $rad)
                    ElseIf $mode = 1 Then
                        $archi += 1
                        $arch[$archi] = GUICtrlCreateLabel("", $XCpos, $YCpos, $rad * 2, $rad)
                    ElseIf $mode = 2 Then
                        $archi += 1
                        $arch[$archi] = GUICtrlCreateLabel("", $XCpos, $YCpos, $rad, $rad * 2)
                    EndIf
                    $acol[$archi] = $color
                    GUICtrlSetBkColor(-1, $color)
                    GUICtrlSetData($progress, " Controls used: " & $archi & "/10000")
                    GUICtrlSetData($progressbar, $archi / 100)
                Else
                    MsgBox(16,"Error:","Maximum slots used (10000)")
                EndIf
                EndIf
            Until Not (_IsPressed(01, $dll))
        EndIf
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $canvas
            SplashTextOn("Pen - Replay", "Resizing Press END to finish..." & @CRLF & "Use the arrow keys to change the window dimensions...", "400", "40", "-1", "-1", 2, "Comic Sans MS", "10", "400")
            Do
                $Wpos = WinGetPos($win)
                If _IsPressed(25, $dll) Then WinMove($win, "", $Wpos[0], $Wpos[1], $Wpos[2] - 5, $Wpos[3]);left
                If _IsPressed(26, $dll) Then WinMove($win, "", $Wpos[0], $Wpos[1], $Wpos[2], $Wpos[3] + 5);up
                If _IsPressed(27, $dll) Then WinMove($win, "", $Wpos[0], $Wpos[1], $Wpos[2] + 5, $Wpos[3]);right
                If _IsPressed(28, $dll) Then WinMove($win, "", $Wpos[0], $Wpos[1], $Wpos[2], $Wpos[3] - 5);down
            Until _IsPressed(23, $dll)
            SplashOff()
        Case $blackbutton
            $color = 0x000000
        Case $redbutton
            $color = 0xFF0000
        Case $greenbutton
            $color = 0x00FF00
        Case $bluebutton
            $color = 0x0000FF
        Case $choosebutton
            $color = _ChooseColor(2, $color, 2)
        Case $clearbutton
            For $i = 1 To $archi
                GUICtrlDelete($arch[$i])
                GUICtrlSetData($progressbar, ($archi / 100) - ($i / 100))
            Next
            $archi = 0
        Case $replaybutton
            SplashTextOn("The Whiteboard - Replay", "Clearing..." & @CRLF & "Please Wait...", "200", "40", "-1", "-1", 2, "Comic Sans MS", "10", "400")
            For $i = 1 To $archi
                GUICtrlSetState($arch[$i], $GUI_HIDE)
                GUICtrlSetData($progressbar, ($archi / 100) - ($i / 100))
            Next
            SplashTextOn("The Whiteboard - Replay", "Sleeping..." & @CRLF & "Please Wait...", "200", "40", "-1", "-1", 2, "Comic Sans MS", "10", "400")
            Sleep(500)
            SplashOff()
            Sleep(1000)
            For $i = 1 To $archi
                Sleep($replay_speed)
                GUICtrlSetState($arch[$i], $GUI_SHOW)
                GUICtrlSetData($progressbar, ($archi / 100) - ($i / 100))
            Next
        Case $modebar
            If $mode = 0 Then
                $mode = 1
                GUICtrlSetData($modebar, "Pen Mode: Wide Tip")
            ElseIf $mode = 1 Then
                $mode = 2
                GUICtrlSetData($modebar, "Pen Mode: Tall Tip")
            ElseIf $mode = 2 Then
                $mode = 0
                GUICtrlSetData($modebar, "Pen Mode: Square")
            EndIf
        Case $invert
            For $i = 1 To $archi
                GUICtrlSetBkColor($arch[$i], 0xFFFFFF - $acol[$i])
                $acol[$i] = 0xFFFFFF - $acol[$i]
                GUICtrlSetState($arch[$i], $GUI_SHOW)
            Next
        Case $GUI_EVENT_CLOSE
            DllClose($dll)
            Exit
    EndSwitch
WEnd

Posted Image

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

clicking? like, from your speakers? ...uhh.... I'm pretty sure I didn't install sounds on there...

EDIT: oh, yea, that's from the error messages that pop up... uhh try not to hold the mouse down while you hit 10000.. heh

Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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...