Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / [Dark Basic SDK] Manual Sync Commands For Third Party Support

Todd Riggins
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 8th Jan 2011 10:26 Edited at: 8th Jan 2011 10:50
[EDIT 2: Arg, Mabie I should have Dark Basic Pro SDK instead of Dark Basic SDK in the title ]
[EDIT: Note that you will currently have to compile the dark basic sdk with this code yourself to use these commands if needed ]


I didn't want to let this die out on my hard drive as I don't know when I will use it for a project. Also, this isn't something I would necessarily propose to be included into the next Dark Basic Pro's update as these commands have no usefulness to DBPro users alone. But, these commands are aimed at third party dll developers who would like to create their own 3d objects directly with DriectX functions and would like to display them correctly with each camera and be z-sorted along with the other dbpro objects. As for example, I want to create a terrain directly with DirectX functions to build/manipulate the terrain mesh with. These commands will allow me to show the terrain in the dbpro's camera(s) of my choosing and not have to worry about z-sorting.

So, I present the code here for people who know how to set up the Dark Basic SDK and compile it on their machine. If these functions happen to get included in the next DBPro update then all the better( for me at least ). But as with the new PERFFREQ command, I don't have the equivalent dark gdk command code as I don't have dark gdk setup( being lazy ).

New Commands:
MANUAL CAMERA SYNC BEGIN Returns: Current Camera

These four functions are used instead of the SYNC command ( Actually, these four functions were created from dividing up the SYNC command itself into four parts ). First call the MANUAL SYNC BEGIN command with a parameter of 0 or 1 ( 1 to use FastSync ). In this Dark Basic SDK code, the camera numbering starts at 1 instead of 0. So when calling MANUAL CAMERA SYNC BEGIN next, it will return the current camera+1 it's processing for rendering. Just get it's return value and subtract one to get the current camera you want to deal with. After doing what you want to do with this current camera, call MANUAL CAMERA SYNC END. MANUAL CAMERA SYNC END returns a value of 0 or 1. If it returns 1, then there will be another camera that needs to be processed for rendering. Call MANUAL CAMERA SYNC BEGIN again to process it. When MANUAL CAMERA SYNC END returns a 0 then call MANUAL SYNC END to end the whole sync. Short code snippet below shows an example on how I used it in the attached demo:

The attached demo demostrates drawing a triangle mesh directly made with DirectX functions via a little test dll that I made. The two functions in the code below, GMMT INIT and GMMT DRAW 3D OBJECT , are made from the test dll( I have no intentions to release this dll as it is only a test dll. This post isn't intended on how to create a third party dll so I will not include it here ).

Here's what the full DBPro source looks like for this Demo:

A demo is attached so you can see what it does. It will show two cameras, one on top and the other on bottom like a multiplayer type view. My GMMT DRAW 3D OBJECT command draws a triangle made with directx functions from the dll in each window with a dbpro sphere object showing in the center of it. Instructions will be displayed when running the program.

Here is the full c/c++ source code for these manual sync commands.
I added them after the function DARKSDK void ConstantNonDisplayUpdate(void) in the DBDLLCore.cpp file.
If you want to add them in a different place, go for it.

ExoDev.Com - A Game Development Community Website! Featuring: XBOX360 CONTROLLER LIBRARY


Login to view attachments

Login to post a reply

Server time is: 2020-10-28 18:10:25
Your offset time is: 2020-10-28 18:10:25