• Advertisement
Sign in to follow this  

Vivid

This topic is 4329 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, I'm working on a DirectX engine called Vivid. It's at a really early stage (v.001 lol) but the whole idea is to make it as easy as possible for n00bs to get used to game programming, and old-timers to make a world-class game without having to deal with all the low-level crap. So far, it's just got basic DirectInput support (mouse and keyboard only), and basic mesh stuff. X file loading only. Download the app at http://www.freewebs.com/t3hn00b/vivid/VividApp Release.zip in case you really feel motivated to test it for bugs. This is what it'll look like if you download it: What I'm really asking is if the engine is easy enough to use. I'm not going to post the entire engine code, just what the user would have to type to get it to work (it's all one file). I want to know if you guys think it's too restrictive, too low-level, or whatever. It doesn't really matter at this stage, but I'm going to be planning the whole engine with this type of programming in mind.
#include "vivid/vivid.h"
#include "vivid/renderer.h"

bool CheckInputs();
int fillMode = 0;

int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE prevInstance, 
				   PSTR cmdLine,
				   int showCmd)
{
	vvd::OpenLog("VividApp.log");
	if(!vvd::Init(hInstance, 1024, 768, "VividApp", false)) {
		exit(1);
	}
	vvd::Log("VividApp is up and running!");

	Renderer renderer;

	renderer.SetCameraPosition(10.0f, 10.0f, -10.0f);
	renderer.SetBackgroundColor(0xFFFFFF);
	renderer.CameraLookAt(0.0f, 0.0f, 0.0f);

	Mesh mesh("bigship1.x");

	vvd::SetMinKeyPressTime(DIK_F, 0.25f);

	while(true) {
		vvd::Update();

		if(!CheckInputs())
			break;

		switch(fillMode) {
		case 0:
			renderer.SetFillMode(D3DFILL_SOLID);
			break;
		case 1:
			renderer.SetFillMode(D3DFILL_WIREFRAME);
			break;
		case 2:
			renderer.SetFillMode(D3DFILL_POINT);
			break;
		}

		mesh.transform.AddRotation(0.0f, vvd::mouseDX() * 0.004f, 0.0f);
		mesh.transform.AddRotation(vvd::mouseDY() * 0.004f, 0.0f, 0.0f);
		mesh.transform.AddRotation(0.0f, 0.0f, vvd::mouseDZ() * 0.001f);

		renderer.Draw();

		MSG msg;
		if(!::PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
			if(msg.message == WM_QUIT) {
				vvd::Log("Recieved quit message from windows; exiting message loop...");
				break;
			}
			::TranslateMessage(&msg);
			::DispatchMessage(&msg);
		}
	}
	vvd::DeInit();
	exit(0);
	return 0;
}
bool CheckInputs() {
	if(vvd::keyDown(DIK_ESCAPE)) {
		vvd::Log("User pressed escape; exiting message loop...");
		return false;
	}
	if(vvd::keyDown(DIK_F)) {
		vvd::Log("Switched fill mode");
		fillMode++;
		if(fillMode > 2) {
			fillMode = 0;
		}
	}
	return true;
}


So that's it. You can guess pretty well what each call to the "vvd" namespace means; they're pretty intuitive. Oh, and I've got three tutorials so far that walk the user through the steps to make this application. If you guys end up wanting to see them, I'll post them. [grin] [Edited by - evanofsky on April 19, 2006 7:51:27 AM]

Share this post


Link to post
Share on other sites
Advertisement
I didn't try to run it or anything, but from the code you posted, it looks clean and simple to me :)

Share this post


Link to post
Share on other sites
Changed the link to text.

Next I'm working on implementing vertex/pixel shaders. When I'm done, the user should be able to write a vertex shader, a pixel shader, and a material file, and Vivid will put it all together. The idea is that the material file fills any attributes needed by the VS/PS, like a base texture, bump texture, specular, etc. That way, the user can reuse a VS/PS pair for several different materials.

Share this post


Link to post
Share on other sites
May want to change the name, I've released both a 3d engien and a 2d net engine under the name Vivid. (VividGL 3D and Vivid.2D.Net respectively)

I'm not saying I care, just a heads up to any possible confusion.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement