added blocks
This commit is contained in:
parent
e76901b567
commit
0405287481
4 changed files with 11 additions and 3 deletions
BIN
bin/Debug/cTest
BIN
bin/Debug/cTest
Binary file not shown.
|
|
@ -4,7 +4,7 @@
|
||||||
<ActiveTarget name="Debug" />
|
<ActiveTarget name="Debug" />
|
||||||
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="1370" topLine="86" />
|
<Cursor1 position="1467" topLine="50" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
</CodeBlocks_layout_file>
|
</CodeBlocks_layout_file>
|
||||||
|
|
|
||||||
12
main.c
12
main.c
|
|
@ -55,7 +55,7 @@ int main() {
|
||||||
//struct ballStruct ball;
|
//struct ballStruct ball;
|
||||||
time_t UNIXTIME = time(NULL);
|
time_t UNIXTIME = time(NULL);
|
||||||
srand(UNIXTIME); //seed random number with time at run time
|
srand(UNIXTIME); //seed random number with time at run time
|
||||||
int noXBlocks = SCREEN_WIDTH /2;
|
int noXBlocks = SCREEN_WIDTH;
|
||||||
Block_t blockArr[noXBlocks][Y_BLOCK_LAYERS];
|
Block_t blockArr[noXBlocks][Y_BLOCK_LAYERS];
|
||||||
for (int x=0;x< noXBlocks;x++) {
|
for (int x=0;x< noXBlocks;x++) {
|
||||||
for (int y=0; y<Y_BLOCK_LAYERS; y++){
|
for (int y=0; y<Y_BLOCK_LAYERS; y++){
|
||||||
|
|
@ -73,7 +73,13 @@ int main() {
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
|
||||||
//draw blocks
|
//draw blocks
|
||||||
|
for (int x = 0;x<noXBlocks;x++){
|
||||||
|
for (int y =0;y<Y_BLOCK_LAYERS;y++){
|
||||||
|
if(blockArr[x][y].visable==true){
|
||||||
|
screen[x][y]=PIXEL_BLOCK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//draw paddel
|
//draw paddel
|
||||||
screen[paddle.location][PADDLE_HEIGHT]=PIXEL_PADDLE;
|
screen[paddle.location][PADDLE_HEIGHT]=PIXEL_PADDLE;
|
||||||
|
|
@ -98,6 +104,8 @@ int main() {
|
||||||
printf("<>");
|
printf("<>");
|
||||||
} else if(screen[x][y]==PIXEL_PADDLE) {
|
} else if(screen[x][y]==PIXEL_PADDLE) {
|
||||||
printf("==");
|
printf("==");
|
||||||
|
} else if(screen[x][y]==PIXEL_BLOCK){
|
||||||
|
printf("[]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("|\n");
|
printf("|\n");
|
||||||
|
|
|
||||||
BIN
obj/Debug/main.o
BIN
obj/Debug/main.o
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue