TGC Codebase Backup



Program_Button_Menues. by Klas Wullt

23rd Jul 2012 17:18
Summary

Full simple main c++ for a basic and flexible program creating a meny with buttons and room for creating conditions.



Description

The program requires
#include "game_timer.h"

#include "box_button.h"
#include "page_class.h"

What it does, is creating two lists of menues,
one that add or remove a button to the other.

Change your own button sprites,
got to b 6X 8.
Write your conditions into.
void update_button_conditions






Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    #pragma once
#include <stdio.h>
#include "DarkGDK.h"
#include "game_timer.h"

#include "box_button.h"
#include "page_class.h"

   



void update_button_conditions();

int b;


page_class M;
page_class N;
page_class* current_page;




void DarkGDK ( void )
{
int image_id=1;
dbCreateAnimatedSprite(9,"Kclick2.png",6,8,9);
image_id++;


box_type_data sgn;
sgn.images[1]=1;
sgn.images[2]=2;
sgn.images[3]=3;
sgn.images[4]=4;
sgn.images[5]=5;
sgn.images[6]=6;
sgn.images[7]=7;
sgn.images[8]=8;
sgn.images[9]=9;


current_page=&M;
// 




M.generate(8,sgn);

N.dynamic_generate(8,sgn);
N.open();
M.open();
M.update();

N.d_update();





	while ( LoopGDK ( ) )
	{

		
dbPrint(double(b));


M.update();

N.d_update();



update_button_conditions();

dbSync ( );

		
	}

	return;
}











void update_button_conditions()
{

int a1;
// summarize effects linked to buttons all over the programs
// the effects have access to all the classes and headers
// this list could be huge


if(current_page->click_number!=0 )
{
a1=current_page->click_number;





if(a1==1)
{
N.d_delete();
b++;
}

if(a1==2)
{
N.d_add(¤t_page->box[2]);
b++;
}

}



       


}