Более логичное разбиение на файлы
This commit is contained in:
parent
5fbb88820b
commit
bf93d78d5e
7 changed files with 55 additions and 48 deletions
|
@ -33,8 +33,10 @@
|
|||
<Add option="-fexceptions" />
|
||||
</Compiler>
|
||||
<Unit filename="FallSimulation.cpp" />
|
||||
<Unit filename="lib/Button.h" />
|
||||
<Unit filename="lib/Consts.h" />
|
||||
<Unit filename="lib/ElemFunctions.h" />
|
||||
<Unit filename="lib/MapPart.h" />
|
||||
<Unit filename="lib/ModesFunctions.h" />
|
||||
<Unit filename="lib/TXLib.h" />
|
||||
<Extensions>
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
void background(COLORREF color);
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -64,10 +63,3 @@ int main()
|
|||
|
||||
txDisableAutoPause();
|
||||
}
|
||||
|
||||
void background(COLORREF color)
|
||||
{
|
||||
txSetFillColor(color);
|
||||
txClear();
|
||||
}
|
||||
|
||||
|
|
27
lib/Button.h
Normal file
27
lib/Button.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
struct Button {
|
||||
RECT coords;
|
||||
const char* text;
|
||||
HDC picture;
|
||||
};
|
||||
|
||||
void drawButton(Button but);
|
||||
|
||||
void drawButton(Button but)
|
||||
{
|
||||
//drawing button
|
||||
txRectangle(but.coords.left,
|
||||
but.coords.top,
|
||||
but.coords.right,
|
||||
but.coords.bottom);
|
||||
|
||||
//drawing text
|
||||
txDrawText (but.coords.left,
|
||||
but.coords.top,
|
||||
but.coords.right,
|
||||
but.coords.bottom,
|
||||
but.text,
|
||||
DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
20
lib/Consts.h
20
lib/Consts.h
|
@ -1,7 +1,3 @@
|
|||
#include <TXLib.h>
|
||||
#include "ElemFunctions.h"
|
||||
#include "ModesFunctions.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
//This library containing constants, global variables and structures
|
||||
|
@ -31,21 +27,6 @@ int arrElem = 0;
|
|||
bool lvlCreatingIsStarted = false;
|
||||
bool gameIsStarted = false;
|
||||
|
||||
struct Button {
|
||||
RECT coords;
|
||||
const char* text;
|
||||
HDC picture;
|
||||
};
|
||||
|
||||
struct MapPart {
|
||||
RECT coords;
|
||||
bool visible;
|
||||
HDC picture;
|
||||
int blocktype;
|
||||
};
|
||||
|
||||
MapPart gettedMapParts[MAP_LENGHT + 1];
|
||||
|
||||
HDC block;
|
||||
HDC quest;
|
||||
HDC water;
|
||||
|
@ -54,4 +35,3 @@ HDC fire;
|
|||
HDC light_stone;
|
||||
HDC dark_stone;
|
||||
HDC vdark_stone;
|
||||
|
||||
|
|
|
@ -1,38 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include <TXLib.h>
|
||||
#include "Consts.h"
|
||||
#include "ModesFunctions.h"
|
||||
#include "Button.h"
|
||||
#include "MapPart.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
|
||||
//This library containing functions for work with the elements
|
||||
|
||||
void drawButton(Button but);
|
||||
bool addingBlock(bool clicked, RECT blockBut, HDC pic,
|
||||
int blocktype, int* arrElem, MapPart mapParts[]);
|
||||
|
||||
int readFile(string file, MapPart gettedMapParts[]);
|
||||
void checkElem(MapPart mapParts[]);
|
||||
|
||||
void drawButton(Button but)
|
||||
{
|
||||
//drawing button
|
||||
txRectangle(but.coords.left,
|
||||
but.coords.top,
|
||||
but.coords.right,
|
||||
but.coords.bottom);
|
||||
|
||||
//drawing text
|
||||
txDrawText (but.coords.left,
|
||||
but.coords.top,
|
||||
but.coords.right,
|
||||
but.coords.bottom,
|
||||
but.text,
|
||||
DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
bool addingBlock(bool clicked, RECT blockBut, HDC pic,
|
||||
int blocktype, int* arrElem, MapPart mapParts[])
|
||||
{
|
||||
|
|
10
lib/MapPart.h
Normal file
10
lib/MapPart.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
struct MapPart {
|
||||
RECT coords;
|
||||
bool visible;
|
||||
HDC picture;
|
||||
int blocktype;
|
||||
};
|
||||
|
||||
MapPart gettedMapParts[MAP_LENGHT + 1];
|
|
@ -1,5 +1,7 @@
|
|||
#include <TXLib.h>
|
||||
#include "Consts.h"
|
||||
#include "Button.h"
|
||||
#include "MapPart.h"
|
||||
#include "ElemFunctions.h"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -10,6 +12,7 @@
|
|||
//This library containing game mode functions
|
||||
|
||||
void drawMenu();
|
||||
void background(COLORREF color);
|
||||
void loadingAnimation(int delay, int speed);
|
||||
void mainFunc();
|
||||
void playGame(MapPart gettedMapParts[]);
|
||||
|
@ -124,6 +127,13 @@ void drawMenu()
|
|||
}
|
||||
}
|
||||
|
||||
void background(COLORREF color)
|
||||
{
|
||||
txSetFillColor(color);
|
||||
txClear();
|
||||
}
|
||||
|
||||
|
||||
void loadingAnimation(int delay, int speed)
|
||||
{
|
||||
background(TX_WHITE);
|
||||
|
|
Loading…
Add table
Reference in a new issue