Jump to content

Pseudo-3D MENU BETA


Uriziel01
 Share

Recommended Posts

Hi! I'm making an UDF with "3D" menu for apps. Curent build is no UDF, but only show of my script abilities, in my TODO list I have:

-Animations

-More options to user (font type, color etc.)

-Make it UDF

My question is:

-What do you think about the script?

-Can it be usefull ?

-What I should add to it ?

p.s-sory for my bad english :)

p.s2-use LEFT and RIGHT arrows for manipulate and ENTER for check current status,$opt can be 0 or 2 it is way that menu circle is spining.

p.s3 you need MidiUDF for run it : MIDI UDF LINK

Posted Image

#include <GUIConstants.au3>
#include <Misc.au3>
#include <Midiudf.au3>
$open = _midiOutOpen ()
$dll = DllOpen("user32.dll")
;;;;;;;;START SETTINGS;;;;;;;
;;;;;;
$start_size=9
$opt=0
$x=20
$y=125
$volume=30000
;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_MidiOutSetVolume ($volume, 0)
global $lab[10],$i=$y+35,$i2=1,$position[10]
$gui=GUICreate("3D menu BETA v0.2",420,290,-1,-1,$WS_POPUPWINDOW)
GUISetState (@SW_SHOW) 
GUISetBkColor("0x555555",$gui)
$lab[0]=GUICtrlCreateLabel ("Options",  $x, $y+25,300,300)
$position[0]=2
GUICtrlSetColor($lab[0],"0x"&$position[0]&$position[0]&$position[0]&$position[0]&$position[0]&$position[0])
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lab[0],$start_size+3)
$lab[1]=GUICtrlCreateLabel ("New Game",  $x+130, $y+45,300,300)
$selected=1
$position[1]=0
GUICtrlSetColor($lab[1],"0x"&$position[1]&$position[1]&$position[1]&$position[1]&$position[1]&$position[1])
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lab[1],$start_size+6)
$lab[2]=GUICtrlCreateLabel ("Load Game",  $x+300, $y+25,300,300)
$position[2]=2
GUICtrlSetColor($lab[2],"0x"&$position[2]&$position[2]&$position[2]&$position[2]&$position[2]&$position[2])
GUICtrlSetFont($lab[2],$start_size+3)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[3]=GUICtrlCreateLabel ("Highscores",  $x+250, $y+10,300,300) 
$position[3]=3
GUICtrlSetColor($lab[3],"0x"&$position[3]&$position[3]&$position[3]&$position[3]&$position[3]&$position[3])
GUICtrlSetFont($lab[3],$start_size)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[4]=GUICtrlCreateLabel ("Help - FAQ",  $x+50, $y+10,300,300) 
$position[4]=3
GUICtrlSetColor($lab[4],"0x"&$position[4]&$position[4]&$position[4]&$position[4]&$position[4]&$position[4])
GUICtrlSetFont($lab[4],$start_size)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[5]=GUICtrlCreateLabel ("Quit Game",  $x+150, $y,300,300) 
$position[5]=4
GUICtrlSetColor($lab[5],"0x"&$position[5]&$position[5]&$position[5]&$position[5]&$position[5]&$position[5])
GUICtrlSetFont($lab[5],$start_size)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[6]=GUICtrlCreateLabel (">>                <<",  $x+90, $y+45,300,300)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lab[6],$start_size+10)
;$select_lab=GUICtrlCreateLabel ("Selected: "&GUICtrlRead($lab[$selected]), 280, 270,300,300)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
#cs
    $b=GuiCtrlCreateGraphic(0, 0, 420,290)
for $a=1 to 255 step 1
    $color=$a&$a&$a&$a&$a&$a
GUICtrlSetGraphic($b,$GUI_GR_MOVE, 0,$a)
GUICtrlSetGraphic($b,$GUI_GR_COLOR, "0x"&$color)
GUICtrlSetGraphic($b,$GUI_GR_LINE, 420,$a)
    Next
#ce
While 1
   $msg = GUIGetMsg()
    sleep(50)
    if $i = $y+55 Then $i2=1
    if $i=$y+35 then $i2=0
    if $i2=0 then $i+=1
if $i2=1 then $i-=1
    GUICtrlSetPos($lab[6],$x+90,$i)
      If _IsPressed(25+$opt, $dll) Then  _right()
       If _IsPressed(27-$opt, $dll) Then _left()
          If _IsPressed("0D", $dll) Then _check()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
func _left()
   _MidiOutShortMsg ($open, 0x99 + (29 * 256) + (127 * 0x10000))
    $selected-=1
    if $selected<0  then $selected=5
    ;GUICtrlSetData($select_lab,"Selected: "&GUICtrlRead($lab[$selected]))
    $1=GUICtrlRead($lab[1])
    GUICtrlSetData($lab[1],GUICtrlRead($lab[2]))
    GUICtrlSetData($lab[2],GUICtrlRead($lab[3]))
    GUICtrlSetData($lab[3],GUICtrlRead($lab[5]))
    GUICtrlSetData($lab[5],GUICtrlRead($lab[4]))
    GUICtrlSetData($lab[4],GUICtrlRead($lab[0]))
    GUICtrlSetData($lab[0],$1)
EndFunc
Func _right()
   _MidiOutShortMsg ($open, 0x99 + (29   * 256) + (127 * 0x10000))
   $selected+=1
    if $selected>5 then $selected=0
    ;GUICtrlSetData($select_lab,"Selected: "&GUICtrlRead($lab[$selected]))
    $1=GUICtrlRead($lab[1])
    GUICtrlSetData($lab[1],GUICtrlRead($lab[0]))
    GUICtrlSetData($lab[0],GUICtrlRead($lab[4]))
    GUICtrlSetData($lab[4],GUICtrlRead($lab[5]))
    GUICtrlSetData($lab[5],GUICtrlRead($lab[3]))
    GUICtrlSetData($lab[3],GUICtrlRead($lab[2]))
    GUICtrlSetData($lab[2],$1)
EndFunc
Func _check()
    MsgBox(0,"FUNCTION SELECTED","You have selected option:  " &GUICtrlRead($lab[1]))
    EndFunc
Link to comment
Share on other sites

Nice script, I made some changes. However, I can recommend everyone to use DirectX for this using A2D, since you are going to make a game anyway.

Changes:

Removed MIDI because noone wants to download an UDF for 2 sounds.

Fixed the menu going reeaaally fast if you hold the keys down.

Code:

#include <GUIConstants.au3>
#include <Misc.au3>
$dll = DllOpen("user32.dll")
;;;;;;;;START SETTINGS;;;;;;;
;;;;;;
$start_size = 9
$opt = 0
$x = 20
$y = 125
$volume = 30000
;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Global $lab[10], $i = $y + 35, $i2 = 1, $position[10]
$gui = GUICreate("3D menu BETA v0.2", 420, 290, -1, -1, $WS_POPUPWINDOW)
GUISetState(@SW_SHOW)
GUISetBkColor("0x555555", $gui)
$lab[0] = GUICtrlCreateLabel("Options", $x, $y + 25, 300, 300)
$position[0] = 2
GUICtrlSetColor($lab[0], "0x" & $position[0] & $position[0] & $position[0] & $position[0] & $position[0] & $position[0])
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lab[0], $start_size + 3)
$lab[1] = GUICtrlCreateLabel("New Game", $x + 130, $y + 45, 300, 300)
$selected = 1
$position[1] = 0
GUICtrlSetColor($lab[1], "0x" & $position[1] & $position[1] & $position[1] & $position[1] & $position[1] & $position[1])
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lab[1], $start_size + 6)
$lab[2] = GUICtrlCreateLabel("Load Game", $x + 300, $y + 25, 300, 300)
$position[2] = 2
GUICtrlSetColor($lab[2], "0x" & $position[2] & $position[2] & $position[2] & $position[2] & $position[2] & $position[2])
GUICtrlSetFont($lab[2], $start_size + 3)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[3] = GUICtrlCreateLabel("Highscores", $x + 250, $y + 10, 300, 300)
$position[3] = 3
GUICtrlSetColor($lab[3], "0x" & $position[3] & $position[3] & $position[3] & $position[3] & $position[3] & $position[3])
GUICtrlSetFont($lab[3], $start_size)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[4] = GUICtrlCreateLabel("Help - FAQ", $x + 50, $y + 10, 300, 300)
$position[4] = 3
GUICtrlSetColor($lab[4], "0x" & $position[4] & $position[4] & $position[4] & $position[4] & $position[4] & $position[4])
GUICtrlSetFont($lab[4], $start_size)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[5] = GUICtrlCreateLabel("Quit Game", $x + 150, $y, 300, 300)
$position[5] = 4
GUICtrlSetColor($lab[5], "0x" & $position[5] & $position[5] & $position[5] & $position[5] & $position[5] & $position[5])
GUICtrlSetFont($lab[5], $start_size)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$lab[6] = GUICtrlCreateLabel(">>                <<", $x + 90, $y + 45, 300, 300)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($lab[6], $start_size + 10)
;$select_lab=GUICtrlCreateLabel ("Selected: "&GUICtrlRead($lab[$selected]), 280, 270,300,300)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
#cs
    $b=GuiCtrlCreateGraphic(0, 0, 420,290)
    for $a=1 to 255 step 1
    $color=$a&$a&$a&$a&$a&$a
    GUICtrlSetGraphic($b,$GUI_GR_MOVE, 0,$a)
    GUICtrlSetGraphic($b,$GUI_GR_COLOR, "0x"&$color)
    GUICtrlSetGraphic($b,$GUI_GR_LINE, 420,$a)
    Next
#ce
While 1
    $msg = GUIGetMsg()
    Sleep(50)
    If $i = $y + 55 Then $i2 = 1
    If $i = $y + 35 Then $i2 = 0
    If $i2 = 0 Then $i += 1
    If $i2 = 1 Then $i -= 1
    GUICtrlSetPos($lab[6], $x + 90, $i)
    If _IsPressed(25 + $opt, $dll) Then
        _right()
        While _IsPressed(25 + $opt, $dll)
            Sleep(100)
        WEnd
    EndIf
    If _IsPressed(27 - $opt, $dll) Then
        _left()
        While _IsPressed(27 - $opt, $dll)
            Sleep(100)
        WEnd
    EndIf
    If _IsPressed("0D", $dll) Then
        _check()
        While _IsPressed("0D", $dll)
            Sleep(100)
        WEnd
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func _left()
    $selected -= 1
    If $selected < 0 Then $selected = 5
    ;GUICtrlSetData($select_lab,"Selected: "&GUICtrlRead($lab[$selected]))
    $1 = GUICtrlRead($lab[1])
    GUICtrlSetData($lab[1], GUICtrlRead($lab[2]))
    GUICtrlSetData($lab[2], GUICtrlRead($lab[3]))
    GUICtrlSetData($lab[3], GUICtrlRead($lab[5]))
    GUICtrlSetData($lab[5], GUICtrlRead($lab[4]))
    GUICtrlSetData($lab[4], GUICtrlRead($lab[0]))
    GUICtrlSetData($lab[0], $1)
EndFunc   ;==>_left
Func _right()
    $selected += 1
    If $selected > 5 Then $selected = 0
    ;GUICtrlSetData($select_lab,"Selected: "&GUICtrlRead($lab[$selected]))
    $1 = GUICtrlRead($lab[1])
    GUICtrlSetData($lab[1], GUICtrlRead($lab[0]))
    GUICtrlSetData($lab[0], GUICtrlRead($lab[4]))
    GUICtrlSetData($lab[4], GUICtrlRead($lab[5]))
    GUICtrlSetData($lab[5], GUICtrlRead($lab[3]))
    GUICtrlSetData($lab[3], GUICtrlRead($lab[2]))
    GUICtrlSetData($lab[2], $1)
EndFunc   ;==>_right
Func _check()
    MsgBox(0, "FUNCTION SELECTED", "You have selected option:  " & GUICtrlRead($lab[1]))
EndFunc   ;==>_check
Link to comment
Share on other sites

Making a game ? No :) But you are right with the MIDI UDF :) Thx for reply and comment :)

p.s-I have tried to do this on GDIPlus but it is dissapearing when something cover you rendered space, and it is making GDIPlus Useless.

Edited by Uriziel01
Link to comment
Share on other sites

Making a game ? No :) But you are right with the MIDI UDF :( Thx for reply and comment :)

p.s-I have tried to do this on GDIPlus but it is dissapearing when something cover you rendered space, and it is making GDIPlus Useless.

You could make it in GDI, just register the $WM_PAINT message so you can repaint the area when it has been destroyed. :)

Edit: Nice work btw! :P

Edited by monoceres

Broken link? PM me and I'll send you the file!

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