0.2.0 prep

This commit is contained in:
cozman 2003-06-07 05:50:09 +00:00
parent 57539b3210
commit 69ce38cb2d

View File

@ -7,18 +7,9 @@
The maintainer of this library is James Turk (james@conceptofzero.net)
this library is found at the home of ZEngine http://zengine.sourceforge.net
*******************************************************************************/
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include "ZEngine.h"
#include "GewiEngine.h"
#include "GewiButton.h"
#include "GewiTextButton.h"
#include "GewiWindow.h"
#include "GewiTextField.h"
#include "GewiSlider.h"
#include "GewiStaticText.h"
#include "Gewi.h"
using namespace ZE;
using namespace Gewi;
@ -45,55 +36,48 @@ void Test1()
{
ZEngine *ze = ZEngine::GetInstance();
GewiEngine *gewi = GewiEngine::GetInstance();
ZImage bg("data/rainbow.bmp"),buf;
ResourceID id1,id2,id3,id4,id5,id6,id7,id8,id9;
GWindow w1;
GTextButton tb1;
GTextField t1,t2(&w1);
GButton b1(&w1);
GHorizSlider s1;
GVertSlider s2;
GButton hb1(&w1);
GStaticText st1;
bg.Resize(800,600);
ZImage bg,buf,temp[8];
ZFont font;
ResourceID id[8],fontID;
GWindow window;
GTextButton txtButton;
GTextField txtField,txtField2(&window);
GButton button(&window);
GHorizSlider hSlider;
GVertSlider vSlider;
GButton hoverButton(&window);
GStaticText label;
bg.Open("data/rainbow.bmp");
bg.Resize(ze->Width(),ze->Height());
ZImage *temp,*temp2,*temp3,*temp4,*temp5,*temp6,*temp7,*temp8;
ZFont *font;
temp = new ZImage("data/b1.bmp");
temp2 = new ZImage("data/b2.bmp");
temp3 = new ZImage("data/skin1.bmp");
temp4 = new ZImage("data/text.bmp");
temp5 = new ZImage("data/bg3.bmp");
temp6 = new ZImage("data/slider.bmp");
temp7 = new ZImage("data/bg4.bmp");
temp8 = new ZImage("data/slider2.bmp");
font = new ZFont("c:\\windows\\fonts\\arial.ttf",20);
temp->SetColorKey(255,0,255);
temp2->SetColorKey(255,0,255);
temp3->SetColorKey(255,0,255);
id1 = gewi->AddResource(temp);
id2 = gewi->AddResource(temp2);
id3 = gewi->AddResource(temp3);
id4 = gewi->AddResource(font);
id5 = gewi->AddResource(temp4);
id6 = gewi->AddResource(temp5);
id7 = gewi->AddResource(temp6);
id8 = gewi->AddResource(temp7);
id9 = gewi->AddResource(temp8);
temp4->SetColorKey(255,0,255);
temp6->SetColorKey(255,0,255);
temp8->SetColorKey(255,0,255);
temp[0].Open("data/b1.bmp");
temp[1].Open("data/b2.bmp");
temp[2].Open("data/skin1.bmp");
temp[3].Open("data/text.bmp");
temp[4].Open("data/bg3.bmp");
temp[5].Open("data/slider.bmp");
temp[6].Open("data/bg4.bmp");
temp[7].Open("data/slider2.bmp");
font.Open("c:\\windows\\fonts\\comic.ttf",20);
w1.Create(300,300,300,300,id3);
b1.Create(50,30,10,10,id1,id2);
t1.Create(100,100,500,50,id4,id5,20,20);
t2.Create(50,200,200,50,id4,id5,20,20);
tb1.Create(400,200,300,50,id1,id2,id4,"restore window");
s1.Create(100,500,200,50,id6,id7,0,3,1);
s2.Create(700,200,50,200,id8,id9,0,200,5);
hb1.Create(70,40,100,100,id1,id2,G_HOVER);
st1.Create(100,100,100,100,id4,Gewi::GewiEngine::InvalidID,"static",GJ_CENTER);
for(int i=0; i < 8; ++i)
{
temp[i].SetColorKey(255,0,255);
id[i] = gewi->AddResource(&temp[i]);
}
fontID = gewi->AddResource(&font);
window.Create(300,300,300,300,id[2]);
button.Create(50,30,10,10,id[0],id[1]);
txtField.Create(100,100,500,50,fontID,id[3],20,20);
txtField2.Create(50,200,200,50,fontID,id[3],20,20);
txtButton.Create(400,200,300,50,id[0],id[1],fontID,"restore window");
hSlider.Create(100,500,200,50,id[4],id[5],0,3,1);
vSlider.Create(700,200,50,200,id[6],id[7],0,200,5);
hoverButton.Create(70,40,100,100,id[0],id[1],GBT_HOVER);
label.Create(100,100,100,100,fontID,"static",GJ_CENTER,GewiEngine::InvalidID);
do
{
@ -104,26 +88,26 @@ void Test1()
if(ze->KeyIsPressed(SDLK_ESCAPE))
ze->RequestQuit();
font->DrawText(FormatStr("%f",s1.GetPos()),buf);
font.DrawText(FormatStr("%f",hSlider.GetPos()),buf);
bg.Draw(0,0);
temp3->SetAlpha(63+s1.GetPos()*64);
temp[2].SetAlpha(63+hSlider.GetPos()*64);
gewi->Display();
buf.Draw(0.0f,s2.GetPos());
buf.Draw(0.0f,vSlider.GetPos());
if(b1.IsPressed() && w1.Visible())
if(button.IsPressed() && window.Visible())
{
w1.ToggleVisible();
tb1.SetState(false);
b1.SetState(false);
window.ToggleVisible();
txtButton.SetState(false);
button.SetState(false);
}
if(tb1.IsPressed() && !w1.Visible())
if(txtButton.IsPressed() && !window.Visible())
{
w1.ToggleVisible();
b1.SetState(false);
tb1.SetState(false);
window.ToggleVisible();
button.SetState(false);
txtButton.SetState(false);
}
if(hb1.IsPressed())
if(hoverButton.IsPressed())
ze->RequestQuit();
ze->Update();
@ -132,17 +116,16 @@ void Test1()
} while(!ze->QuitRequested());
GewiEngine::ReleaseInstance();
}
int main(int argc, char *argv[])
{
// _crtBreakAlloc=163;
Init();
Test1();
GewiEngine::ReleaseInstance();
ZEngine::ReleaseInstance();
_CrtDumpMemoryLeaks();
return 0;
}