This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub GW_DrawGrid | |
' GraphicsWindow | draw grid | |
_gw = GraphicsWindow.Width | |
_gh = GraphicsWindow.Height | |
_c100 = "#66000000" | |
_c10 = "#33000000" | |
For _x = 0 To _gw Step 10 | |
If Math.Remainder(_x / 10, 10) = 0 Then | |
GraphicsWindow.PenColor = _c100 | |
Else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub FileHelper_ShowError | |
' File Helper | show last errer | |
' param op - oparation name | |
' param indent - indent space if needed | |
TextWindow.ForegroundColor = "Yellow" | |
TextWindow.WriteLine(indent + op + ":FAILED") | |
TextWindow.WriteLine(indent + "LastError:" + File.LastError) | |
TextWindow.ForegroundColor = "Gray" | |
EndSub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Sprite_Add | |
' Sprite | add shapes to a sprite | |
' param name - sprite name | |
' param shX, shY - origin of shape array | |
' param scale - to resize | |
' param shape[] - shape array | |
' param nSprite - number of sprite | |
' return nSprite - updated number of sprite | |
' return sprite[] - sprite array | |
Stack.PushValue("local", i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub GetShapes() | |
' Get shapes array from PowerPoint VBA | |
' Version 0.4 | |
' Copyright (c) 2015-2016 Nonki Takahashi. The MIT License. | |
' Last update 2016-01-08 | |
' | |
Dim index As Long | |
Dim myDocument As Slide | |
Dim x(300) As Integer, y(300) As Integer | |
Dim xmin As Integer, ymin As Integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Shapes_CalcRotateZoomPos | |
' Shapes | calculate position for rotated and zoomed shape | |
' param["x"], param["y"] - position of a shape | |
' param["width"], param["height"] - size of a shape | |
' param ["cx"], param["cy"] - center of rotation | |
' param ["angle"] - rotate angle | |
' param ["scale"] - zoom scale | |
' return x, y - rotated position of a shape | |
_cx = param["x"] + param["width"] / 2 | |
_cy = param["y"] + param["height"] / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub SB_LineWorkaround | |
' Small Basic | line rotate workaround for SBD | |
' param x, y - coordinate of the position of the line | |
' param x1, y1 - coordinate of the first point | |
' param x2, y2 - coordinate of the second point | |
' param pw - pen width | |
' param alpha - to rotate [degree] | |
' return x, y - workaround value for the coordinate | |
Stack.PushValue("local", x) | |
Stack.PushValue("local", y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Clock_DateToJD | |
' Clock | convert date to Julian Day | |
' param date - date formatted as YYYY/MM/DD | |
' return jd - Julian Day [day] | |
s1 = Text.GetIndexOf(date, "/") | |
year = Text.ConvertToUpperCase(Text.GetSubText(date, 1, s1 - 1)) | |
bc = Text.GetIndexOf(year, "BC") | |
If 0 < bc Then | |
year = Text.GetSubText(year, 1, bc - 1) + Text.GetSubTextToEnd(year, bc + 2) | |
year = -(year - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Text_Compare | |
' Text | compare texts with case sensitive option | |
' param["text1"], param["text2"] - to compare | |
' param["caseSensitive"] - "True" if case sensitive | |
' return eq = "True" if text1 = text2 | |
' return gt = "True" if text1 > text2 | |
' return lt = "True" if text1 < text2 | |
If param["caseSensitive"] Then | |
text1 = param["text1"] | |
text2 = param["text2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Math_CartesianToPolar | |
' Math | convert Cartesian coodinate to polar coordinate | |
' param x, y - Cartesian coordinate | |
' return r, a - polar coordinate (0<=a<360) | |
r = Math.SquareRoot(x * x + y * y) | |
If x = 0 And y > 0 Then | |
a = 90 ' [degree] | |
ElseIf x = 0 And y < 0 Then | |
a = -90 | |
ElseIf x = 0 And y = 0 Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Color_Blacken | |
' Color | blacken given color | |
' param c - given color | |
' param rate - 0..1 | |
' return c - color blackened | |
Color_NameToColor() | |
Color_ColorToRGB() | |
r = Math.Floor(r * (1 - rate)) | |
g = Math.Floor(g * (1 - rate)) | |
b = Math.Floor(b * (1 - rate)) |
NewerOlder