Forum Replies Created
-
AuthorPosts
-
I’ve added a way to override the fonts used by the theme from inside the IDE.
You do it via File > Preferences… > Font
First enter the name of the font file, for example “MyFont.ttf”, then the size of the font.
You can also leave the fields empty to revert back to the standard font used by the theme.Here the Roboto font at 16px is used.

prefs.monkey2
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102Namespace ted2goClass Prefs' AutoCompletionGlobal AcEnabled:=TrueGlobal AcKeywordsOnly:=FalseGlobal AcShowAfter:=2Global AcUseTab:=TrueGlobal AcUseEnter:=FalseGlobal AcUseSpace:=TrueGlobal AcNewLineByEnter:=True'Global MainToolBarVisible:=TrueGlobal EditorToolBarVisible:=TrueGlobal EditorGutterVisible:=TrueGlobal EditorShowWhiteSpaces:=FalseGlobal EditorFontName:StringGlobal EditorFontSize:String'Global SourceSortByType:=TrueGlobal SourceShowInherited:=FalseFunction LoadState( json:JsonObject )If json.Contains( "completion" )Local j2:=json["completion"].ToObject()AcEnabled=j2["enabled"].ToBool()AcKeywordsOnly=j2["keywordsOnly"].ToBool()AcShowAfter=j2["showAfter"].ToNumber()AcUseTab=j2["useTab"].ToBool()AcUseEnter=j2["useEnter"].ToBool()AcUseSpace=GetJsonBool( j2,"useSpace",AcUseSpace )AcNewLineByEnter=j2["newLineByEnter"].ToBool()EndifIf json.Contains( "mainToolBarVisible" )MainToolBarVisible=json["mainToolBarVisible"].ToBool()EndifIf json.Contains( "editor" )Local j2:=json["editor"].ToObject()EditorToolBarVisible=j2["toolBarVisible"].ToBool()EditorGutterVisible=j2["gutterVisible"].ToBool()EditorShowWhiteSpaces=GetJsonBool( j2,"showWhiteSpaces",EditorShowWhiteSpaces )If j2.Contains("fontName") Then EditorFontName=j2["fontName"].ToString()If j2.Contains("fontSize") Then EditorFontSize=j2["fontSize"].ToString()EndifIf json.Contains( "source" )Local j2:=json["source"].ToObject()SourceSortByType=j2["sortByType"].ToBool()SourceShowInherited=j2["showInherited"].ToBool()EndifEndFunction SaveState( json:JsonObject )Local j:=New JsonObjectj["enabled"]=New JsonBool( AcEnabled )j["keywordsOnly"]=New JsonBool( AcKeywordsOnly )j["showAfter"]=New JsonNumber( AcShowAfter )j["useTab"]=New JsonBool( AcUseTab )j["useEnter"]=New JsonBool( AcUseEnter )j["useSpace"]=New JsonBool( AcUseSpace )j["newLineByEnter"]=New JsonBool( AcNewLineByEnter )json["completion"]=jjson["mainToolBarVisible"]=New JsonBool( MainToolBarVisible )j=New JsonObjectj["toolBarVisible"]=New JsonBool( EditorToolBarVisible )j["gutterVisible"]=New JsonBool( EditorGutterVisible )j["showWhiteSpaces"]=New JsonBool( EditorShowWhiteSpaces )j["fontName"]=New JsonString( EditorFontName )j["fontSize"]=New JsonString( EditorFontSize )json["editor"]=jj=New JsonObjectj["sortByType"]=New JsonBool( SourceSortByType )j["showInherited"]=New JsonBool( SourceShowInherited )json["source"]=jEndEndFunction GetJsonBool:Bool( json:Map<String,JsonValue>,key:String,def:Bool )Return json[key] ? json[key].ToBool() Else defEndprefsdialog.monkey2
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134Namespace ted2goClass PrefsDialog Extends DialogExtField Apply:Void()Method New()Title="Prefs"_acShowAfter=New TextField( ""+Prefs.AcShowAfter )_acEnabled=New CheckButton( "Enabled" )_acEnabled.Checked=Prefs.AcEnabled_acKeywordsOnly=New CheckButton( "Keywords only" )_acKeywordsOnly.Checked=Prefs.AcKeywordsOnly_acUseTab=New CheckButton( "Choose by Tab" )_acUseTab.Checked=Prefs.AcUseTab_acUseEnter=New CheckButton( "Choose by Enter" )_acUseEnter.Checked=Prefs.AcUseEnter_acUseSpace=New CheckButton( "Choose by Space" )_acUseSpace.Checked=Prefs.AcUseSpace_acNewLineByEnter=New CheckButton( "Add new line (by Enter)" )_acNewLineByEnter.Checked=Prefs.AcNewLineByEnter_editorToolBarVisible=New CheckButton( "ToolBar visible" )_editorToolBarVisible.Checked=Prefs.EditorToolBarVisible_editorGutterVisible=New CheckButton( "Gutter visible" )_editorGutterVisible.Checked=Prefs.EditorGutterVisible_mainToolBarVisible=New CheckButton( "ToolBar visible" )_mainToolBarVisible.Checked=Prefs.MainToolBarVisible_editorShowWhiteSpaces=New CheckButton( "Whitespaces visible" )_editorShowWhiteSpaces.Checked=Prefs.EditorShowWhiteSpaces_editorFontName=New TextField( Prefs.EditorFontName )_editorFontSize=New TextField( Prefs.EditorFontSize )Local font:=New DockingViewfont.AddView( New Label( "Font" ),"left" )font.AddView( _editorFontName,"left" )font.AddView( _editorFontSize,"left","45" )Local after:=New DockingViewafter.AddView( New Label( "Show after" ),"left" )after.AddView( _acShowAfter,"left" )Local docker:=New DockingViewdocker.AddView( New Label( "[Main]" ),"top" )docker.AddView( _mainToolBarVisible,"top" )docker.AddView( New Label( " " ),"top" )docker.AddView( New Label( "[Code Editor]" ),"top" )docker.AddView( _editorToolBarVisible,"top" )docker.AddView( _editorGutterVisible,"top" )docker.AddView( _editorShowWhiteSpaces,"top" )docker.AddView( font,"top" )docker.AddView( New Label( " " ),"top" )docker.AddView( New Label( "[Completion]" ),"top" )docker.AddView( _acEnabled,"top" )docker.AddView( after,"top" )docker.AddView( _acUseTab,"top" )docker.AddView( _acUseEnter,"top" )docker.AddView( _acNewLineByEnter,"top" )docker.AddView( _acUseSpace,"top" )docker.AddView( _acKeywordsOnly,"top" )docker.AddView( New Label( " " ),"top" )docker.AddView( New Label( "(Restart IDE to see all changes)" ),"top" )docker.AddView( New Label( " " ),"top" )ContentView=dockerLocal apply:=AddAction( "Apply" )apply.Triggered=OnApply_acShowAfter.Activated+=_acShowAfter.MakeKeyViewDeactivated+=MainWindow.UpdateKeyViewEndPrivateField _acEnabled:CheckButtonField _acUseTab:CheckButtonField _acUseEnter:CheckButtonField _acUseSpace:CheckButtonField _acNewLineByEnter:CheckButtonField _acKeywordsOnly:CheckButtonField _acShowAfter:TextFieldField _editorToolBarVisible:CheckButtonField _editorGutterVisible:CheckButtonField _editorShowWhiteSpaces:CheckButtonField _editorFontName:TextFieldField _editorFontSize:TextFieldField _mainToolBarVisible:CheckButtonMethod OnApply()Prefs.AcEnabled=_acEnabled.CheckedPrefs.AcUseTab=_acUseTab.CheckedPrefs.AcUseEnter=_acUseEnter.CheckedPrefs.AcUseSpace=_acUseSpace.CheckedPrefs.AcNewLineByEnter=_acNewLineByEnter.CheckedPrefs.AcKeywordsOnly=_acKeywordsOnly.CheckedLocal count:=Max( 1,Int( _acShowAfter.Text ) )Prefs.AcShowAfter=countPrefs.EditorToolBarVisible=_editorToolBarVisible.CheckedPrefs.EditorGutterVisible=_editorGutterVisible.CheckedPrefs.EditorShowWhiteSpaces=_editorShowWhiteSpaces.CheckedPrefs.EditorFontName=_editorFontName.TextPrefs.EditorFontSize=Int(_editorFontSize.Text)Prefs.MainToolBarVisible=_mainToolBarVisible.CheckedApp.ThemeChanged()Hide()Apply()EndEndcodedocument.monkey2, specifically the UpdateThemeColors() part
Monkey123456789Method UpdateThemeColors()_lineColor=App.Theme.GetColor( "textview-cursor-line" )If Prefs.EditorFontName.Length>1 And Int(Prefs.EditorFontSize)>1 ThenLocal tmpFont:=Font.Load("asset::fonts\"+Prefs.EditorFontName,Int(Prefs.EditorFontSize))If tmpFont Then RenderStyle.Font=tmpFont Else RenderStyle.Font=App.Theme.GetStyle("Editor").FontEndifEnd@nerobot
I noticed my “Smooth” theme still isn’t updated in the newer releases.
I’d recommend you use the new version I posted long ago over at: http://monkey2.monkey-x.com/forums/topic/ted2go-fork/page/12/#post-7209I’m a bit confused as to why these videos and screenshots aren’t on the main homepage.
It’s stuff like this I wish were on the “Blog” section.
Those videos and tiny updates is the only reason I check Twitter.Well that’s kinda how I expected images to work.
But I figured that there might be some way to change that, either by passing it as Ptr and accessing it via [0] or something, but that just throws an error.
I ended up passing the loaded image from inside the function as a return value and via some lambda functions I managed to get it working.If you don’t mind me being pedantic, one thing that bugs me about the GUI system is when you click on a window menu title (eg. File) and move the mouse over the next menu title, the next menu should become the one displayed.
That’s really a MojoX thing rather than a Ted2Go thing though.
But yeah, that has bugged me in the past heh.Ted2Go has read the command-line parameters for quite some time now though.
You can absolutely associate .monkey2 files with Ted2Go. (I’m doing that right now)
http://monkey2.monkey-x.com/forums/topic/ted2go-fork/page/6/#post-5313“Feature – open docs from args, so we can create file association for .monkey2 files with ted2…”
And with “docs” he means the Monkey 2 files and not the help documents heh.
If the IDE is your biggest problem, you could always use something like Atom.
http://monkey2.monkey-x.com/forums/topic/atom-package-for-monkey2/I’ve tried a lot of things…
Print AppDir()+”wget.exe” spits out “G:/Projects/Monkey 2/gw2map2/main.products/Windows/wget.exe” which is correct.
But even if I start the process via AppDir()+”wget.exe” I get the error.I’ve managed to get Mumble working, and this should work with any Mumble supported game.
You’ll need this mumble.h file:C++123456789101112131415161718192021222324252627282930313233#include <windows.h>struct LinkedMem {UINT32 uiVersion;DWORD uiTick;float fAvatarPosition[3];float fAvatarFront[3];float fAvatarTop[3];wchar_t name[256];float fCameraPosition[3];float fCameraFront[3];float fCameraTop[3];wchar_t identity[256];UINT32 context_len;unsigned char context[256];wchar_t description[2048];};static LinkedMem *lm = NULL;static void initMumble() {// HANDLE hMapObject = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink");HANDLE hMapObject = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(LinkedMem), L"MumbleLink");if (hMapObject == NULL)return;lm = (LinkedMem *) MapViewOfFile(hMapObject, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(LinkedMem));if (lm == NULL) {CloseHandle(hMapObject);hMapObject = NULL;return;}}And here’s the Monkey 2 wrapper for it:
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142Namespace mumble#Import "mumble.h"ExternStruct LinkedMemField uiVersion:UIntField fAvatarPosition:Float[]Field fAvatarFront:Float[]Field fAvatarTop:Float[]Field fCameraPosition:Float[]Field fCameraFront:Float[]Field fCameraTop:Float[]Field name:StringField identity:StringField context_len:IntField context:UByte[]Field description:StringEndFunction initMumble_C:Void()="initMumble"Function updateMumble_C:Void()="updateMumble"Global lm:LinkedMem PtrPublicGlobal link:LinkedMemFunction InitMumble:Int()initMumble_C()If lm Thenlink=lm[0]Return 1ElseReturn 0EndifEndFunction UpdateMumble()If lm Then link=lm[0]EndYou use it by first calling InitMumble()
Then call UpdateMumble() as you want new information. (every frame)
You then use the Global link variable to check your avatars/cameras position, rotation, name etc.Thanks!
I’m so glad you think the download speed is fine.
I made the same thing in BlitzMax using the cURL module and it’s a bit faster.
But that might just be cause I don’t write the files to disk first.By default it allows for a maximum of 8 simultaneous downloads, you can change this by changing MAX_DLS.
It also uses the 4 DNS servers Guild Wars 2 provides, I’m not sure that actually does anything though heh.
You can change that with MAX_DNS, but don’t go any higher than 4 since there’s no 5th DNS server for the tile service.This example is a bit wasteful when it comes to actually rendering the map since it renders every zoom step ontop of each other.
So even if you’re at zoom level 4, it will render zoom 0, 1, 2, 3.
I do this because otherwise when you zoomed in there would be no images at all to display at that zoom level.Your example doesn’t show
.”…and load an image…”
Which is the problem.
Here’s an example showing that it just doesn’t work.
https://dl.dropboxusercontent.com/u/2842751/image_test.zipHere’s a translated example.
Click to place a few nodes, then drag a line between the nodes.
Hover over a node and press S to place the path start.
Do the same but press G to place the path goal.
Press Enter to calculate the path.Original code: http://www.monkey-x.com/Community/posts.php?topic=2155
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500#Import "<std>"#Import "<mojo>"Using std..Using mojo..Const PATHNODE_RADIUS:Int=12Global START_NODE:PathNodeGlobal GOAL_NODE:PathNodeClass MyWindow Extends Window'stores mouse positionsField mx:IntField my:Int'bool to detect mouse pressingField mousePressed:Int'stores clicked nodesField node1:PathNodeField node2:PathNode'stores found pathField foundPath:PathField foundTime:IntMethod New(title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null)Super.New(title,width,height,flags )EndMethod OnRender(canvas:Canvas) OverrideApp.RequestRender()OnUpdate()'draws mouse lineIf mousePressed = 1If Mouse.X<>mx Or Mouse.Y<>mycanvas.DrawLine(mx, my, Mouse.X, Mouse.Y)EndifEndif'draws node networkPathNode.DrawLinks(canvas)PathNode.DrawNodes(canvas)'draws pathIf foundPath<>Nullcanvas.Color=Color.Whitecanvas.DrawText(foundPath.PrintPath() + " " + foundTime + "ms", 10, 0)EndifEndMethod OnUpdate()'finds a pathIf Keyboard.KeyHit(Key.Enter)'sets up pathfinding routingfoundPath = NullPathFind.Setup( START_NODE, GOAL_NODE )'starts pathfindingfoundTime = Millisecs()Local result : Bool = PathFind.FindPath()foundTime = Millisecs() - foundTime'stores found pathIf result = True Then foundPath = PathFind.pathList.FirstEndif'sets start nodeIf Keyboard.KeyHit(Key.S)Local test : PathNode = PathNode.Touch( Mouse.X, Mouse.Y )If test <> Null Then START_NODE = testEndif'sets goal nodeIf Keyboard.KeyHit(Key.G)Local test : PathNode = PathNode.Touch( Mouse.X, Mouse.Y )If test <> Null Then GOAL_NODE = testEndif'handles mouseIf Mouse.ButtonDown(MouseButton.Left)'store initial mouse click location (used to detect mouse movement)If mousePressed = 0'grab mouse positionmx = Mouse.Xmy = Mouse.Y'grab clicked node if anynode1 = PathNode.Touch( mx, my )Endif'mouse has been pressedmousePressed = 1EndifIf Not Mouse.ButtonDown(MouseButton.Left) And mousePressed = 1'if we didnt click a path nodeIf node1 = Null'if the mouse position has not changed since we first clickedIf Mouse.X = mx And Mouse.Y = my'create a path nodePathNode.Create(mx, my)'position has moved so we have dragged an invisible lineElse'use the mouse path to find intersecting nodes and links and remove themPathNode.RemoveIntersectingNodes(mx,my,Mouse.X, Mouse.Y)PathNode.RemoveIntersectingLinks(mx,my,Mouse.X, Mouse.Y)Endif'if we did click inside a nodeElse'grab clicked node if anynode2 = PathNode.Touch( Mouse.X, Mouse.Y )'check if we intersected with another nodeIf node2<>Null And node2<>node1'create a linknode1.Link( node2 )EndifEndif'reset mousemousePressed = 0node1 = NullEndifEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndClass PathField nodes:List<PathNode>Field travelledDistance:FloatField underestimate:FloatMethod New()Self.nodes=New List<PathNode>EndMethod Copy:Path()Local this:Path=New PathFor Local n:PathNode=Eachin Self.nodesthis.nodes.AddLast(n)Nextthis.travelledDistance=Self.travelledDistanceReturn thisEndMethod CalculateUnderestimate:Float( goal : PathNode )If goal = Null Then Return 0Self.underestimate=nodes.Last.Distance( goal.x, goal.y )Return Self.underestimateEndMethod PrintPath:String()Local output:StringFor Local this:PathNode = Eachin Self.nodesoutput=output + String( this.id )If this<>Self.nodes.Lastoutput+=" -> "EndifNextReturn outputEndFunction Create:Path( start : PathNode )Local this:Path = New Paththis.nodes.AddLast( start )Return thisEndEnd'extends the listClass PathfindList Extends List<Path>'compares score valueMethod Compare:Int(a:Path,b:Path )If a.travelledDistance+a.underestimate>b.travelledDistance+b.underestimate Then Return 1If a.travelledDistance+a.underestimate<b.travelledDistance+b.underestimate Then Return -1Return 0EndEnd'static pathfind classClass PathFindGlobal start:PathNodeGlobal goal:PathNodeGlobal pathList:PathfindList=New PathfindList'sets up the pathfindingFunction Setup(node1:PathNode, node2:PathNode)start=node1goal=node2pathList.Clear()pathList.AddLast(Path.Create(start))pathList.First.CalculateUnderestimate(node2)End'finds a pathFunction FindPath:Bool()Repeat'if pathList is empty then exitIf Not pathList Or pathList.Count()=0 Then Return False'if first path ends at goal then we have found our pathIf pathList.First.nodes.Last = goal Then Return True'extract the first pathLocal firstPath:Path=pathList.RemoveFirst()'extend path to all neighbours creating x new pathsFor Local neighbour:PathLink=Eachin firstPath.nodes.Last.linked'copy pathLocal newPath:Path = firstPath.Copy()'get the neighbour nodeLocal newNode:PathNode = neighbour.linkedNode'reject if loopFor Local child:PathNode = Eachin newPath.nodesIf child=newNodenewPath=NullExitEndifNext'if newPath is null we found a loopIf newPath'add new node and travel costnewPath.nodes.AddLast( newNode )newPath.travelledDistance = newPath.travelledDistance + neighbour.costEndif'For all paths that End at the same node, keep only the shortest one.If newPath<>NullFor Local shortPath:Path=Eachin pathList'if ends in the same nodeIf shortPath.nodes.Last=newNode'keep the shortestIf shortPath.travelledDistance <= newPath.travelledDistancenewPath = NullExitElsepathList.RemoveEach( shortPath )ExitEndifEndifNextEndif'if we still have a valid new path add it to the listIf newPath <> NullpathList.AddLast( newPath )newPath.CalculateUnderestimate( goal )EndifNext'Sort all paths by total underestimate, shortest first.pathList.Sort(True)ForeverReturn FalseEndEndClass PathLinkField linkedNode:PathNodeField cost:FloatFunction Create:PathLink(node1:PathNode, node2:PathNode)Local this:PathLink=New PathLinkthis.linkedNode=node2this.cost=node1.Distance(node2.x, node2.y)Return thisEndEndClass PathNodeGlobal nodeCount:IntGlobal nodeList:List<PathNode>Field nodeId:List<PathNode>.NodeField id:IntField x:IntField y:IntField linked:List<PathLink>'links two nodesMethod Link(other:PathNode)'if same node then exitIf other = Self Then Return'if link already exists then exitFor Local this:PathLink=Eachin Self.linkedIf this.linkedNode=other Then ReturnNext'create linksother.linked.AddLast(PathLink.Create(other,Self))Self.linked.AddLast(PathLink.Create(Self,other))End'draws node, coloured to indicate start/goalMethod Draw(canvas:Canvas)canvas.Color=Color.Whitecanvas.DrawOval(Self.x - PATHNODE_RADIUS, Self.y - PATHNODE_RADIUS, PATHNODE_RADIUS * 2, PATHNODE_RADIUS * 2)canvas.Color=Color.BlackIf GOAL_NODE=Self Then canvas.Color=Color.RedIf START_NODE=Self Then canvas.Color=Color.Greencanvas.DrawOval(Self.x - PATHNODE_RADIUS + 1, Self.y - PATHNODE_RADIUS + 1, PATHNODE_RADIUS * 2 - 2, PATHNODE_RADIUS * 2 - 2)canvas.Color=Color.Whitecanvas.DrawText(Self.id, Self.x, Self.y, 0.5, 0.5)End'draws a line to all linked nodesMethod DrawLinked(canvas:Canvas)canvas.Color=Color.WhiteFor Local this:PathLink = Eachin Self.linkedcanvas.DrawLine(Self.x, Self.y, this.linkedNode.x, this.linkedNode.y)NextEnd Method'returns distance from self to point x, yMethod Distance:Float(px:Int, py:Int)Local dx:Int=px-Self.xLocal dy:Int=py-Self.yReturn Sqrt(dx*dx+dy*dy)End MethodFunction Create:PathNode(px:Int, py:Int)If Not nodeList Then nodeList=New List<PathNode>nodeCount=nodeCount+1Local this:PathNode=New PathNode''Find unique ID for nodeLocal n:PathNodeLocal freeId:IntLocal checkId:IntRepeatfreeId=checkIdFor n=Eachin nodeListIf n.id=checkId Then'RETRY!!freeId=-1ExitEndifNextcheckId+=1Until freeId>=0this.id=freeIdthis.x=pxthis.y=pythis.nodeId=nodeList.AddLast(this)this.linked=New List<PathLink>Return thisEnd FunctionFunction DrawNodes(canvas:Canvas)If Not nodeList Or nodeList.Count()=0 Then ReturnFor Local this:PathNode=Eachin nodeListthis.Draw(canvas)NextEndFunction DrawLinks(canvas:Canvas)If Not nodeList Or nodeList.Count()=0 Then ReturnFor Local this : PathNode = Eachin nodeListthis.DrawLinked(canvas)NextEndFunction Touch:PathNode(px:Int, py:Int)If Not nodeList Or nodeList.Count()=0 Then Return Null'loop all nodes and return if we are insideFor Local this:PathNode=Eachin nodeListIf this.Distance(px,py)<PATHNODE_RADIUSReturn thisEndifNextReturn NullEndFunction RemoveIntersectingNodes(x1:Int, y1:Int, x2:Int, y2:Int)If Not nodeList Then ReturnFor Local this:PathNode=Eachin nodeList'if line is intersecting the nodeIf DistanceToLineSegment( x1, y1, x2, y2, this.x, this.y ) <= PATHNODE_RADIUS'find all linked nodes to this oneFor Local link : PathLink = Eachin this.linked'loop all of their links and remove link to thisLocal testNode : PathNode = link.linkedNodeFor Local rLink : PathLink = Eachin testNode.linkedIf rLink.linkedNode = thistestNode.linked.RemoveEach( rLink )ExitEndifNextNext'remove the nodethis.nodeId.Remove()EndifNextEndFunction RemoveIntersectingLinks(x1:Int, y1:Int, x2:Int, y2:Int)If Not nodeList Then Return'cycle all nodesFor Local this:PathNode=Eachin nodeList'cycle all linksFor Local link:PathLink=Eachin this.linked'if the line intersects the linkIf Intersect(x1,y1,x2,y2,this.x,this.y,link.linkedNode.x,link.linkedNode.y )'remove the linkthis.linked.RemoveEach( link )'check and remove link from other nodeFor Local rLink:PathLink=Eachin link.linkedNode.linkedIf rLink.linkedNode=thislink.linkedNode.linked.RemoveEach(rLink)ExitEndifNextEndifNextNextEndEnd' 2D math functions by Jasu'http://blitzbasic.com/codearcs/codearcs.php?code=2180Function Intersect:Int(x1:Float, y1:Float, x2:Float, y2:Float, x3:Float, y3:Float, x4:Float, y4:Float)' This Function returns True If lines x1,y1,x2,y2 And x3,y3,x4,y4 intersect at some point.Return (Orientation(x1, y1, x2, y2, x3, y3) <> Orientation(x1, y1, x2, y2, x4, y4)) And (Orientation(x3, y3, x4, y4, x1, y1) <> Orientation(x3, y3, x4, y4, x2, y2))EndFunction Orientation:Int(x1:Float,y1:Float, x2:Float,y2:Float, Px:Float,Py:Float)' Linear determinant of the 3 points.' This Function returns the orientation of px,py on line x1,y1,x2,y2.' Look from x2,y2 To the direction of x1,y1.' If px,py is on the right, Function returns +1' If px,py is on the left, Function returns -1' If px,py is directly ahead Or behind, Function returns 0Return Sgn((x2-x1)*(Py-y1)-(Px-x1)*(y2-y1))EndFunction DistanceToLineSegment:Float(x1:Float, y1:Float, x2:Float, y2:Float, Px:Float, Py:Float)' This Function calculates the distance between a line segment And a point.' So this Function is useful To determine If line intersects a circle.' To also determine the point on the line x1,y1,x2,y2 which is the closest To px,py , use Function NearestPointInLine#Local Dx : FloatLocal Dy : FloatLocal Ratio : FloatIf (x1 = x2) And (y1 = y2) ThenReturn Sqrt( (Px-x1)*(Px-x1)+(Py-y1)*(Py-y1) )ElseDx = x2 - x1Dy = y2 - y1Ratio = ((Px - x1) * Dx + (Py - y1) * Dy) / (Dx * Dx + Dy * Dy)If Ratio < 0 ThenReturn Sqrt( (Px-x1)*(Px-x1)+(Py-y1)*(Py-y1) )Elseif Ratio > 1 ThenReturn Sqrt( (Px-x2)*(Px-x2)+(Py-y2)*(Py-y2) )ElseReturn Sqrt((Px - ((1 - Ratio) * x1 + Ratio * x2))*(Px - ((1 - Ratio) * x1 + Ratio * x2))+(Py - ((1 - Ratio) * y1 + Ratio * y2))*(Py - ((1 - Ratio) * y1 + Ratio * y2)))EndifEndifEndI’ve managed to get images from a theme using “skins”.
They’re automatically loaded once the theme is applied.Monkey1myImage=App.Theme.GetStyle("YourStyle").Skin.ImageIn the theme file you’ll have to add something like:
Monkey1"YourStyle":{"skin":"some_image.png"},Don’t forget that it needs to go under “styles”:{ in the theme file and the image has to be in the “themes” folder!
I’ll try to do overriding font from IDE next time.
And will update smooth theme, I miss it.
Great!
It doesn’t detect local at all yet! But I plan to do that one time.
That explains a lot! heh
On a similar topic…
I just noticed that when I start to type “Mouse” I no longer see the standard “Mouse” class in the auto-complete list.
Same with “JsonObject” it seems, and “WindowFlags” and “Keyboard” etc.
Did something change, is this intended? (I don’t often update Ted2Go)
I think that if I were new to Monkey 2 I’d be pretty confused about it. (even more so!)Also, an idea I had!
You can hide the console with the Escape key, which I often do.
When you run your app the console comes back and shows you print messages and such, which is fine.
But I’d really like if the console hid itself again after the app closes, so I don’t have to press Escape every time.
A minor thing, not very important.Yes! I understand a Theme being able to “suggest” a font, but the user should be able to override it.
Yeah exactly.
And especially without having to edit the theme itself, which will be overwritten each update anyways.Every time Ted2Go is updated, I go through the code and change the keyboard shortcuts to the “normal” shortcuts.
I put the project view on the left.
And I edit the themes to use the Robot font.“hezkore: Ctrl/Cmd+W is a typical way to close windows on non-Windows systems, but in Windows the typical shortcut is Ctrl+F4
”
@nobuyuki I said close “tabs” not windows
Most apps in Windows (and Mac etc.) uses Ctrl+W to close tabs, even web browsers use it.“@hezkore Tell me how the dot completion to interfere you. I can move it into options. And notify me if you complete icons pack.
”
@nerobot The auto-complete is not always correct, sometimes it doesn’t detect my Locals.
So when I for example want to access the fields in my Local called “proc”, Ted2Go instead auto-corrects it to “Property” whenever I type “proc.”, which gets annoying.“I started with Hezcore’s theme, but ended up extending Default Ted because I wanted the monospaced fonts.”
@Ethernutt Yeah about that hehe…When I made the Smooth theme, the monospaced font was bugged (not drawn correctly, overlapping text etc.).
That seems to have been fixed a bit, and did I update the theme to use the default monospaced font, but it seems like Mark never updated it.
I’ve posted the updated Smooth theme in this thread too: http://monkey2.monkey-x.com/forums/topic/ted2go-fork/page/12/#post-7209
I hope nerobot adds it.The theme font wouldn’t even be an issue if the font could be selected from within the IDE.
-
AuthorPosts