diff --git a/FallSimulation.cbp b/FallSimulation.cbp index 8bc7660..a3872d7 100644 --- a/FallSimulation.cbp +++ b/FallSimulation.cbp @@ -33,8 +33,10 @@ + + diff --git a/FallSimulation.cpp b/FallSimulation.cpp index da95412..ca53fff 100644 --- a/FallSimulation.cpp +++ b/FallSimulation.cpp @@ -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(); -} - diff --git a/lib/Button.h b/lib/Button.h new file mode 100644 index 0000000..19fc3cb --- /dev/null +++ b/lib/Button.h @@ -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); +} + diff --git a/lib/Consts.h b/lib/Consts.h index 5a44ab9..c1725e6 100644 --- a/lib/Consts.h +++ b/lib/Consts.h @@ -1,7 +1,3 @@ -#include -#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; - diff --git a/lib/ElemFunctions.h b/lib/ElemFunctions.h index a305686..d6f22fb 100644 --- a/lib/ElemFunctions.h +++ b/lib/ElemFunctions.h @@ -1,38 +1,24 @@ +#pragma once + #include #include "Consts.h" -#include "ModesFunctions.h" +#include "Button.h" +#include "MapPart.h" #include #include -#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[]) { diff --git a/lib/MapPart.h b/lib/MapPart.h new file mode 100644 index 0000000..478f2af --- /dev/null +++ b/lib/MapPart.h @@ -0,0 +1,10 @@ +#pragma once + +struct MapPart { + RECT coords; + bool visible; + HDC picture; + int blocktype; +}; + +MapPart gettedMapParts[MAP_LENGHT + 1]; diff --git a/lib/ModesFunctions.h b/lib/ModesFunctions.h index 05c0ae2..3c3c853 100644 --- a/lib/ModesFunctions.h +++ b/lib/ModesFunctions.h @@ -1,5 +1,7 @@ #include #include "Consts.h" +#include "Button.h" +#include "MapPart.h" #include "ElemFunctions.h" #include @@ -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);