Code: Alles auswählen
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
Procedure Playerdraw(p_x,p_y,angle)
p_a_a.f=6.29/360*angle-0.79
p_x_a.f = 20*Cos(p_a_a.f) + 20*Sin(p_a_a.f)
p_y_a.f = 20*Sin(p_a_a.f) - 20*Cos(p_a_a.f)
Circle(p_x, p_y, 10 , $0000FF)
LineXY(p_x, p_y, p_x+p_x_a.f, p_y+p_y_a.f, $0000FF)
EndProcedure
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Image_field
#String_send
#Button_send
EndEnumeration
;- Image Plugins
Image0 = CreateImage(0, 500, 500)
Procedure Open_Window_0()
If OpenWindow(#Window_0, 216, 0, 500, 530, "Chat", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
ImageGadget(#Image_field, 0, 0, 500, 500, Image0)
StringGadget(#String_send, 10, 500, 420, 20, "")
ButtonGadget(#Button_send, 440, 500, 50, 20, "send")
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
If GetAsyncKeyState_(37)
angle - 1
EndIf
If GetAsyncKeyState_(38)
p_a_a.f=6.29/360*angle-0.79
p_x_a.f = 1*Cos(p_a_a.f) + 1*Sin(p_a_a.f)
p_y_a.f = 1*Sin(p_a_a.f) - 1*Cos(p_a_a.f)
p_x = p_x + p_x_a.f
p_y = p_y + p_y_a.f
EndIf
If GetAsyncKeyState_(39)
angle + 1
EndIf
If GetAsyncKeyState_(40)
p_a_a.f=6.29/360*angle-0.79
p_x_a.f = 1*Cos(p_a_a.f) + 1*Sin(p_a_a.f)
p_y_a.f = 1*Sin(p_a_a.f) - 1*Cos(p_a_a.f)
p_x = p_x - p_x_a.f
p_y = p_y - p_y_a.f
EndIf
StartDrawing(ImageOutput(0))
Box(0,0,500,500,$FFBABA)
Playerdraw(p_x,p_y,angle)
StopDrawing()
SetGadgetState(#Image_field,ImageID(0))
Event = WindowEvent()
If Event = #PB_Event_CloseWindow
Quit = 1
ElseIf Event = #PB_Event_Gadget Or Event = #PB_Event_Menu
Select EventGadget()
Case #Button_send
EndSelect
EndIf
Delay(5)
Until Quit