XNI 0.5
A major build update was released today, with a version of XNI that was used to submit the second commercial XNI game Dream of Pixels to the App Store.
Changes include:
- iOS 6 and retina support.
- Basic render to texture support (RenderTarget2D).
- Optimized SpriteFont.
- Upgrades to data classes (Vector, Matrix …) with support for NSCoding.
- CADisplayLink option for running the game loop.
- Bug fixes.
You can get it in a normal zipped static library + headers version or (for those that know what this means) as a static framework, courtesy of project’s first contributor, Samo Pajk.
A batch of new student games have reached the App Store :
Anonymous asked: how to install xni to xcode?
XNI 0.4.6
Just a quick update to let you know a new version has been uploaded to the repository.
What’s new:
- Optimized SpriteBatch.
- Game startup procedure without intermediate black screen.
- Blend equation and alpha blending support.
- Lighting fixes and removed some memory leaks.
Anonymous asked: Hi, I've just started using your framework - it's great! I'm struggling to work out how to load content though, say a .X model. Do I need to set the root directory of the ContentManager? And where should the .X file be placed? I've tried to follow your earlier post about loading textures, but it throws an exception that it can't find the file!!
Hey there!
The root directory of the ContentManager is set to / by default, so when you add a .x file to your project (wherever actually) and you set the file to be included in your target, then it should appear under the Build Phases/Copy Bundle Resources step on your target. This should be good to go.
Now, just simply load the file by loading the name without extension - the only thing to watch for, since you’re not specifying the extension is that you don’t name any files the same, but just different extension (table.x and table.png is bad - there’s an overload to specify the extension if you really can’t go around naming it different).
So I’ve added a “table.x” file to my project and included it in the target. Then you have this:
Model *tableModel;
Matrix *tableWorld;
// Loading
tableModel = [[self.game.content load:@"table"] retain];
// Rendering
[tableModel drawWithWorld:tableWorld view:camera.view projection:camera.projection];
One thing to note is that so far only text .x files are supported. So if you open it with TextEdit and see the content, then it’s OK.
A nice answer over at Stack Overflow. If you don’t have time to follow through, here’s the gist:
- Yes to MonoTouch for business, XML, data classes (string manipulation, date manipulation), web services, if you hate C, if you hate memory management (ARC might have changed this now) …
- Also yes to Objective-C if you want to learn iOS inside out, small download size, if it’s fun for you to learn new programming languages …
As always, both have their strengths, and a lot also comes down to your personal style, what kind of code you prefer to write. In the end it has to be fun (or at least bearable) for you to work with. In a business world, the $399 shouldn’t be a problem.
Anonymous asked: This is awesome... So basically a game I just made for windows phone 7 I can port over to ios with easy?? Any special code changes required??
Yes, all of your code needs to be rewritten in Objective-C. :) Until I get Automagical to do that for you (it only works in reverse currently), I suggest looking at ExEn (but it requires MonoTouch which costs money).
Anonymous asked: Hi, Thanks for porting over the XNA libraries to Xcode. I'm just wondering if you have some basic tutorials on how to add touch controls. The XNA stuff i've done always used Keyboard controls and was just wondering how you get touch stuff working in it. Thanks
Touch works exactly the way it does on Windows phone 7. Maybe this helper class of mine will help give you a first hint:
Header:
//
// TouchPanelHelper.h
// Artificial I
//
// Created by Matej Jan on 1.12.10.
// Copyleft 2010 Retronator. Use this at will. :)
//
#import <Foundation/Foundation.h>
#import "Retronator.Xni.Framework.Input.Touch.h"
@interface TouchPanelHelper : GameComponent {
}
+ (TouchCollection*) getState;
@end
Implementation:
//
// TouchPanelHelper.m
// Artificial I
//
// Created by Matej Jan on 1.12.10.
// Copyleft 2010 Retronator. Use this at will. :)
//
#import "TouchPanelHelper.h"
@implementation TouchPanelHelper
static TouchCollection *touches = nil;
+ (void) initialize {
touches = nil;
}
+ (TouchCollection *) getState {
return touches;
}
- (void) updateWithGameTime:(GameTime *)gameTime {
[touches release];
touches = [[TouchPanel getState] retain];
}
- (void) dealloc
{
[touches release];
[super dealloc];
}
@end
Then you just add this TouchHelper to your components in your game’s init:
[self.components addComponent:[[[TouchPanelHelper alloc] initWithGame:self] autorelease]];
From now on you can always get a TouchCollection using the static call getState. Here’s some example code:
TouchCollection *touches = [TouchPanelHelper getState];
for (TouchLocation *touch in touches) {
if (touch.state == TouchLocationStatePressed) {
// use touch.position vector for something
}
}
}
The reason I’ve included this extra game component is that on each getState call to the TouchPanel, the values of Pressed/Move/Released are updated. So if you call getState from more than one place inside the update loop you might get unexpected results.
When dealing with XNI you should always use XNA documentation for a guide on how to use it. For Touch input read more here: Working with Touch Input (Windows Phone)
Anonymous asked: Hi. Did you perhaps port over the GameStateManagement Sample from the XNA Creators Club and would you be interested in sharing it?
No, I did not. I taught a little bit different architecture in my class so I coded that from scratch (well, not really that much code, just a GameState parent class and a stack in your main Game class for pushing/popping states).
Conversion of samples is planned for the next big update of the framework, but that’ll probably start only around Summer. Now we’re making our next Dawn of Play game with XNI as it is to get it out as fast as possible. But then it’ll be way about time to update to full shader architecture, content pipeline and such …
Fuck yeah cornflower blue window and sprite batch on Mac. Codename titled XNM, XNI is getting a version for its older brother.
