Skip to content
This repository has been archived by the owner on Nov 12, 2020. It is now read-only.

Commit

Permalink
Updated :)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntxtung committed Aug 21, 2017
1 parent 33ff2cf commit e9058e2
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 43 deletions.
4 changes: 2 additions & 2 deletions Screens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ void mainMenu()
int order = 1;
settextjustify(LEFT_TEXT, BOTTOM_TEXT);
settextstyle(BOLD_FONT, HORIZ_DIR, 2);
outtextxy(10,H-30, TEXT_COPYRIGHT);
outtextxy(W-400,H-30, TEXT_MAJOR);
outtextxy(10,H-13, TEXT_COPYRIGHT);
outtextxy(W-400,H-13, TEXT_MAJOR);
settextstyle(BOLD_FONT, HORIZ_DIR, 3);
outtextxy(470,500, TEXT_PRESSKEY);

Expand Down
8 changes: 4 additions & 4 deletions Snake2.depend
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

1501556002 d:\github\snakever2\screens.h

1501810178 source:d:\github\snakever2\screens.cpp
1502866795 source:d:\github\snakever2\screens.cpp
<iostream>
<stdio.h>
"Declaration.h"
Expand Down Expand Up @@ -98,11 +98,11 @@
1501764816 d:\github\snakever2\graphicapi.h
<graphics.h>

1501764816 source:d:\github\snakever2\graphicapi.cpp
1502380308 source:d:\github\snakever2\graphicapi.cpp
"Declaration.h"
"GraphicAPI.h"

1501811278 source:d:\github\snakever2\main.cpp
1502380646 source:d:\github\snakever2\main.cpp
"Screens.h"
"Classes.h"
"graphicAPI.h"
Expand All @@ -126,7 +126,7 @@
"Declaration.h"
<stdlib.h>

1501811142 source:d:\github\snakever2\snakegame.cpp
1502381231 source:d:\github\snakever2\snakegame.cpp
<fstream>
<iostream>
<windows.h>
Expand Down
56 changes: 28 additions & 28 deletions Snake2.layout
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="Snake.cpp" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<ActiveTarget name="Release" />
<File name="Highscore.cpp" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="960" topLine="0" />
<Cursor1 position="279" topLine="3" />
</Cursor>
</File>
<File name="Classes.h" open="1" top="1" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="Screens.cpp" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<Cursor>
<Cursor1 position="919" topLine="40" />
<Cursor1 position="789" topLine="12" />
</Cursor>
</File>
<File name="Screens.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<File name="Classes.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1294" topLine="30" />
<Cursor1 position="1260" topLine="0" />
</Cursor>
</File>
<File name="graphicAPI.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="Develop.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="1" zoom_2="0">
<Cursor>
<Cursor1 position="579" topLine="0" />
<Cursor1 position="1124" topLine="0" />
</Cursor>
</File>
<File name="graphicAPI.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<File name="SnakeGame.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="1" zoom_2="0">
<Cursor>
<Cursor1 position="411" topLine="0" />
<Cursor1 position="188" topLine="0" />
</Cursor>
</File>
<File name="Screens.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="Declaration.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="96" topLine="0" />
<Cursor1 position="475" topLine="0" />
</Cursor>
</File>
<File name="Develop.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="1" zoom_2="0">
<File name="Develop.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1124" topLine="0" />
<Cursor1 position="84" topLine="0" />
</Cursor>
</File>
<File name="SnakeGame.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="1" zoom_2="0">
<File name="Sound.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5277" topLine="182" />
<Cursor1 position="210" topLine="0" />
</Cursor>
</File>
<File name="map.cpp" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="Screens.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="281" topLine="0" />
<Cursor1 position="93" topLine="0" />
</Cursor>
</File>
<File name="Declaration.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="graphicAPI.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="475" topLine="0" />
<Cursor1 position="309" topLine="0" />
</Cursor>
</File>
<File name="Highscore.cpp" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="map.cpp" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="279" topLine="3" />
<Cursor1 position="281" topLine="0" />
</Cursor>
</File>
<File name="Sound.cpp" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="300" topLine="0" />
</Cursor>
</File>
<File name="Develop.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="Snake.cpp" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="84" topLine="0" />
<Cursor1 position="960" topLine="0" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="349" topLine="12" />
<Cursor1 position="355" topLine="9" />
</Cursor>
</File>
<File name="Sound.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="graphicAPI.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<Cursor>
<Cursor1 position="210" topLine="0" />
<Cursor1 position="411" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>
5 changes: 0 additions & 5 deletions SnakeGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,11 @@ void SnakeGame::gameThread(){
{
this->getKey2ChangeDirection();
point oldPos = this->snake->getPosition();

this->snake->move(); // move head to other position

this->logic();

this->saveTail(oldPos);
this->setZone(this->snake->getPosition(), ZONE_HEAD); // make new head in Zone

this->makeTail();

delay(this->getGameSpeed()); // delay each of game frame
}
}
Expand Down
4 changes: 2 additions & 2 deletions graphicAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ void initGraphic()
void drawBlock(int x, int y, fill_styles pattern, int color)
{
setfillstyle(pattern, color);
bar((x + scrX -1) * unitLength + 1 ,
(y + scrY -1) * unitLength + 1 ,
bar((x + scrX -1) * unitLength + 0 ,
(y + scrY -1) * unitLength + 0 ,
(x + scrX -1) * unitLength + unitLength ,
(y + scrY -1) * unitLength + unitLength);
}
Expand Down
8 changes: 6 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#include <iostream>
#include <time.h>

#define release false

int main()
{
//ShowWindow(FindWindowA("ConsoleWindowClass", NULL), false); // Dont open the console --> Just remove the comment when build the program
if (release)
ShowWindow(FindWindowA("ConsoleWindowClass", NULL), false); // Dont open the console --> Just remove the comment when build the program

initGraphic();
while (1)
Expand Down Expand Up @@ -54,6 +56,8 @@ int main()
cleardevice();
}
closegraph();
//FreeConsole(); // The same with ShowWindow

if (release)
FreeConsole(); // The same with ShowWindow
return 0;
}

0 comments on commit e9058e2

Please sign in to comment.