Advertisement
pastamaker

gdip_tele : stages version

May 27th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6.  
  7.  
  8. #SingleInstance,force
  9. #Include,<gdip>
  10. SetBatchLines, -1
  11. time_time_time := 250
  12. global width:=[]
  13. width[1]:=30
  14. mass_x:=[]
  15. mass_y:=[]
  16. global mass_x:=[2,3,4,5,6,7,8,9,10]
  17.  
  18. global mass_y:=[2,2,2,2,2,2,2,2,2]
  19.  
  20. pToken := Gdip_Startup()
  21. global game:={h:650,w:500,x:400,y:10}
  22.  
  23. gui,1:  -caption +lastfound -dpiscale +E0x80000    +AlwaysOnTop
  24. GUI,1:Show,% "x" game.x " y" game.y " w" game.w " h" game.h
  25.  
  26. global hwndl:=WinExist()
  27.  
  28. hbm := CreateDIBSection(game.w, game.h)
  29.  
  30. global hdc:=CreateCompatibleDC()
  31.  
  32. obm:=SelectObject(hdc,hbm )
  33.  
  34. global G := Gdip_GraphicsFromHDC(hdc)
  35.  
  36. Gdip_SetSmoothingMode(G, 4)
  37.  
  38.  
  39. global pbrush1:=Gdip_BrushCreateSolid("0xffaf0c0b")
  40. global pbrush2:=Gdip_BrushCreateSolid("0xff00ff00")
  41. global pbrush3:=Gdip_BrushCreateSolid("0xff0000ff")
  42. global pbrush4:=Gdip_BrushCreateSolid("0x00ffffff")
  43. global pbrush5:=Gdip_BrushCreateSolid("0xffffffff")
  44. global pbrush6:=Gdip_BrushCreateSolid("0xff0c00b0")
  45. global pbrush7:=Gdip_BrushCreateSolid("0xff000000")
  46.  
  47. ;~ pPen1 := Gdip_CreatePenFromBrush(pBrush1, 5)
  48. ;~ pPen2 := Gdip_CreatePenFromBrush(pBrush7, 1)
  49. ;~ pPen3 := Gdip_CreatePenFromBrush(pBrush7, 3)
  50. Gdip_FillRectangle(g, pBrush7, 0, 0, game.w, game.h)
  51.  
  52. UpdateLayeredWindow(hwndl, hdc, game.x, game.y, game.w, game.h)
  53.  
  54.  
  55. ;~ SetTimer,main_loop,1000
  56. gosub main_loop
  57. return
  58.  
  59.  
  60. main_loop:
  61.  
  62. move_chain(mass_x.MaxIndex())
  63.  
  64. return
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. ; check odd ; if returns true it's an odd number like 1,3 ,,7 so on, if false it's an even number , for instance: 2,4,6.. (2018 as well)
  76. ch_odd(x){
  77.     if(mod(x,2) == 1)
  78.         return true
  79.     return false
  80. }
  81.  
  82. ; function create an array that is used while showing pictures , to show all the motion of telepostation you need to execute as many steps as this massive has, and
  83. ; every element of the array shows from what element you must start showing ellements and function show_right_odd(even - difference only in the number in terms of "oddness" &
  84. ; "evenness" ) shows where you have to stop (actually programme have, not you ,but never mind )
  85. ; as it's gpid version. we don't need to use hide functions as we just create everything on the screen from the ashes, from the very beginning, I hope you understand what i'm trying
  86. ; to say
  87.  
  88. Show_Left_ODD(byref mass,x){
  89.     mass:=[]
  90.     loop % (x-1)/2 {
  91. mass.insert(1)
  92. mass.insert(2)
  93. }
  94. t:=0
  95.     loop % x {
  96.         t++
  97. mass.insert(t)
  98. }
  99. mass.insert(0)
  100.  
  101. }
  102.  
  103.  
  104. Show_Right_ODD(byref mass,x){
  105.     mass:=[]
  106.     t:=0
  107.     loop % x {
  108.         t++
  109. mass.insert(t)
  110. }
  111.     loop % (x-1)/2 {
  112. mass.insert(x-1)
  113. mass.insert(x)
  114. }
  115.  
  116. mass.insert(0)
  117.  
  118. }
  119.  
  120.  
  121.  
  122.  
  123. Show_Left_EVEN(byref mass,x){
  124.     mass:=[]
  125.     loop % (x-2)/2 {
  126. mass.insert(1)
  127. mass.insert(2)
  128. }
  129. t:=0
  130.     loop % x {
  131.         t++
  132. mass.insert(t)
  133. }
  134. mass.insert(0)
  135.  
  136. }
  137.  
  138. Show_Right_EVEN(byref mass,x){
  139.     mass:=[]
  140.     t:=0
  141.     loop % x {
  142.         t++
  143. mass.insert(t)
  144. }
  145.     loop % (x-2)/2 {
  146. mass.insert(x-1)
  147. mass.insert(x)
  148. }
  149.  
  150. mass.insert(0)
  151.  
  152. }
  153.  
  154. ;**************************************************************************************************************\
  155.  
  156.  
  157. ;**************************************************************************************************************
  158. ;**************************************************************************************************************
  159.  
  160. move_chain(x){
  161.    
  162.     global time_time_time
  163.    
  164.         mass_S_L:=[]
  165.         mass_S_R:=[]
  166.    
  167.     if(ch_odd(x)){
  168.        
  169.         Show_Left_ODD( mass_S_L,x)
  170.        
  171.         Show_right_ODD( mass_S_R,x)
  172.        
  173.  
  174.        
  175.     }
  176.     else{
  177.         Show_Left_EVEN( mass_S_L,x)
  178.        
  179.         Show_right_EVEN( mass_S_R,x)
  180.        
  181.    
  182.    
  183.     }
  184.         QUA:=mass_S_L.MaxIndex()
  185.         t:=0
  186.         loop %qua% {
  187.             Sleep time_time_time
  188.             t++
  189.         ;~ Gdip_FillRectangle(g, pBrush7, 0, 0, game.w, game.h)
  190.         ;show - draw
  191.         a:=mass_S_L[t]
  192.         i:=a
  193.         b:=mass_S_R[t]
  194.        
  195.         while( a<>0 and i<=b ) {
  196.             ;~ GuiControl,show,chain%i%
  197.             draw_a_piece_of_the_chain(i,t)
  198.             i+=2
  199.     }
  200.     UpdateLayeredWindow(hwndl, hdc)
  201.     }
  202. }
  203.  
  204.  
  205. draw_a_piece_of_the_chain(i,what){
  206.     ToolTip,% i
  207.     w:=width[1]
  208.     x:=mass_x[i] * w
  209.     y:=(mass_y[i] + what) * w
  210.     Gdip_FillRectangle(g, pBrush5, x, y, w, w)
  211.    
  212.  
  213.    
  214.     }
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224. x::
  225. Gdip_Shutdown(pToken)
  226. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement