Thursday, May 24, 2012

FarseerPhysicsXNA, just getting things to work.

So almost all of their documentation on codeplex.com refer to version 2.0, and using 3.0 a lot of functions seem to have been changed. Also, they forgot that a part of a release is documentation, so imo, they're far from done.

DebugView, why doesnt debugview work?
oh because their example refers to their sample project. Which would be great, if I had started with their project.

So now i have to either incorporate my project into their project or take parts of their overly complex sample project and incorporate it into mine.

Damnit.

Monday, May 14, 2012

xna file updates in windows phone 7.1

getting models to load into the content
So i managed to get the model into the phone at least once, but from there on out when I update the fbx the model doesn't get updated. Having this issue is pretty annoying. Even more awkward, if I load in a different model, nothing is displayed at all, but the load function doesn't error. So what's going on? Is the model too big, too small, not enough documentation on how the fbx should be setup for me to figure out what's wrong with the model.
so

Debug.WriteLine("mesh info>> " + ball.Meshes.Count.ToString());

tells me that

mesh info>> 0

So even more annoying is that Visual Studio doesn't always like to re-process the model into it's xnb when the file is updated. I think it's deciding that the fbx's time stamp hasn't changed enough for it to bother. Annoying so i have to use an A and B to keep switching between the two so it'll pick a different file altogether to load to force it to load the model as a new model.

So it's running fine, I'm just finding that visual studio has a bad habbit of ignoring file updates when building the xnb files from the fbx files. annoying to say the least.

Interestingly enough though a primitive that's 1000 units across seems to be about the correct size to take up most of the center of the screen on the phone. 100 units is a small object on the screen. but my camera was 5000 units away, moving it to about 1000 units away from the origin made a big difference but the object is also a bit more distorted with perspective.

In anycase, if you're having issues with models updating then try changing the name of the file you're loading. seems like the file doesn't always update. when the fbx is changed.

Friday, May 11, 2012

2D and 3D content in XNA


Drawing layers of 2D and 3D content in XNA on the Windows Phone.


private void OnDraw(object sender, GameTimerEventArgs e)
{
SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

spriteBatch.Begin();
spriteBatch.Draw(background, mainFrame, Color.White);
elementRenderer.Render();
spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);
spriteBatch.End();


Draw3DContent();

spriteBatch.Begin();
spriteBatch.Draw(cursorImage(), cursorPos, Color.White);
spriteBatch.End();
}


So this is a modified versuion of some code that i came to when drawing 2d stuff and 3d sutff using silverlight and xna for both 2d and 3d elements. The first chunk is going to be a begin and end for the background and some UI elements that are drawn in silverlight. then I have another function that has all of the 3d elements each chunk ending in mesh.Draw();
the last bit is to draw a silverlight cursor using xna sprite stuff since the cursor is animated and has several states.


I wasn't able to find an example of this anywhere so im posting it here.

Tuesday, May 1, 2012

generics and types

So today I came across

And to be honest, I have no idea what T really was. I assumed it had to do with typecasting, but wasn't sure exactly how it was used here. So it seems like it's a "name" and not a keyword, which is good since it's just a letter. But still, it seems like it's something that I needed to learn a bit more about. 

Looking into my C# book I find a section on Generics which seems promising. My book says something about Generics offering better static typing, but from my past experience static typing just makes using variables more strict. I hate putting limitations on how easily i can use a letter or number.

Both of these things infer that you need to add
using System.Collections.Generic and possibly System.LINQ, but I commented the two statements, and the code still compiles fine with the <T> in the function. Not sure why that is since it's inferring that <T> is something that comes out of one of those two references. Am I missing something? why is this working without those two references?

public Diddly something<Diddly>(Diddly someValue)
{
Diddly squat;
squat = someValue;
return squat;
}

why, exactly, is that chunk of code valid C#? I'm not completely clear as to how Diddly is used and why squat can be Diddly. This all seems a bit weird to me. I'll have to experiment with that it all means. Microsoft says to use <T> and not <Diddly> just out of using standards, but to me T is no more descriptive than Diddly. I suppose they're trying to say that it's a T for Type, but why not just use <GenericType> instead of <T> for the sake of being descriptive or expressive as people like to say about C# and F# and the other # languages.
Adding in a debug line i get this...
So T is a string. a string type of string, which i'd imagine it should be. But why the <T> ?
So what if i turn all of the Ts into string?


This gives me this error and it tells me it doesn't like types as identifiers. So, that tells me that C# is actually looking at all of the instances of the T as a variable of some kind. But why? how are all of these things being used?
Visual studio has a helper that would like to tell me that to fix this the first place where T should be it's asking:
If it would like the T to be a class or type, but it just said it didn't want types. Either way, neither of those generated objects were valid.


This is confusing though, somehow this is valid? Why? <int> and <string> what are these and how do they work? Thought I was trying to learn something today, instead so far I'm just getting confused.




email sucks.

Oops
so i managed to forget that i still have an old email account. it's on my old server okita.com and it's really neglected. basically, it's rendered itself useless. And it's impossible to get the server to sort through the files so i can even clear out the in box.
I'm trying to get their tech support to clear the server's files for me.

rxokita's shared items