Jump to content
  • entries
    707
  • comments
    1173
  • views
    436317

Untitled

Sign in to follow this  
Programmer16

88 views

Ok, expanding on my progress yesterday.


Dragon Forge Technology

I have to say, I'm REALLY happy with the way this is turning out. It's got great functionality, easy to comprehend (well, for me anyway lol; I'll have to get some testers when I'm finished), and it works pretty good.

Yesterday brought about a quick rewrite of the input system. I switched to class-event-based system (easier to add new values and it matches the rest of the engine's design) as well as adding drag events. Now, anything that derives from BaseMessageHandler can receive drag and drop events by overriding 4 methods:

bool OnDragStart(const DragStartEvent &Event) { return false; }
bool OnDragUpdate(const DragEvent &Event) { return false; }
bool OnDragEnd(const DragEndEvent &Event) { return false; }
void GetDragDataAt(const Point &CursorPosition, void **Data, int &DataType) { Data = 0; }

+ DragStartEvents are fired after the user clicks and drags (left-mouse button only) the cursor 4 pixels in either direction (so that a click doesn't automatically start a drag event.)
+ DragEvents are fired after a DragStartEvent has fired; and is fired for every WM_MOUSEMOVE event afterwards.
+ DragEndEvents are fired after the user releases the left mouse-button.
+ GetDragDataAt() is used to pass the item being dragged around.

Err, that's kind of misleading. Every class that derives from BaseMessageHandler doesn't inheritantly get events. They have to be used with EventHandlerDelegate and a WNDPROC.


The HTML log is completely finished. The only thing I've added since before is the new tasking system. You can start a task using StartTask(text, type); and then any calls to LogDebugOutput() that follow will be indented (nested tasks work correctly; each new task increases the task level which adds more tabs.) Then, when the task is finished you call FinishTask(succeeded?, extra text);

If you want to see an example, here's a link.
And the code that generated it (old code; I've modified it slightly since):

dft::HtmlLog::StartSection("Graphics Setup");
dft::HtmlLog::StartTask("Attempting to create Hardware graphics device...", dft::HtmlLog::MessageTypes::Text);
dft::HtmlLog::StartTask("Detecting Pixel Shader Version", dft::HtmlLog::MessageTypes::Text);
dft::HtmlLog::LogDebugOutput("Pixel Shader Version 2.0 unsupported.", dft::HtmlLog::MessageTypes::Error);
dft::HtmlLog::LogDebugOutput("Pixel Shader Version 1.4 unsupported.", dft::HtmlLog::MessageTypes::Error);
dft::HtmlLog::LogDebugOutput("Pixel Shader Version 1.2 supported.", dft::HtmlLog::MessageTypes::Text);
dft::HtmlLog::FinishTask(true);
dft::HtmlLog::FinishTask(true);

dft::HtmlLog::StartSection("Loading");
dft::HtmlLog::StartTask("Attempting to load \"%s\"...", dft::HtmlLog::MessageTypes::Text, "SomeMap.map");
dft::HtmlLog::FinishTask(false);





I also started working on the base of the GUI; not much done at the moment.


Here's a quick example application that uses my engine in it's current state:

#include
#include "dftDebugging.h"
#include "dftString.h"
#include "dftConfigReader.h"
#include "dftMath.h"
#include "dftGraphics.h"
#include "dftSystems.h"
#include "dftEngine.h"
#include "dftTypes.h"
#include
#include "MalykAI.h"
#include "tinyxml.h"
#include "dftAnimation2D.h"
#include "dftSideScroller.h"
#include "dftXmlHelper.h"
#include "dftInput.h"
#include
#include

class DragTesting : public dft::Systems::BaseGame
{
public:
D3DXMATRIX ProjectionMatrix;
dft::Rectangle SelectionRect;
bool DrawSelectionRect;

DragTesting() : BaseGame("Drag Testing"), DrawSelectionRect(false){}
~DragTesting(){}

bool Initialize()
{
D3DXMatrixIdentity(&ProjectionMatrix);
D3DXMatrixOrthoOffCenterLH(&ProjectionMatrix, 0, 800.0f, 600.0f, 0, 0.0f, 100.0f);
ParentEngine->GfxDevice.SetTransform(D3DTS_PROJECTION, &ProjectionMatrix);

ParentEngine->GfxDevice.SetRenderState(D3DRS_LIGHTING, FALSE);
ParentEngine->GfxDevice.SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
ParentEngine->GfxDevice.SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
ParentEngine->GfxDevice.SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
ParentEngine->ClearColor = dft::Graphics::Color::FromRgb(0, 0, 0);
return true;
}

void Update(float Seconds)
{
}

void Frame()
{
if(DrawSelectionRect)
{
dft::Graphics::ColoredVertex Vertices[6];
dft::Graphics::ColoredVertex::FillQuadTriList(Vertices, dft::Vector3((float)SelectionRect.Left, (float)SelectionRect.Top, 0.0f), SelectionRect.Width(false), SelectionRect.Height(false), dft::Graphics::Color::FromRgb(0, 255, 0));
ParentEngine->GfxDevice.SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
ParentEngine->GfxDevice.SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
ParentEngine->GfxDevice.SetFVF(dft::Graphics::ColoredVertex::FVF);
this->ParentEngine->GfxDevice.DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, Vertices, dft::Graphics::ColoredVertex::Size);
ParentEngine->GfxDevice.SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
ParentEngine->GfxDevice.SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
}
}

void CleanUp()
{
}

bool OnKeyDown(const dft::Input::KeyEvent &Event)
{
dft::HtmlLog::LogDebugOutput("%s", dft::HtmlLog::MessageTypes::Text, dft::Input::Keys::ToString(Event.KeyID).c_str());
return false;
}

bool OnKeyUp(const dft::Input::KeyEvent &Event)
{
if(Event.KeyID == dft::Input::Keys::PrintScreen)
{
this->ParentEngine->TakeScreenshot();
return true;
}
return false;
}

bool OnDragStart(const dft::Input::DragStartEvent &Event)
{
DrawSelectionRect = true;
SelectionRect = dft::Rectangle(Event.Position, 0, 0);
return true;
}

bool OnDragUpdate(const dft::Input::DragEvent &Event)
{
SelectionRect.Right = Event.CurrentPosition.X;
SelectionRect.Bottom = Event.CurrentPosition.Y;
return true;
}

bool OnDragEnd(const dft::Input::DragEndEvent &Event)
{
DrawSelectionRect = false;
return true;
}

void GetDragDataAt(const dft::Point &CursorPosition, void **Data, int &DataType)
{
}
};

DragTesting MyGame;

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
dft::HtmlLog::SetUp("debuglog.html", "HTML Log");
dft::Systems::Engine::Access()->Run(&MyGame);
//MyGame.ParentEngine->Run(&MyGame);
// edit 1: omg, I just realized I was running the game twice -_-
// edit 2: I really should look at what I'm doing -_-
}

// Fallback catch blocks
catch(const dft::UnuseableValueException Exception) { Exception.LogToHtmlLog(); dft::Tracing::Dump(); }
catch(const dft::NullPointerException &Exception) { Exception.LogToHtmlLog(); dft::Tracing::Dump(); }
catch(const dft::DivideByZeroException &Exception) { Exception.LogToHtmlLog(); dft::Tracing::Dump(); }
catch(const dft::FileNotFoundException &Exception) { Exception.LogToHtmlLog(); dft::Tracing::Dump(); }
catch(const dft::BadPointerException &Exception) { Exception.LogToHtmlLog(); dft::Tracing::Dump(); }
catch(const dft::ItemFoundException &Exception) { Exception.LogToHtmlLog(); dft::Tracing::Dump(); }
catch(const dft::ItemNotFoundException &Exception) { Exception.LogToHtmlLog(); dft::Tracing::Dump(); }

dft::HtmlLog::Close();
return 0;
}





The Lost City of Malathedra

Can't really expand much on this at the moment. I have to rewrite the map editor and so we've decided that a 3D editor would be much better and more efficient than trying to map 3D coordinates to a 2D grid. Mental visualizing FTL.

So, that's my project for the next little while (Hopefully very little; I need to finish it ASAP.)


Wtf?

So, I found out yesterday that, since my house is out of his jurisdiction, if my step-brother beat the crap out of me it'd just be domestic violence, but if I beat the crap out of him, it'd still be assaulting an officer. Isn't that total crap?

Anyway, I'm off to do my stuff so that I can come back and work on TLCoM's map editor.
Sign in to follow this  


2 Comments


Recommended Comments

"dft::HtmlLog::StartTask("Attempting to load \"%s\"...", dft::HtmlLog::MessageTypes::Text, "SomeMap.map");"

Um, just wondering... Do you use the "..." construct for that function? It just looks a bit suspicious. >_>

Share this comment


Link to comment
Yup, it uses a variable argument setup. I use _vscprintf to calculate the size of the buffer needed.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!