Forum Replies Created
-
AuthorPosts
-
I think I’m onto something. x’D
I’ve at least converted the strings to wchar_t.
Monkey1234567891011121314151617181920212223242526272829303132333435363738Namespace myapp#Import "<std>"#Import "libcore"#Import "textfile.txt"Using std..Using libc..Function Main()Local path:String = "textfile.txt"Local mode:String = "w"Local pathBuf:DataBuffer = New DataBuffer(path.Length*2)Local modeBuf:DataBuffer = New DataBuffer(1)path.ToWString( pathBuf.Data, path.Length*2)mode.ToWString( modeBuf.Data, mode.Length*2)Local path_w:wchar_t Ptr = Cast<wchar_t Ptr>(pathBuf.Data)Local mode_w:wchar_t Ptr = Cast<wchar_t Ptr>(modeBuf.Data)For Local pi := 0 Until pathBuf.LengthPrint pathBuf.PeekString(pi)NextPrint modeBuf.PeekString(0)Local file := _wfopen(path_w, mode_w)If(file = Null) Then Print "Failed"Print "Finished."End(Libc)ore.monkey2
Monkey12345Namespace libcExternFunction _wfopen:FILE Ptr( path:wchar_t Ptr,mode:wchar_t Ptr )Not sure if this works as it’s coded. It’s kinda hacky and probably doesn’t work. Lol. Almost there… Darn.
There is a trade off that’s inherent to programming languages, which is the sacrifice of speed and power for a more fluent language, fit for humans. Monkey isn’t *just* another BASIC based language as it has *a lot* of flexibility; at least much more than most other BASIC-like languages I’ve encountered. It’s a sweet spot between fluency and power IMO which is fantastic. A bit more of a learning curve compared to others, however it’s worth the extra mile.
Anything to prevent me from touching C. x’D
Didn’t know it was based on DataBuffer. xD Interesting.
Go Monkey!On Android I think an SD card is under a mounted device file. Since it’s based on the Linux Kernel it should be something
like “/mnt/sdcard” mounted from “/dev/sdb” or “dev/sda”
Saving PNG’s is simple using Pixmap.SetPixel and Pixmap.SaveEdit: Or if you already have a loaded image, you can just use CopyFile
Do you mean to make Files and Directories on Mobile? Or stuff like CHMOD? Or attrib +s +a?
I haven’t tested LoadString("..") on a mobile device myself yet but it should work just fine.
If for some reason not, maybe look into Local MyDataBuff := DataBuffer.Load("file path") then use MyDataBuff.PokeString and MyDataBuff.PeekStringto write/read the data to the Buffer. And called MyDataBuff.Save("file path")
iOS and Android file paths should follow the POSIX’y file system hierarchy so “/tmp” or “/bin” is the in root directory.
For Windows the root directory is “C:/”For file attributes/permissions you’d need to impliment chmod() or _chmod in the libc.monkey2 module.
Wonderful! Very useful indeed.
I think a *bit* more professionalism needs to be implemented into the website(in terms of design) before making a big move like that IMO. But I’m totally on board with a Steam Release +1. It’s a great distribution and advertising method. It wouldn’t hurt for sure. Though I think there’s a fee for that now right?
Yes, linux works great for me, but there’ll be a few dependencies you’ll need. I can’t name them off-the-top of my Head.
Oops yep, Pixmap. My bad. Awesome! I don’t really see how that would be an issue as long as a
MaterialSet() .Material = bleh
and MaterialCopy:Material()
Functions exists at some point.Monkey is really fast. Way faster than (excluding optimized libs) Python and a bit faster than Java from my very limited testing in the past. Very nice work Mr Sibly.
Yeah I saw the Image.Window function but I had no idea what it did exactly. xD
I guess it clips a section of an Image like an Atlas.
Does is pass by value, ptr, or just out-right makes a copied section of referenced atlas?Oh the complications of scope. xD
What about Self.Ptr? Dereference it to get the Object.Do you mean the time from which said track/sound started playing?
Cuz I do that via Millisecs() from a Sound Extension. Start a virtual timer from x.Play()
Then stop the timer from x.Pause()/Stop()
Idk, maybe I don’t understand the question. Aha.1.1.08!
1.1.08!
1.1.08!Sorry got excited for Open Source there for a blitz.
Yes, that 64bit idea would be great for heavy data, especially in intense games. I hear memory mapping is a thing but that seems a bit too advanced. Thank you!
EDIT: Now that I think about it, I think that’s why ‘#Define’ came into the picture for C if I’m not mistaken. So you could using the same source code and generate two different Binaries based on not only the architecture, but in a host of scenarios when building.
Ahh, makes sense. Just checking. Thanks for the reply! Hope things are well. 1.1.08 is looking flyyy.
Most of everything here is going great from my perspective.
I’ve built things for Win/Linux/Android way easier than I ever could without Monkey.
All that needs work is the module documentation, specifically the details are really vague.
MX1’s documentation was fantastic! I’m sure way more people will jump on board if they have a more detailed
‘cheat sheet’ so-to-speak.
Maybe add a Learn/Tutorials topic in the forums too?
I think the goal is to make Monkey more approachable for both new programmers and those new to MX2.
Website CSS revamp anyone? The content in the ‘About’ page is amazing though should be extended further.#UsingMX2InTheUSA:)
-
AuthorPosts