Creating an XNA project for both Windows and XBOX platforms

23 07 2008

This week I’ve started a new XNA project and I had some troubles trying to configure the solution with Visual Studio, until I figured out how easy it was.

The point was creating a single solution with both Windows and XBOX projects on it. I also want a single shared folder for the sources.

I started creating a blank solution.




Then I added both XBOX and Windows projects to the solution.




To create a shared folder for sources I had to create a folder in the solution.

Then I added the sources contained in that solution folder in both projects as a link.




If you need to add additional files to the sources folder you must add them in the solution folder, and then add them to both projects always as a link.




And that’s all. :mrgreen:




Building an arcade cabinet from scratch

18 07 2008

One of my current projects consists in building and old arcade cabinet entirely from scratch.

This would be a long process. I am planning to buy wood panels and cut them off to form the cabinet based on the blueprints I am finishing off.

I have the controls already ordered at Ultimarc, and I am currently preparing the computer I’m going to bundle inside the cabinet.

I have also a 21” CRT TV happily waiting to be dismantled and connected to the cabinet :-)

For running roms I’m using Mame, of course, apart of some other good emulators for Sega and Nintendo game consoles.

Paired with Mame I’m using Mamewah, which is a Mame front-end that let you browse your rom list with the arcade controls, rather than with a keyboard and a mouse. It let you use other emulators as well, so we can select any rom, from any emulator we have installed, without leaving Mamewah.

In the following posts I will be explaining each step of the construction of the cabinet.

Wish me luck :mrgreen:




Dependency injection between two local EJBs with Netbeans

7 07 2008

This a simple tutorial about how to create a local dependecy injection within two EJBs 3.0.

The point is creating one EJB that calls a method from another local EJB with Netbeans and Glassfish.

Start Netbeans and create a new EJB project called Util and add a new session bean to it. Make it stateless and local.



@Local
public interface UtilLocal
{
    int returnInt();
}

@Stateless
public class UtilBean implements UtilLocal
{
    public int returnSomething()
    {
        return 0;
    }
}


Now create a second EJB project called Main and add a new session bean to it, like in the Util EJB. Include the Util EJB inside the Main EJB project.



@Local
public interface MainLocal
{
    int doSomeLogic();
}

@Stateless
public class MainBean implements MainLocal
{
    @EJB(beanName="UtilBean")
    UtilLocal utilEJB;

    public int doSomeLogic()
    {
        return utilEJB.returnSomething();
    }
}


Note that we use @EJB to instantiate the Util EJB object.


Simple yet effective :mrgreen:




J2ME Game Template

24 06 2008

Some time ago I decided to write a simple template to facilitate the task of creating a new J2ME project.

The template is a Netbeans project that can be used as a base to build a J2ME game or application. It is ready to build projects for MIDP 1 and MIDP 2 as well as specific versions for Nokia. This can be achieved by changing simple processor directives.

The template has one thread to run the main loop. Inside this loop, the input and the screen are automatically updated in each frame.

It also has some input functions and code to detect if the device supports double buffering or not. In case it doesn’t the template manages double buffering for you.

The main functions are in MainCanvas class:


private final static void MAIN_Render(Graphics g)

private final static void MAIN_Loop()

private final static boolean INP_KeyDown(int key)

private final static boolean INP_AnyKeyDown()

private final static boolean INP_KeyPress(int key)

private final static boolean INP_AnyKeyPress()

The first two functions are where you are going to put your render and logic code. The template first calls MAIN_Loop, for your logic code, and then it calls MAIN_Render, where you draw whatever you want.

The input functions are provided for detecting if a key is down or whether it has been pressed within the last frame.

The template comes with an example of its use so you can test it and hack it as much as you may want to.

You can download the template from here­.




Warming up

19 06 2008

The site is almost ready.

It still needs some work to do and some sections need to be filled out but my new site is getting almost done :-)

In a few days I will begin with my new XNA project called Spin (working title).

More news to come. Stay tuned!!




There is always a first time

7 06 2008

Hola!

Here it is. Day Zero. The first post of my shiny new website.

This is going to be the start of a long journey, so fasten your seat belts and enjoy the ride.