Ok - here it is...
Image - NOTE: If the LENGTH bothers anyone, let me know and I'll make it "VIEW BUTTON" only.
/*============================================================================
| _________ _______ _______ ______ _______ Jegas, LLC |
| /___ ___// _____/ / _____/ / __ / / _____/ [email protected] |
| / / / /__ / / ___ / /_/ / / /____ |
| / / / ____/ / / / / / __ / /____ / |
|____/ / / /___ / /__/ / / / / / _____/ / |
/_____/ /______/ /______/ /_/ /_/ /______/ |
| Under the Hood |
==============================================================================
Copyright(c)2008 Jegas, LLC
============================================================================*/
#include <DarkGDK.h>
#include "jgc_configuration.h"
#include "jfc_common.h"
#include "jgc_common.h"
#include "jgc_pixelgrid.h"
//============================================================================
//============================================================================
//============================================================================
//============================================================================
//============================================================================
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
using namespace JFC;
//----------------------------------------------------------------------------
void DarkGDK ( void ){
//----------------------------------------------------------------------------
// Init the JGC Library
JGC::Daddy = new JGC_DADDY();
JGC::Daddy->Init();
// Make Backdrop Dark Green so you recognize it. WON'T use same color in
// pixel grid drawing so you can tell what is see through!
dbBackdropColor(dbRGB(0,60,0));
JGC_PIXELGRID *pg = new JGC_PIXELGRID();
// Prepare your Canvas
pg->Size_Set(600,600);
// Pixel Grid Allows Full Red, Green, Blue, and Alpha Channel Access
// Check this out!
// Ok - showing you something here. pvt_Width is a value that most coders
// would make PRIVATE. I even indicate that this thing SHOULD at least be
// treated as private. Why don't I have a function to return canvas height?
// I DO: pg->Height_Get()
// So why use this pvt_Height thing? Because accessing the value directly
// is faster than calling a function. If this was some business application
// I'd do things differently for security, but game development, this clock
// cycle saving trick (implemented into JGC everywhere) is perfect!
// Now not all variables are public, but ones that are advantageous to be
// for speed reasons - usually are set up this way in the JGC lib.
//
// Note: Certain responsibility comes with this underhanded clock cycle saving
// technique though! These vaules should be treated as READ ONLY!
// If you have funky bugs that you aren't sure about, switch to using the
// safe functions instead like: pg->Height_Get()
for(int x=0; x < pg->pvt_Width; x=x+50){
// Normal Line - all channels - Alpha SET to FULL VISIBLE when PixelGrid Made.
pg->Line(0,x,x,pg->pvt_Height-1,dbRGB(255,255,255));
// Parameters: x1,y1, x2,y2, RGBColor
// Line in only the Red channel
pg->LineR(0,x+10,x+10,pg->pvt_Height-1,255);
// Parameters: x1,y1, x2,y2, RedColor
// Line in only the Green channel
pg->LineG(0,x+20,x+20,pg->pvt_Height-1,255);
// Parameters: x1,y1, x2,y2, GreenColor
// Line in only the Blue channel
pg->LineB(0,x+30,x+30,pg->pvt_Height-1,255);
// Parameters: x1,y1, x2,y2, BlueColor
// Line in only the Alpha channel (We'll make invisible line LOL)
// HINT: Those Aren't DARK GREEN Lines on the SCREEN! They are HOLES!
pg->LineA(0,x+40,x+40,pg->pvt_Height-1,0);
// Parameters: x1,y1, x2,y2, AlphaLevel
};
// How about a couple of boxes done the same way? (Not filled in Variety)
pg->Box(300,50, 350,500,dbRGB(255,255,255));//normal (RGB channels all written too
pg->BoxR(310,60,360,510,255);//red
pg->BoxG(320,70,370,520,255);//green
pg->BoxB(340,80,380,530,255);//blue
pg->BoxA(350,90,390,540, 0 );//alpha.. let's punch a hole!
// Ok.. same thing but we Specify OUTLINE AND INSIDE color (Filled In Variety)
// Gonna make the outlines BRIGHT and insides darker you you can see how it
// works B^)
pg->Box(400,50,450,500,dbRGB(255,255,255),dbRGB(100,100,100));//normal (RGB channels all written too
pg->BoxR(410,60,460,510,255,120);//red
pg->BoxG(420,70,470,520,255,120);//green
pg->BoxB(440,80,480,530,255,120);//blue
pg->BoxA(450,90,490,540, 0,120 );//alpha.. let's punch a hole...sorta ;)
//There are also FOUR fill routines but they FILL the WHOLE channel (or all)
//with specified values.
// There is Cut and Paste but I think I'll save that for another demo.
// There CURRENTLY is not CIRCLE or FLOODFILL functions, but I'll get to
// them sooner or later.
// Now we need code so you can see the results.
JGC_IMAGE *img = pg->MakeImageFromThis();
JGC_SPRITE *spr=new JGC_SPRITE();
int xCentered = (JGC::Display->Width_Get() - img->Width_Get()) / 2;
int yCentered = (JGC::Display->Height_Get() - img->Height_Get()) / 2;
spr->Sprite(xCentered,yCentered,img->ID);
// BEGIN ----------------------- Main Loop
while ( LoopGDK ( ) ){
// Handles Physics Stuff
// Getting clock Info
// GUI Stuff if in use
// Basic User Input for some specific keys and Mouse
// Oh yeah... dbSync() call also! :)
JGC::Daddy->Update();
if(JGC::UserInput->KeyDown_PgDn){
JGC::Cam0->Backdrop_Set(false);
dbCLS();
};
// BEGIN -----------------DISPLAY SOME INFO ON SCREEN---------------------
// Show Frame Rates and Poly Count.
JGC::Display->CursorPos_Set(0,0);// dbSetCursor(p_X, p_Y) is easier
dbPrint("PAGE DOWN=Backdrop Off Temporarily");
JGC::Display->PrintFPS();
// JFC::CHAR1K is a 1024 byte char buffer I REUSE all the time for
// things like this sprintf call.
sprintf(JFC::CHAR1K,"Poly: %i",dbStatistic(1)); dbPrint(JFC::CHAR1K);
if(JGC::Cam0->Backdrop_Get()){
dbPrint("Backdrop Currently ON");
}else{
dbPrint("Backdrop Currently OFF");
};
// END -----------------DISPLAY SOME INFO ON SCREEN---------------------
};
// END ----------------------- Main Loop
};
//----------------------------------------------------------------------------
Is this helpful?
--Jason
[edit]You know what's baffling... When I turn Backdrop OFF after its been ON... it only stays off for one or two dbSYNC cycles... (Look at the Status text for the BACKDROP.. see how it says "Temporarily" - there in lies the anomally. I originally coded a toggle but it wouldn't stick.) in the pics. I searched the ENTIRE lib source code for where there might be some hidden dbBackDropOn() call.. but THERE isn't one - I'm 100% Certain. I won't bother issuing a bug though because I'm not using the new DarkGDK beta... so chances are when TGC gets some other issues resolved .. namely mesh manipulation in memblocks) this issue will have already been resolved. Must remember this odd ball behavior...
At least the PixelGrid is working perfectly!

--Jason
[/edit]