diff --git a/Data/Icons/bullet_go.png b/Data/Icons/bullet_go.png new file mode 100644 index 0000000..bc4faa7 Binary files /dev/null and b/Data/Icons/bullet_go.png differ diff --git a/Includes/Goto_Requester.pbi b/Includes/Goto_Requester.pbi new file mode 100644 index 0000000..3210a0c --- /dev/null +++ b/Includes/Goto_Requester.pbi @@ -0,0 +1,175 @@ +; ##################################################### License / Copyright ######################################### +; +; ##################################################### Dokumentation / Kommentare ################################## +; +; +; +; +; +; +; +; ##################################################### Includes #################################################### + +; ################################################################################################################### +; ##################################################### Public ###################################################### +; ################################################################################################################### + +DeclareModule Goto_Requester + EnableExplicit + ; ################################################### Constants ################################################### + + ; ################################################### Functions ################################################### + Declare Open() + Declare Close() + Declare Main() + +EndDeclareModule + +; ################################################################################################################### +; ##################################################### Private ##################################################### +; ################################################################################################################### + +Module Goto_Requester + ; ##################################################### Includes #################################################### + + ; ##################################################### Prototypes ################################################## + + ; ##################################################### Structures ################################################## + + ; ##################################################### Constants ################################################### + + ; ##################################################### Structures ################################################## + Structure Main + + EndStructure + + Structure Window + ID.i + Exit.i + + ; #### Gadgets + Text.i [10] + Spin.i [10] + Button.i + EndStructure + + ; ##################################################### Variables ################################################### + Global Main.Main + Global Window.Window + + ; ##################################################### Icons ... ################################################### + + ; ##################################################### Init ######################################################## + ;Global Font = LoadFont(#PB_Any, "Courier New", 20) + + ; ##################################################### Procedures ################################################## + Procedure Button_Event() + Protected Event_Window = EventWindow() + Protected Event_Gadget = EventGadget() + Protected Event_Type = EventType() + + Select Event_Type + Case #PB_EventType_LeftClick + Main::Canvas_Goto(-GetGadgetState(Window\Spin[0]), -GetGadgetState(Window\Spin[1])) + + EndSelect + EndProcedure + + Procedure Event_SizeWindow() + Protected Event_Window = EventWindow() + Protected Event_Gadget = EventGadget() + Protected Event_Type = EventType() + + EndProcedure + + Procedure Event_ActivateWindow() + Protected Event_Window = EventWindow() + Protected Event_Gadget = EventGadget() + Protected Event_Type = EventType() + + EndProcedure + + Procedure Event_Menu() + Protected Event_Window = EventWindow() + Protected Event_Gadget = EventGadget() + Protected Event_Type = EventType() + Protected Event_Menu = EventMenu() + + EndProcedure + + Procedure Event_CloseWindow() + Protected Event_Window = EventWindow() + Protected Event_Gadget = EventGadget() + Protected Event_Type = EventType() + + Window\Exit = #True + EndProcedure + + Procedure Open() + Protected Width, Height + + If Window\ID + SetActiveWindow(Window\ID) + ProcedureReturn #True + EndIf + + Width = 150 + Height = 100 + + Window\ID = OpenWindow(#PB_Any, 0, 0, Width, Height, "Goto", #PB_Window_SystemMenu | #PB_Window_WindowCentered, WindowID(Main::Window\ID)) + If Window\ID + + Window\Text[0] = TextGadget(#PB_Any, 10, 10, 20, 20, "X:", #PB_Text_Right) + Window\Spin[0] = SpinGadget(#PB_Any, 40, 10, 100, 20, -1000000, 1000000, #PB_Spin_Numeric) + Window\Text[1] = TextGadget(#PB_Any, 10, 30, 20, 20, "Y:", #PB_Text_Right) + Window\Spin[1] = SpinGadget(#PB_Any, 40, 30, 100, 20, -1000000, 1000000, #PB_Spin_Numeric) + Window\Button = ButtonGadget(#PB_Any, 10, Height-40, Width-20, 30, "Goto") + + SetGadgetState(Window\Spin[0], -Main::Settings\X / Main::Settings\Zoom) : SetGadgetText(Window\Spin[0], Str(-Main::Settings\X / Main::Settings\Zoom)) + SetGadgetState(Window\Spin[1], -Main::Settings\Y / Main::Settings\Zoom) : SetGadgetText(Window\Spin[1], Str(-Main::Settings\Y / Main::Settings\Zoom)) + + BindGadgetEvent(Window\Button, @Button_Event()) + + BindEvent(#PB_Event_SizeWindow, @Event_SizeWindow(), Window\ID) + BindEvent(#PB_Event_Menu, @Event_Menu(), Window\ID) + BindEvent(#PB_Event_CloseWindow, @Event_CloseWindow(), Window\ID) + + ProcedureReturn #True + EndIf + + ProcedureReturn #False + EndProcedure + + Procedure Close() + If Window\ID + + UnbindGadgetEvent(Window\Button, @Button_Event()) + + UnbindEvent(#PB_Event_SizeWindow, @Event_SizeWindow(), Window\ID) + UnbindEvent(#PB_Event_Menu, @Event_Menu(), Window\ID) + UnbindEvent(#PB_Event_CloseWindow, @Event_CloseWindow(), Window\ID) + + CloseWindow(Window\ID) + Window\ID = 0 + EndIf + EndProcedure + + Procedure Main() + If Window\Exit + Window\Exit = #False + Close() + EndIf + + EndProcedure + + ; ##################################################### Initialisation ############################################## + + ; ##################################################### Data Sections ############################################### + +EndModule + +; IDE Options = PureBasic 5.60 beta 6 (Windows - x64) +; CursorPosition = 127 +; FirstLine = 117 +; Folding = -- +; EnableXP \ No newline at end of file diff --git a/Includes/Templates.pbi b/Includes/Templates.pbi index e255fb2..2d2d055 100644 --- a/Includes/Templates.pbi +++ b/Includes/Templates.pbi @@ -292,6 +292,7 @@ Module Templates DisableGadget(Window\Button[0], #False) DisableGadget(Window\Button[1], #False) DisableGadget(Window\Button[2], #False) + DisableGadget(Window\Button[4], #False) Else SetGadgetText(Window\String, "") SetGadgetState(Window\Spin[0], 0) @@ -309,6 +310,7 @@ Module Templates DisableGadget(Window\Button[0], #True) DisableGadget(Window\Button[1], #True) DisableGadget(Window\Button[2], #True) + DisableGadget(Window\Button[4], #True) EndIf EndProcedure @@ -342,6 +344,8 @@ Module Templates Protected Event_Gadget = EventGadget() Protected Event_Type = EventType() + Protected Index = GetGadgetState(Event_Gadget) + Select Event_Type Case #PB_EventType_LeftClick Refresh_Fields() @@ -355,6 +359,11 @@ Module Templates EndIf Next + Case #PB_EventType_LeftDoubleClick + If Index <> -1 And SelectElement(Object(), Index) + Main::Canvas_Goto(-Object()\Settings\X - Object()\Width/2, -Object()\Settings\Y - Object()\Height/2, 0) + EndIf + EndSelect EndProcedure @@ -457,6 +466,11 @@ Module Templates Refresh_ListIcon() Refresh_Fields() + Case Window\Button[4] + If Index <> -1 And SelectElement(Object(), Index) + Main::Canvas_Goto(-Object()\Settings\X - Object()\Width/2, -Object()\Settings\Y - Object()\Height/2, 0) + EndIf + EndSelect EndProcedure @@ -494,6 +508,7 @@ Module Templates ResizeGadget(Window\Button [1], 60, Y, 50, 20) ResizeGadget(Window\Button [2], 110, Y, 50, 20) ResizeGadget(Window\Button [3], 160, Y, 50, 20) + ResizeGadget(Window\Button [4], Width-60, Y, 50, 20) EndProcedure Procedure Event_Menu() @@ -571,6 +586,7 @@ Module Templates Window\Button [1] = ButtonGadget(#PB_Any, 60, Y, 50, 20, "Down") Window\Button [2] = ButtonGadget(#PB_Any, 110, Y, 50, 20, "Delete") Window\Button [3] = ButtonGadget(#PB_Any, 160, Y, 50, 20, "Create") + Window\Button [4] = ButtonGadget(#PB_Any, Width-60, Y, 50, 20, "Goto") BindGadgetEvent(Window\ListIcon, @Event_ListIcon()) BindGadgetEvent(Window\Spin [0], @Event_Spin()) @@ -583,6 +599,7 @@ Module Templates BindGadgetEvent(Window\Button [1], @Event_Button()) BindGadgetEvent(Window\Button [2], @Event_Button()) BindGadgetEvent(Window\Button [3], @Event_Button()) + BindGadgetEvent(Window\Button [4], @Event_Button()) BindEvent(#PB_Event_SizeWindow, @Event_SizeWindow(), Window\ID) ;BindEvent(#PB_Event_Repaint, @Event_SizeWindow(), Window\ID) @@ -612,6 +629,7 @@ Module Templates UnbindGadgetEvent(Window\Button [1], @Event_Button()) UnbindGadgetEvent(Window\Button [2], @Event_Button()) UnbindGadgetEvent(Window\Button [3], @Event_Button()) + UnbindGadgetEvent(Window\Button [4], @Event_Button()) UnbindEvent(#PB_Event_SizeWindow, @Event_SizeWindow(), Window\ID) ;UnbindEvent(#PB_Event_Repaint, @Event_SizeWindow(), Window\ID) @@ -1052,8 +1070,8 @@ Module Templates EndModule ; IDE Options = PureBasic 5.60 beta 6 (Windows - x64) -; CursorPosition = 1020 -; FirstLine = 1000 +; CursorPosition = 363 +; FirstLine = 341 ; Folding = ------ ; EnableXP ; Executable = ..\Pixelcanvas Client.exe diff --git a/Pixelcanvas Client.pb b/Pixelcanvas Client.pb index fa2f2e8..26721b1 100644 --- a/Pixelcanvas Client.pb +++ b/Pixelcanvas Client.pb @@ -20,7 +20,7 @@ DeclareModule Main ; ################################################### Prototypes ################################################## ; ################################################### Constants ################################################### - #Version = 0957 + #Version = 0959 #Software_Name = "Pixelcanvas.io Custom Client" @@ -31,6 +31,9 @@ DeclareModule Main #Chunk_Collection_Download_Timeout = 5 * 60 * 1000 + #Canvas_Zoom_Max = 4 + #Canvas_Zoom_Min = -2 + #Colors = 16 #Filename_Settings = "Settings.txt" @@ -44,6 +47,7 @@ DeclareModule Main #Menu_Canvas_Load #Menu_Canvas_Reload #Menu_Canvas_AutoReload + #Menu_Canvas_Goto #Menu_Captcha_Requester @@ -195,6 +199,8 @@ DeclareModule Main Declare Image_Get(X.i, Y.i, Width.i, Height.i) + Declare Canvas_Goto(X.d, Y.d, Zoom=#Canvas_Zoom_Min-1) + Declare Chunk_Collection_Get(CCX.i, CCY.i, Create=#False) Declare Chunk_Collection_Download_Area(X.i, Y.i, Width.i, Height.i) Declare Chunk_Collection_Delete(*Chunk_Collection.Chunk_Collection) @@ -208,6 +214,7 @@ EndDeclareModule ; ##################################################### Includes #################################################### XIncludeFile "Includes/About.pbi" XIncludeFile "Includes/Captcha_Requester.pbi" +XIncludeFile "Includes/Goto_Requester.pbi" XIncludeFile "Includes/Templates.pbi" Module Main @@ -256,7 +263,7 @@ Module Main Global Icon_key = CatchImage(#PB_Any, ?Icon_key) Global Icon_information = CatchImage(#PB_Any, ?Icon_information) Global Icon_bell = CatchImage(#PB_Any, ?Icon_bell) - + Global Icon_bullet_go = CatchImage(#PB_Any, ?Icon_bullet_go) ; ################################################### Regular Expressions ######################################### Global RegEx_Duck = CreateRegularExpression(#PB_Any, "DUCK=(?[a-z])") @@ -349,11 +356,11 @@ Module Main Case #PB_EventType_MouseWheel Temp_Zoom = Pow(2, GetGadgetAttribute(Event_Gadget, #PB_Canvas_WheelDelta)) - If Settings\Zoom * Temp_Zoom < Pow(2, -2) - Temp_Zoom = Pow(2, -2) / Settings\Zoom + If Settings\Zoom * Temp_Zoom < Pow(2, #Canvas_Zoom_Min) + Temp_Zoom = Pow(2, #Canvas_Zoom_Min) / Settings\Zoom EndIf - If Settings\Zoom * Temp_Zoom > Pow(2, 4) - Temp_Zoom = Pow(2, 4) / Settings\Zoom + If Settings\Zoom * Temp_Zoom > Pow(2, #Canvas_Zoom_Max) + Temp_Zoom = Pow(2, #Canvas_Zoom_Max) / Settings\Zoom EndIf Settings\X - (Temp_Zoom - 1) * (GetGadgetAttribute(Event_Gadget, #PB_Canvas_MouseX) - Settings\X - Width/2) Settings\Y - (Temp_Zoom - 1) * (GetGadgetAttribute(Event_Gadget, #PB_Canvas_MouseY) - Settings\Y - Height/2) @@ -413,6 +420,9 @@ Module Main Case #Menu_Canvas_AutoReload Settings\Canvas_AutoReload = GetToolBarButtonState(Window\ToolBar, #Menu_Canvas_AutoReload) + Case #Menu_Canvas_Goto + Goto_Requester::Open() + Case #Menu_Captcha_Requester Settings\Captcha_Requester = GetToolBarButtonState(Window\ToolBar, #Menu_Captcha_Requester) @@ -471,6 +481,7 @@ Module Main MenuTitle("Canvas") MenuItem(#Menu_Canvas_Load, "Load viewport", ImageID(Icon_map)) MenuItem(#Menu_Canvas_Reload, "Reload all", ImageID(Icon_map_go)) + MenuItem(#Menu_Canvas_Goto, "Goto", ImageID(Icon_bullet_go)) MenuTitle("Settings") MenuItem(#Menu_Settings_Change_Fingerprint, "Change fingerprint", ImageID(Icon_key)) @@ -490,6 +501,7 @@ Module Main ToolBarImageButton(#Menu_Canvas_Load, ImageID(Icon_map), #PB_ToolBar_Normal, "Load viewport") : ToolBarToolTip(Window\ToolBar, #Menu_Canvas_Load, "Load all unloaded chunks inside the viewport") ToolBarImageButton(#Menu_Canvas_Reload, ImageID(Icon_map_go), #PB_ToolBar_Normal, "Reload all") : ToolBarToolTip(Window\ToolBar, #Menu_Canvas_Reload, "Reload all chunks") ToolBarImageButton(#Menu_Canvas_AutoReload, ImageID(Icon_time_go), #PB_ToolBar_Toggle, "Autoreload") : ToolBarToolTip(Window\ToolBar, #Menu_Canvas_AutoReload, "Reload all chunks every 60 minutes (Shouldn't be used anymore)") + ToolBarImageButton(#Menu_Canvas_Goto, ImageID(Icon_bullet_go), #PB_ToolBar_Normal, "Goto") : ToolBarToolTip(Window\ToolBar, #Menu_Canvas_Goto, "Move viewport to a given coordinate") ToolBarImageButton(#Menu_Captcha_Requester, ImageID(Icon_bell), #PB_ToolBar_Toggle, "Captcha Requester") : ToolBarToolTip(Window\ToolBar, #Menu_Captcha_Requester, "Show a notification window, when a captcha has to be solved") ToolBarImageButton(#Menu_Settings_Change_Fingerprint, ImageID(Icon_key), #PB_ToolBar_Normal, "Fingerprint") : ToolBarToolTip(Window\ToolBar, #Menu_Settings_Change_Fingerprint, "Change fingerprint (Shouldn't be used anymore)") @@ -571,6 +583,17 @@ Module Main ProcedureReturn ImageID EndProcedure + Procedure Canvas_Goto(X.d, Y.d, Zoom=#Canvas_Zoom_Min-1) + If Zoom >= #Canvas_Zoom_Min And Zoom <= #Canvas_Zoom_Max + Settings\Zoom = Pow(2, Zoom) + EndIf + + Settings\X = X * Settings\Zoom + Settings\Y = Y * Settings\Zoom + + Window\Canvas\Redraw = #True + EndProcedure + Procedure Canvas_Redraw() Protected X_M.d, Y_M.d Protected Width, Height @@ -1481,6 +1504,7 @@ Module Main Templates::Main() Captcha_Requester::Main() + Goto_Requester::Main() About::Main() EndProcedure @@ -1523,11 +1547,13 @@ Module Main Icon_key: : IncludeBinary "Data/Icons/key.png" Icon_information: : IncludeBinary "Data/Icons/information.png" Icon_bell: : IncludeBinary "Data/Icons/bell.png" + Icon_bullet_go: : IncludeBinary "Data/Icons/bullet_go.png" EndDataSection EndModule ; IDE Options = PureBasic 5.60 beta 6 (Windows - x64) -; CursorPosition = 22 +; CursorPosition = 594 +; FirstLine = 585 ; Folding = ----- ; EnableThread ; EnableXP diff --git a/Pixelcanvas.io Custom Client.pbp b/Pixelcanvas.io Custom Client.pbp index 89a56cb..227054d 100644 --- a/Pixelcanvas.io Custom Client.pbp +++ b/Pixelcanvas.io Custom Client.pbp @@ -1,13 +1,13 @@ - +
- +
@@ -22,13 +22,17 @@ + + + + - + @@ -36,7 +40,7 @@ - +
@@ -46,9 +50,9 @@ - - - + + +