#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("Tiro parabólico - Juan A. Villalpando", 546, 431, 380, 196)
$Group1 = GUICtrlCreateGroup("Establece el ángulo y la velocidad ", 48, 16, 449, 273)
$Slider1 = GUICtrlCreateSlider(72, 120, 377, 41, BitOR($TBS_TOOLTIPS, $TBS_BOTH, $TBS_ENABLESELRANGE))
GUICtrlSetLimit(-1, 90, 0)
$Slider2 = GUICtrlCreateSlider(80, 232, 369, 49, BitOR($TBS_TOOLTIPS, $TBS_BOTH, $TBS_ENABLESELRANGE))
GUICtrlSetLimit(-1, 100, 0)
$Label1 = GUICtrlCreateLabel("Ángulo en grados: ", 88, 56, 356, 20)
$Label2 = GUICtrlCreateLabel("Velocidad en m/s: ", 88, 168, 355, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label3 = GUICtrlCreateLabel("Tiempo de vuelo en segundos: ", 72, 304, 425, 20)
$Label4 = GUICtrlCreateLabel("Altura máxima en metros: ", 72, 344, 425, 20)
$Label5 = GUICtrlCreateLabel("Alcance en metros: ", 72, 384, 429, 20)
GUISetState(@SW_SHOW)
; Juan A. Villalpando
#EndRegion ### END Koda GUI section ###
$velocidad = 0
$angulo = 0
$tiempo_de_vuelo = 0
$altura_maxima = 0
$alcance = 0
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
$angulo = GUICtrlRead($Slider1)
$radianes = (2 * 3.14 * $angulo) / 360 ; Convierte a radianes
$velocidad = GUICtrlRead($Slider2)
GUICtrlSetData($Label1, "Ángulo en grados: " & $angulo)
GUICtrlSetData($Label2, "Velocidad en m/s: " & $velocidad)
$tiempo_de_vuelo = (2 * $velocidad * sin($radianes)) / 9.8
$tiempo_de_vuelo = Round($tiempo_de_vuelo, 2)
GUICtrlSetData($Label3, "Tiempo de vuelo en segundos: " & $tiempo_de_vuelo)
$alcance = ($velocidad^2 / 9.8) * sin(2 * $radianes)
$alcance = Round($alcance, 2)
GUICtrlSetData($Label4, "Alcance en metros: " & $alcance)
$altura_maxima = $velocidad^2 * sin($radianes)^2 / (2 * 9.8)
$altura_maxima = Round($altura_maxima, 2)
GUICtrlSetData($Label5, "Altura máxima en metros: " & $altura_maxima)
Sleep(40)
EndSelect
Wend
Exit
|