ZioRed Posted November 4, 2010 Share Posted November 4, 2010 Here is a simple scene loading and a text printed at top-left corner, just drop inside its folder Leadwerks.dll, engine.dll, newton.dll, shaders.pak and the Scripts folder from your SDK. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Anton Boroda Posted November 4, 2010 Share Posted November 4, 2010 Here is a simple scene loading and a text printed at top-left corner, just drop inside its folder Leadwerks.dll, engine.dll, newton.dll, shaders.pak and the Scripts folder from your SDK. Yep, it DOES NOT work. So its a bug with headers + russian windows (the most most credible variant). I will try to find some english windows 7 to test and confirm this (cant confirm on net-book, leadwerks doesn't run on it). Any header devs want to look into this? It's really urgent for me (and any C# devs in general, because if one will publish his product it wont run on rus win7) Quote Link to comment Share on other sites More sharing options...
Anton Boroda Posted November 5, 2010 Share Posted November 5, 2010 Ok, i found what is causing the error (still not fixed it) public static Vector3 Parse(string s) { string[] values = s.Split(','); return new Vector3(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2])); } its the return ... line. Will debug more now. Ok, problem found. Its something to do with delimiters. My regional settings have "," as a float value delimiter. I've set it to "." and it works (at least loading scene, draw text still doesn't work). I will try to find a universal workaround for this. Quote Link to comment Share on other sites More sharing options...
Anton Boroda Posted November 5, 2010 Share Posted November 5, 2010 Solution found. Vector3.cs find public static Vector3 Parse(string s) { string[] values = s.Split(','); return new Vector3(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2])); } replace with public static Vector3 Parse(string s) { string[] values = s.Split(','); float val0; float val1; float val2; float.TryParse(values[0], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out val0); float.TryParse(values[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out val1); float.TryParse(values[2], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out val2); return new Vector3(val1, val1, val2); } Works with any regional code. "," and "." tested and working. Should be fine with any other. Quote Link to comment Share on other sites More sharing options...
Anton Boroda Posted November 5, 2010 Share Posted November 5, 2010 Now looking into Draw. I'm not very familiar with dll import but still this look strange: [DllImport(EngineDll, EntryPoint = "DrawText", CallingConvention = CallingConvention.StdCall)] public static extern void DrawText(string text, int x, int y); When docs say there should be DrawText(int x, int y, string text), but it still doesn't work when corrected. Maybe it has something to do with c_str() pointer (does it need to be passed in dllimport calls?)? Also i get "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." exception when trying to run Draw.Text("text", 1, 1) or any other x,y specified with "fixed code". Without specified coords it starts fine (but text is still not shown) Quote Link to comment Share on other sites More sharing options...
Bill Posted November 5, 2010 Share Posted November 5, 2010 I'm not very familiar with dll import but still this look strange: [DllImport(EngineDll, EntryPoint = "DrawText", CallingConvention = CallingConvention.StdCall)] public static extern void DrawText(string text, int x, int y); I can only speak to the code above - glancing at it, it looks fine to me. I can't help you with the other part of your message. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted November 5, 2010 Share Posted November 5, 2010 When docs say there should be DrawText(int x, int y, string text) If you open engine.cpp you will see that the inline function DrawText calls leDrawText(buffer, x, y), that is the real function called (you can see at EntityPosition too as example). Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Anton Boroda Posted November 6, 2010 Share Posted November 6, 2010 If you open engine.cpp you will see that the inline function DrawText calls leDrawText(buffer, x, y), that is the real function called (you can see at EntityPosition too as example). Yep, then the problem has to be with something else. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.