Jump to content

LoadScene


Rekindled Phoenix
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...