April 7, 2009

Milestone I & II

As I wrote, I'll start a series that tell about the progress of AGE. Each article describes the Milestones in question, sample usage code/script and perhaps some screen shots. Be aware of the fact the first ones will look lame, simple and just are meant for educational purposes only.

Milestone I
Description:
Basic Core functions (Windowing, renderer, wrapper) and Camera projection system.

The "original" AGE is written in C++ using Microsoft® Windows® API and Open Graphics Library (OpenGL). These two API's are split to their own files, so if someone whines about no DX10.1 support, he can write himself by opening the Renderer.cpp and edit the namespace (age::renderer) functions. Same for the OS-specific stuff, Windows API related code is in Window.cpp file, where unrelatedly most other functions are implemented too.

The first milestone was to implement a way to communicate between OS and API without having the user to write ANY API-specific lines and create projection system through so called Cameras.

Put simply, currently you can create simple scene with window and camera by using following code in the main file:

#include "../inc/age.h"

using namespace age;

int main()
{
Driver* d = new Driver();

d->initDriver("Engine!", 640, 480);

ageid camera = d->addCamera();

// Viewport position, viewport size, clip near and far,
// FOV, position, rotation and bg color.
d->getCamera(camera)->set(Vec2s(0,0), Vec2s(150, 150),
Vec2f(0.1, 1000.0), 45.0,
Vec3f(0,0,200), Eul(0,0,0),
Vec4f(0.1, 0.0, 0.2, 1.0));

while(!d->getDone())
{
d->mainLoop();
}

return d->end();
}


The camera "set" function is long, because user sets all camera specific values to it. I could've also set all of them one by one by setPos, setRot, etc. or setProjectionPos and setWorldPos functions that take projection specific values and world positioning specific values respectively.

Milestone II
Description: Input

So in all simplicity, the second milestone is to implement inputting system. Currently I'm on my way to implement and test Xinput gamepad support. I also made (from boredom) structures that include PlayStation, PlayStation 3, Xbox, Xbox 360 and Generic pads. I didn't remember to make one for Wii controller, since it works a bit differently and I'd have to actually use time to find out an SDK for reference.

Input a class so you have to call
input->keys[KEY_A]
to check if 'A' is pressed. I might simplify it even further by merging it into Driver. Who knows.



I didn't include any shots now, since I'm sure everyone can imagine rotating test triangle in a window.

No comments: