Forum Replies Created
- 
		AuthorPosts
 - 
		
			
				
I did managed to convert that example:
[/crayon]Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165[crayon-5cba9748a06d2494671633 inline="true" ]Import "<std>"Using std..Global MD5_x:Int[]'MD5 for BlitzMax'Derived from Craig Kiesau's BlitzBasic MD5 function'Derived from the RSA Data Security, Inc. MD5 Message-Digest AlgorithmFunction MD5:String(sMessage:String)Local i:Int'Pads the String as per the MD5 standardLocal nblk:Int = ((sMessage.Length + 8) Shr 6) + 1 'number of 16-word blocksLocal MD5_x := New Int[(nblk * 16)]'Zero pad the StringFor i = 0 To nblk * 16 - 1MD5_x[i] = 0Next'Convert To array of "words"For i = 0 To (sMessage.Length - 1)MD5_x[(i Shr 2)] = MD5_x[(i Shr 2)] | (sMessage[i + 1] Shl ((i Mod 4) * 8))NextMD5_x[(i Shr 2)] = MD5_x[(i Shr 2)] | (128 Shl (((i) Mod 4) * 8))MD5_x[nblk * 16 - 2] = (sMessage.Length) * 8'Set initial valuesLocal MD5_a:Int = 1732584193 '&H67452301Local MD5_b:Int = -271733879 '&HEFCDAB89Local MD5_c:Int = -1732584194 '&H98BADCFELocal MD5_d:Int = 271733878 '&H10325476'Loop through the wordsFor Local k:Int = 0 To (nblk * 16 - 1) Step 16Local MD5_AA:Int = MD5_aLocal MD5_BB:Int = MD5_bLocal MD5_CC:Int = MD5_cLocal MD5_DD:Int = MD5_d'Round 1MD5_a = MD5_FF(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 0], 7, -680876936) '&HD76AA478MD5_d = MD5_FF(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 1], 12, -389564586) '&HE8C7B756MD5_c = MD5_FF(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 2], 17, 606105819 )'&H242070DBMD5_b = MD5_FF(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 3], 22, -1044525330) '&HC1BDCEEEMD5_a = MD5_FF(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 4], 7, -176418897) '&HF57C0FAFMD5_d = MD5_FF(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 5], 12, 1200080426 )'&H4787C62AMD5_c = MD5_FF(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 6], 17, -1473231341) '&HA8304613MD5_b = MD5_FF(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 7], 22, -45705983) '&HFD469501MD5_a = MD5_FF(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 8], 7, 1770035416) '&H698098D8MD5_d = MD5_FF(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 9], 12, -1958414417 )'&H8B44F7AFMD5_c = MD5_FF(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 10], 17, -42063 )'&HFFFF5BB1MD5_b = MD5_FF(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 11], 22, -1990404162) '&H895CD7BEMD5_a = MD5_FF(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 12], 7, 1804603682) '&H6B901122MD5_d = MD5_FF(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 13], 12, -40341101) '&HFD987193MD5_c = MD5_FF(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 14], 17, -1502002290) '&HA679438EMD5_b = MD5_FF(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 15], 22, 1236535329) '&H49B40821'Round 2MD5_a = MD5_GG(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 1], 5, -165796510) '&HF61E2562MD5_d = MD5_GG(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 6], 9, -1069501632) '&HC040B340MD5_c = MD5_GG(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 11], 14, 643717713) '&H265E5A51MD5_b = MD5_GG(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 0], 20, -373897302) '&HE9B6C7AAMD5_a = MD5_GG(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 5], 5, -701558691) '&HD62F105DMD5_d = MD5_GG(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 10], 9, 38016083) '&H2441453MD5_c = MD5_GG(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 15], 14, -660478335) '&HD8A1E681MD5_b = MD5_GG(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 4], 20, -405537848) '&HE7D3FBC8MD5_a = MD5_GG(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 9], 5, 568446438) '&H21E1CDE6MD5_d = MD5_GG(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 14], 9, -1019803690) '&HC33707D6MD5_c = MD5_GG(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 3], 14, -187363961) '&HF4D50D87MD5_b = MD5_GG(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 8], 20, 1163531501) '&H455A14EDMD5_a = MD5_GG(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 13], 5, -1444681467) '&HA9E3E905MD5_d = MD5_GG(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 2], 9, -51403784) '&HFCEFA3F8MD5_c = MD5_GG(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 7], 14, 1735328473) '&H676F02D9MD5_b = MD5_GG(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 12], 20, -1926607734) '&H8D2A4C8A'Round 3MD5_a = MD5_HH(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 5], 4, -378558) '&HFFFA3942MD5_d = MD5_HH(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 8], 11, -2022574463) '&H8771F681MD5_c = MD5_HH(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 11], 16, 1839030562) '&H6D9D6122MD5_b = MD5_HH(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 14], 23, -35309556) '&HFDE5380CMD5_a = MD5_HH(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 1], 4, -1530992060) '&HA4BEEA44MD5_d = MD5_HH(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 4], 11, 1272893353) '&H4BDECFA9MD5_c = MD5_HH(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 7], 16, -155497632) '&HF6BB4B60MD5_b = MD5_HH(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 10], 23, -1094730640) '&HBEBFBC70MD5_a = MD5_HH(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 13], 4, 681279174) '&H289B7EC6MD5_d = MD5_HH(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 0], 11, -358537222) '&HEAA127FAMD5_c = MD5_HH(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 3], 16, -722521979) '&HD4EF3085MD5_b = MD5_HH(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 6], 23, 76029189) '&H4881D05MD5_a = MD5_HH(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 9], 4, -640364487) '&HD9D4D039MD5_d = MD5_HH(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 12], 11, -421815835) '&HE6DB99E5MD5_c = MD5_HH(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 15], 16, 530742520) '&H1FA27CF8MD5_b = MD5_HH(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 2], 23, -995338651) '&HC4AC5665'Round 4MD5_a = MD5_II(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 0], 6, -198630844) '&HF4292244MD5_d = MD5_II(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 7], 10, 1126891415) '&H432AFF97MD5_c = MD5_II(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 14], 15, -1416354905) '&HAB9423A7MD5_b = MD5_II(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 5], 21, -57434055) '&HFC93A039MD5_a = MD5_II(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 12], 6, 1700485571) '&H655B59C3MD5_d = MD5_II(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 3], 10, -1894986606) '&H8F0CCC92MD5_c = MD5_II(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 10], 15, -1051523) '&HFFEFF47DMD5_b = MD5_II(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 1], 21, -2054922799) '&H85845DD1MD5_a = MD5_II(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 8], 6, 1873313359) '&H6FA87E4FMD5_d = MD5_II(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 15], 10, -30611744) '&HFE2CE6E0MD5_c = MD5_II(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 6], 15, -1560198380 )'&HA3014314MD5_b = MD5_II(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 13], 21, 1309151649) '&H4E0811A1MD5_a = MD5_II(MD5_a, MD5_b, MD5_c, MD5_d, MD5_x[k + 4], 6, -145523070) '&HF7537E82MD5_d = MD5_II(MD5_d, MD5_a, MD5_b, MD5_c, MD5_x[k + 11], 10, -1120210379) '&HBD3AF235MD5_c = MD5_II(MD5_c, MD5_d, MD5_a, MD5_b, MD5_x[k + 2], 15, 718787259) '&H2AD7D2BBMD5_b = MD5_II(MD5_b, MD5_c, MD5_d, MD5_a, MD5_x[k + 9], 21, -343485551) '&HEB86D391MD5_a = MD5_a + MD5_AAMD5_b = MD5_b + MD5_BBMD5_c = MD5_c + MD5_CCMD5_d = MD5_d + MD5_DDNextReturn (WordToHex(MD5_a) + WordToHex(MD5_b) + WordToHex(MD5_c) + WordToHex(MD5_d)).ToUpper()End FunctionFunction MD5_F:Int(x:Int, y:Int, z:Int)Return ((x & y) | (~(x) & z))End FunctionFunction MD5_G:Int(x:Int, y:Int, z:Int)Return ((x & z) | (y & (~(z))))End FunctionFunction MD5_H:Int(x:Int, y:Int, z:Int)Return (x ~ y ~ z)End FunctionFunction MD5_I:Int(x:Int, y:Int, z:Int)Return (y ~ (x | (~z)))End FunctionFunction MD5_FF:Int(a:Int, b:Int, c:Int, d:Int, x:Int, s:Int, ac:Int)a = (a + ((MD5_F(b, c, d)+ x)+ ac))a = RotateLeft(a, s)Return a + bEnd FunctionFunction MD5_GG:Int(a:Int, b:Int, c:Int, d:Int, x:Int, s:Int, ac:Int)a = (a + ((MD5_G(b, c, d) + x) + ac))a = RotateLeft(a, s)Return a + bEnd FunctionFunction MD5_HH:Int(a:Int, b:Int, c:Int, d:Int, x:Int, s:Int, ac:Int)a = (a + ((MD5_H(b, c, d) + x) + ac))a = RotateLeft(a, s)Return a + bEnd FunctionFunction MD5_II:Int(a:Int, b:Int, c:Int, d:Int, x:Int, s:Int, ac:Int)a = (a + ((MD5_I(b, c, d) + x) + ac))a = RotateLeft(a, s)Return a + bEnd FunctionFunction RotateLeft:Int(lValue:Int, iShiftBits:Int)Return (lValue Shl iShiftBits) | (lValue Shr (32 - iShiftBits))End FunctionFunction WordToHex:String(lValue:Int)Local returnString:StringreturnString = ULongToString(lValue,16)Return returnString.Slice(6,8) + returnString.Slice(4,6) + returnString.Slice(2,4) + returnString.Slice(0,2)End FunctionI was trying to convert the first link example(http://wasted.nz/codearcs.php?code=1449)but apparently the slice function doesn’t work with non strings:
[/crayon]Monkey12345678[crayon-5cba9748a06e2802878507 inline="true" ]Function Main()Local a:Int[] = New Int[](9,8,7,6,5,4,3,2,1)Local b := a.Slice(2,2)Print b.LengthPrint b[0]+" "+b[1]End Functionthis gives me an error. “Index out of Range”.
that’s the only thing that stops me from finishing it.
I am getting the same error Mark. It’s the same as what I posted in my previous post. That’s with your newest modification.
I think the root of the problem is that we are using the newest Emscripten(1.37.9) vs the version that Mark seems to be using (1.35.0). When I had 1.35.0 I didn’t have that problem.
I haven’t used Emscripten since posting the issue. I was waiting for it to become more stable with the language. I no longer have the itch.io version. I am using the development version. But even that give me errors:
Parsing…
Semanting…
Translating…
Compiling…
Build error: System command failed:emcc -c -std=gnu99 -s USE_SDL=2 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=1 -O3 -DNDEBUG -I”/Users/jesse/monkey2/modules/” -I”/Users/jesse/monkey2/modules/monkey/native” -o “/Users/jesse/monkey2/modules/opengl/opengl.buildv1.1.09/emscripten_release/build/_1_1_1native_2bbopengl.c.o” “/Users/jesse/monkey2/modules/opengl/native/bbopengl.c”
/Users/jesse/monkey2/modules/opengl/native/bbopengl.c:41:20: error: implicit declaration of function ‘SDL_GL_ExtensionSupported’ is invalid in C99 [-Werror,-Wimplicit-function-declaration]
BBGL_draw_buffers=SDL_GL_ExtensionSupported( “GL_WEBGL_draw_buffers” );
^
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting***** Fatal mx2cc error *****
Internal mx2cc build error
Update modules failed.
Total time elapsed: 3 m 44 s.I’ll try the itch.io and report back.
[edit]
I did try the Itch.io version but it gives me this errors:
Mx2cc version 1.1.08
***** Building app ‘/Applications/Monkey2-v1.1.08/bananas/particles/particles.monkey2′ *****
Parsing…
Semanting…
Translating…
Compiling…
Linking /Applications/Monkey2-v1.1.08/bananas/particles/particles.products/Emscripten/Particles.js…
Build error: System command ’em++ -s USE_SDL=2 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=1 -O2 –preload-file “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/assets/@/assets” -s BINARYEN=1 -s BINARYEN_TRAP_MODE=’allow’ -o “/Applications/Monkey2-v1.1.08/bananas/particles/particles.products/Emscripten/Particles.js” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2mojo_2mojo.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2std_2std.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2stb_5vorbis_2stb_5vorbis.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2stb_5image_5write_2stb_5image_5write.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2stb_5image_2stb_5image.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2miniz_2miniz.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2sdl2_2sdl2.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2jni_2jni.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2openal_2openal.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2gles20_2gles20.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2libc_2libc.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2freetype_2freetype.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2emscripten_2emscripten.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2monkey_2monkey.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/particles_0particles.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/particles_0monkey_0math.cpp.o” “/Applications/Monkey2-v1.1.08/modules/mojo/mojo.buildv1.1.08/emscripten_debug/mojo.a” “/Applications/Monkey2-v1.1.08/modules/std/std.buildv1.1.08/emscripten_debug/std.a” “/Applications/Monkey2-v1.1.08/modules/stb-vorbis/stb-vorbis.buildv1.1.08/emscripten_debug/stb-vorbis.a” “/Applications/Monkey2-v1.1.08/modules/stb-image-write/stb-image-write.buildv1.1.08/emscripten_debug/stb-image-write.a” “/Applications/Monkey2-v1.1.08/modules/stb-image/stb-image.buildv1.1.08/emscripten_debug/stb-image.a” “/Applications/Monkey2-v1.1.08/modules/miniz/miniz.buildv1.1.08/emscripten_debug/miniz.a” “/Applications/Monkey2-v1.1.08/modules/sdl2/sdl2.buildv1.1.08/emscripten_debug/sdl2.a” “/Applications/Monkey2-v1.1.08/modules/jni/jni.buildv1.1.08/emscripten_debug/jni.a” “/Applications/Monkey2-v1.1.08/modules/openal/openal.buildv1.1.08/emscripten_debug/openal.a” “/Applications/Monkey2-v1.1.08/modules/gles20/gles20.buildv1.1.08/emscripten_debug/gles20.a” “/Applications/Monkey2-v1.1.08/modules/libc/libc.buildv1.1.08/emscripten_debug/libc.a” “/Applications/Monkey2-v1.1.08/modules/freetype/freetype.buildv1.1.08/emscripten_debug/freetype.a” “/Applications/Monkey2-v1.1.08/modules/emscripten/emscripten.buildv1.1.08/emscripten_debug/emscripten.a” “/Applications/Monkey2-v1.1.08/modules/monkey/monkey.buildv1.1.08/emscripten_debug/monkey.a” ‘ failed.em++ -s USE_SDL=2 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=1 -O2 –preload-file “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/assets/@/assets” -s BINARYEN=1 -s BINARYEN_TRAP_MODE=’allow’ -o “/Applications/Monkey2-v1.1.08/bananas/particles/particles.products/Emscripten/Particles.js” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2mojo_2mojo.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2std_2std.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2stb_5vorbis_2stb_5vorbis.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2stb_5image_5write_2stb_5image_5write.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2stb_5image_2stb_5image.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2miniz_2miniz.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2sdl2_2sdl2.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2jni_2jni.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2openal_2openal.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2gles20_2gles20.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2libc_2libc.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2freetype_2freetype.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2emscripten_2emscripten.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/_1_1_1_1_1modules_2monkey_2monkey.buildv1.1.08_2emscripten_0debug_2include_2_0r.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/particles_0particles.cpp.o” “/Applications/Monkey2-v1.1.08/bananas/particles/particles.buildv1.1.08/emscripten_debug/build/particles_0monkey_0math.cpp.o” “/Applications/Monkey2-v1.1.08/modules/mojo/mojo.buildv1.1.08/emscripten_debug/mojo.a” “/Applications/Monkey2-v1.1.08/modules/std/std.buildv1.1.08/emscripten_debug/std.a” “/Applications/Monkey2-v1.1.08/modules/stb-vorbis/stb-vorbis.buildv1.1.08/emscripten_debug/stb-vorbis.a” “/Applications/Monkey2-v1.1.08/modules/stb-image-write/stb-image-write.buildv1.1.08/emscripten_debug/stb-image-write.a” “/Applications/Monkey2-v1.1.08/modules/stb-image/stb-image.buildv1.1.08/emscripten_debug/stb-image.a” “/Applications/Monkey2-v1.1.08/modules/miniz/miniz.buildv1.1.08/emscripten_debug/miniz.a” “/Applications/Monkey2-v1.1.08/modules/sdl2/sdl2.buildv1.1.08/emscripten_debug/sdl2.a” “/Applications/Monkey2-v1.1.08/modules/jni/jni.buildv1.1.08/emscripten_debug/jni.a” “/Applications/Monkey2-v1.1.08/modules/openal/openal.buildv1.1.08/emscripten_debug/openal.a” “/Applications/Monkey2-v1.1.08/modules/gles20/gles20.buildv1.1.08/emscripten_debug/gles20.a” “/Applications/Monkey2-v1.1.08/modules/libc/libc.buildv1.1.08/emscripten_debug/libc.a” “/Applications/Monkey2-v1.1.08/modules/freetype/freetype.buildv1.1.08/emscripten_debug/freetype.a” “/Applications/Monkey2-v1.1.08/modules/emscripten/emscripten.buildv1.1.08/emscripten_debug/emscripten.a” “/Applications/Monkey2-v1.1.08/modules/monkey/monkey.buildv1.1.08/emscripten_debug/monkey.a”
Traceback (most recent call last):
File “/Users/jesse/emsdk/emscripten/1.37.9/em++”, line 16, in <module>
emcc.run()
File “/Users/jesse/emsdk/emscripten/1.37.9/emcc.py”, line 1033, in run
exec ‘shared.Settings.’ + key + ‘ = ‘ + value in globals(), locals()
File “<string>”, line 1, in <module>
NameError: name ‘allow’ is not defined***** Fatal mx2cc error *****
Internal mx2cc build error
I am using emsdk 1.37.9
Thanks, I have been playing around with the code, I can get the examples as they are in the book, and I can modify the code in the GLSL editor and get different results but I am having problems converting the code to Monkey2. I will keep trying but any help would really be appreciated.
Yea, I got kind of lazy and was just doing some quick modifications because of the results I was getting. I am sure you can figure out the proper way to do it. Basically the problem was in the rotation formula.
[/crayon]Monkey1234[crayon-5cba9748bc7c5741073975 inline="true" ]Local gunPosX:Float = ofx * Cos(-r+Pi/2) - ofy * Sin(-r+Pi/2) '********************Local gunPosY:Float = ofx * Sin(-r+Pi/2) + ofy * Cos(-r+Pi/2) '********************you didn’t have offy on the second line you had ofx on both sides of the formula.
Also, you forgot to add the position(x,y) of the bullet to the direction(dx,dy). about the -Pi/2, the Pi/2 is what you started off in the sprite. I am not sure I can explain it to you but you start with the sprite “Field r:Float = Pi/2” and then your RotationDisplay has an offset angle of 90 degrees. so thats why the adjustment of -Pi/2, at least that’s what I got out of it.[EDIT]
This is more like it:
[/crayon]Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175[crayon-5cba9748bc7cb862604546 inline="true" ]Namespace myapp#Import "<std>"#Import "<mojo>"Using std..Using mojo..Const Size:=New Vec2i( 640,480 )Class MyWindow Extends WindowConst FPS:Int = 60Field player:PlayerField timer:TimerMethod New()Super.New( "My Window",640,480,WindowFlags.Resizable )ClearColor = Color.BlackLayout="letterbox"player = New Player(100, 100)timer = New Timer(FPS, OnUpdate)EndMethod OnRender( canvas:Canvas ) Overrideplayer.Render(canvas)Bullet.RenderAll(canvas)EndMethod OnUpdate()RequestRender()player.Update()Bullet.UpdateAll()EndMethod OnMeasure:Vec2i() OverrideReturn SizeEndEndClass SpriteField x:FloatField y:FloatField r:Float = 0Field sizeW:FloatField sizeH:FloatField colour:ColorField velocity:Vec2f = New Vec2f(0, 0)EndClass Player Extends SpriteMethod New(x:Float ,y:Float)Self.x = xSelf.y = ySelf.sizeW = 100Self.sizeH = 50Self.colour = Color.GreenEndMethod Render(canvas:Canvas )canvas.Color = Self.colourLocal matrix:=canvas.Matrixcanvas.Matrix=matrix.Translate( x ,y ).Rotate( r)canvas.DrawRect(- sizeW / 2.0, - sizeH / 2.0, sizeW, sizeH)canvas.Color = Color.Bluecanvas.DrawRect(-5, -5, 10, 10)canvas.Color = Color.Redcanvas.DrawRect((sizeW/2)-10, (sizeH/2)-10, 10, 10)canvas.Matrix=matrixcanvas.DrawText("r = " +r, 0, 0)EndMethod Update()Local s:Float = 2Local am:Float = 0.08Local factor:Float = 1.5If Keyboard.KeyDown(Key.W)velocity.x += (1 * factor - velocity.x) * amElseif Keyboard.KeyDown(Key.S)velocity.x += (-1 * factor - velocity.x) * amElsevelocity.x *= .99EndIf Keyboard.KeyDown(Key.A)r += .1EndIf Keyboard.KeyDown(Key.D)r -= .1Endx += velocity.xIf Keyboard.KeyHit(Key.Space)New Bullet(x, y, r)EndEndEndClass Bullet Extends SpriteGlobal list := New List<Bullet>Field timeToLive:IntField speed:Float = 5Method New(x:Float, y: Float, r:Float)Self.x = xSelf.y = ySelf.r = -rLocal ofx:Int = 50Local ofy:Int = 25Local gunPosX:Float = ofx * Cos(-r) - ofy * Sin(-r) '********************Local gunPosY:Float = ofx * Sin(-r) + ofy * Cos(-r) '********************Self.x = x+gunPosXSelf.y = y+gunPosYSelf.timeToLive = 20Self.sizeW = 40Self.sizeH = 15Self.colour = Color.RedSelf.list.AddLast(Self)EndFunction UpdateAll()If Not list ReturnLocal it := list.All()While Not it.AtEndLocal b:Bullet = it.Currentb.Update()If b.timeToLive <= 0it.Erase()Elseit.Bump()EndEndEndMethod Update()Local dx:Float = Sin(-r+Pi/2) * speed '************************Local dy:Float = Cos(-r+Pi/2) * speed '************************x += dxy += dytimeToLive -= 1EndFunction RenderAll:Void(canvas:Canvas)If Not list ReturnFor Local c:Bullet = Eachin listc.Render(canvas)NextEndMethod Render(canvas:Canvas)canvas.Color = Self.colourLocal matrix:=canvas.Matrixcanvas.Matrix=matrix.Translate( x,y ).Rotate(-r)canvas.DrawOval(- sizeW / 2.0, - sizeH / 2.0, sizeW, sizeH)canvas.Color = Color.Bluecanvas.DrawRect(-5, -5, 10, 10)canvas.Matrix=matrixEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()Endstill have to do the Pi/2 to the shoot direction. but this time its because its shooting 90 degrees from the direction it was created.
Is this what you wanted?
I marked everything I modified.
the rotation formula was wrong.[/crayon]Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178[crayon-5cba9748c6541826607280 inline="true" ]Namespace myapp#Import "<std>"#Import "<mojo>"Using std..Using mojo..Const Size:=New Vec2i( 640,480 )Class MyWindow Extends WindowConst FPS:Int = 60Field player:PlayerField timer:TimerMethod New()Super.New( "My Window",640,480,WindowFlags.Resizable )ClearColor = Color.BlackLayout="letterbox"player = New Player(100, 100)timer = New Timer(FPS, OnUpdate)EndMethod OnRender( canvas:Canvas ) Overrideplayer.Render(canvas)Bullet.RenderAll(canvas)EndMethod OnUpdate()RequestRender()player.Update()Bullet.UpdateAll()EndMethod OnMeasure:Vec2i() OverrideReturn SizeEndEndClass SpriteField x:FloatField y:FloatField r:Float = Pi / 2Field sizeW:FloatField sizeH:FloatField colour:ColorField velocity:Vec2f = New Vec2f(0, 0)Property RotationDisplay:Float()Return r - Pi / 2EndEndClass Player Extends SpriteMethod New(x:Float ,y:Float)Self.x = xSelf.y = ySelf.sizeW = 100Self.sizeH = 50Self.colour = Color.GreenEndMethod Render(canvas:Canvas )canvas.Color = Self.colourLocal matrix:=canvas.Matrixcanvas.Matrix=matrix.Translate( x ,y ).Rotate( RotationDisplay )canvas.DrawRect(- sizeW / 2.0, - sizeH / 2.0, sizeW, sizeH)canvas.Color = Color.Bluecanvas.DrawRect(-5, -5, 10, 10)canvas.Color = Color.Redcanvas.DrawRect((sizeW/2)-10, (sizeH/2)-10, 10, 10)canvas.Matrix=matrixcanvas.DrawText("r = " +r, 0, 0)EndMethod Update()Local s:Float = 2Local am:Float = 0.08Local factor:Float = 1.5If Keyboard.KeyDown(Key.W)velocity.x += (1 * factor - velocity.x) * amElseif Keyboard.KeyDown(Key.S)velocity.x += (-1 * factor - velocity.x) * amElsevelocity.x *= .99EndIf Keyboard.KeyDown(Key.A)r += .1EndIf Keyboard.KeyDown(Key.D)r -= .1Endx += velocity.xIf Keyboard.KeyHit(Key.Space)New Bullet(x, y, r)EndEndEndClass Bullet Extends SpriteGlobal list := New List<Bullet>Field timeToLive:IntField speed:Float = 5Method New(x:Float, y: Float, r:Float)Self.x = xSelf.y = ySelf.r = -rLocal ofx:Int = 50 '**************************Local ofy:Int = 25 '**************************Local gunPosX:Float = ofx * Cos(-r+Pi/2) - ofy * Sin(-r+Pi/2) '********************Local gunPosY:Float = ofx * Sin(-r+Pi/2) + ofy * Cos(-r+Pi/2) '********************Self.x = x+gunPosX ' ********************Self.y = y+gunPosY ' ********************Self.timeToLive = 20Self.sizeW = 40Self.sizeH = 15Self.colour = Color.RedSelf.list.AddLast(Self)EndFunction UpdateAll()If Not list ReturnLocal it := list.All()While Not it.AtEndLocal b:Bullet = it.Currentb.Update()If b.timeToLive <= 0it.Erase()Elseit.Bump()EndEndEndMethod Update()Local dx:Float = Sin(-r) * speed '************************Local dy:Float = Cos(-r) * speed '************************x += dxy += dytimeToLive -= 1EndFunction RenderAll:Void(canvas:Canvas)If Not list ReturnFor Local c:Bullet = Eachin listc.Render(canvas)NextEndMethod Render(canvas:Canvas)canvas.Color = Self.colourLocal matrix:=canvas.Matrixcanvas.Matrix=matrix.Translate( x,y ).Rotate( -RotationDisplay ) '****************************canvas.DrawOval(- sizeW / 2.0, - sizeH / 2.0, sizeW, sizeH)canvas.Color = Color.Bluecanvas.DrawRect(-5, -5, 10, 10)canvas.Matrix=matrixEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndPoor soul, Had to come here to spread his poison. I think we are all immune to it.
gcmartijn made a png 2 poly module. It’s in the modules section. I have not tried so I don’t know if it’s any good.
maybe it helps???Hi afecelis,
Did you follow the instructions on the README.TXT file( no guarantee it will work but it’s a start)?
Make sure your dependancies are installed and the paths set correctly.
Also make sure your antivirus is not detecting it as a virus. There have been reports lately of that happening.Most of that may not apply as you are probably using the itch.io download but the antivirus is a possibility.
here is the link to the binary:
https://www.dropbox.com/s/24ws94xn2r46dqe/Bunnymark.zip?dl=0I did cheat. I wasn’t going to press the mouse button until I reached the 10.000 bunnies so I changed the arrays size to 10,000 to start with. LOL.
[Edit]
What version of Monkey2 are you using?
Hi Abe, Welcome to the forum.
interesting results!
Have you tried running it in release mode?I get 10,000 at a steady 62 frames a second in release mode.
and 3,000 at a steady 62 frames a second in debug mode.
2013 MacBook Air 1.7Ghz.Personally, I think thats pretty good.
A question: Why are you determining what language/Engine to use based on the speed of the graphics output?
programming languages are relatively important to what your needs are. Now a day most languages can compile code to its ultimate speed. But even if they don’t most languages can produce results that are above what the program requires for output.
Even now at the speed at which these languages run they can not perform at the required speed that some programmers need for required output. So some sacrifices and ingenious thinking need to take place to resolve those limitations. In other words, no matter how much power and how optimized the computer language is, it will not meet all of the requirements by the average programmer. An experience programmer in a specific computer language will understand the limitations of the language and will try to optimize his thinking to the limitations of the output(executing program).
if you know several languages you can probably determine which language produces the fastest output but many not be necessary to determine if the program runs efficiently in either computer language. In my opinion the language speed is not as important as the familiarity with the computer language and the ability of the programmer to produce results.
> “How do I write efficient code whilst it being simple to understand for humans?”
You don’t. You write code for you to understand it and for other “programmers” to have a try at understanding it. That’s why there is such a thing as documentation. programmers in theory will understand the basic concept if you make the logic simple and give explanation in step by step what every line does in you code. But that doesn’t mean that they will automatically be able solve any errors with in, or can go and duplicate you program on their own. the best advice I think I can give you is to keep you functions, methods, variable and other things as properly named and documented as possible.so if other programmers are familiar with the concept can get an idea of what it’s about and can possibly even modify and debug the code.
Also, I feel that there is no need to change languages if what you are doing with the language serves your purpose and you can properly function as efficiently as possible with the limitations of such a language. I know some programmers have dropped a computer language that they have been learning for years because something is not being implemented that they in theory think it’s essential while never producing anything that really needs it. I call that a serious waste of time. whether it’s Java, C/CPP, C#, BlitzMax etc.. It doesn’t matter what language you choose, what matters is what you can do with it and how you use it. The only times I feel any one should move to another language is when the language is abandoned by the author and there is no hope for it and/or will be outdated sooner or later and or when it’s not keeping up with the continually changing technology and of course while trying something and finding that you like it better while being practical.
I think that anybody that is going to write an application and/or game should start writing it now. Not one, two or three year from now when they have build a data base of code or a master library to use for their application/game. because if you think that that is going to make it a lot easier to write your game, you are sadly mistaken. codebase and libraries are maybe about 5 to 10 percent of the application/game and most of the time not the hardest thing either.
I say start writing your game or application, get familiar with the language as you write it. Do a lot of research including asking questions to more experienced programmers so that when you finish it you will have that much more experience with it and possibly be that much easier to write the next game.
Just my 2 cents, opinions whatever.
I get that error on my Mac OS X. with Monkey2 1.1.07. from itch.io
October 21, 2017 at 2:25 am in reply to: Is Mark pulling the plug on Monkey2? Worrying comments on Twitter #11243As I see it, most of us here are not really business skilled and most don’t own a business or have a business income. so our opinion can’t really be used as a reliable source. And even those that have a business, their formula isn’t a fit all solution.
There are many things that I can tell you you did wrong but 1) it’s just my opinion and since I am not a business expert so it’s not worth much and 2) it’s all just water under the bridge. Nothing can be done now. I suspect deep below you know what you did and are doing wrong. but the condition you are in doesn’t leave you many options to follow. I know I have been there and I am still trying to get out of the swamp waters I got myself into.
I read the opinions of others here and think that some make sense while others are just blah, blah, blah.
I think the main problem here is lack of trust in people. With all my respect to you Mark, I see it reflected in your work and your personality based what you post here. Again, same thing with me. it’s easy to say it but so hard to do the actual change.
Anyway Mark, good luck, I’ll be here for as long as I can. backing you up. wishing you stick around for many more years. I think Monkey2 is a great language. I just wish you had the confidence and trust in others to help you bring it to what I think this language can be. GREAT!!!!
PS
What we need now is some good Marketing and great documentation.Ops Had to say it!
Being that the language is so new and not thoroughly tested, Can you just create some test to determine what is faster?
I suspect that DrawRect is faster than Drawing a bitmap since each pixel is not scanned for color content.
I usually don’t test to see which is faster but just test if what I am doing is fast enough for my purpose. if it is, I stick with it else I find an alternative if possible.
On my game that I am making “Mission patrol” I use DrawPoly and is fast enough to draw all of the backgrounds of the game so I never bother to test if drawing images is faster.
 - 
		AuthorPosts