Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Snake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KosmX
Snake
Commits
42ecf56a
Commit
42ecf56a
authored
4 years ago
by
KosmX
Browse files
Options
Downloads
Patches
Plain Diff
trying to fix display
parent
9778677c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
snake.c
+4
-4
4 additions, 4 deletions
snake.c
with
4 additions
and
4 deletions
snake.c
+
4
−
4
View file @
42ecf56a
...
@@ -165,9 +165,9 @@ void rmMatrix(Matrix *map){
...
@@ -165,9 +165,9 @@ void rmMatrix(Matrix *map){
//witch screen coordinates?
//witch screen coordinates?
//just the screen data
//just the screen data
void
printChunk
(
chunk
ch
,
Pos
pos
,
screenData
*
scrDat
){
void
printChunk
(
chunk
ch
,
Pos
pos
,
screenData
*
scrDat
){
pos
.
x
-=
scrDat
->
pos
.
x
;
//
pos.x -= scrDat->pos.x;
pos
.
y
-=
scrDat
->
pos
.
y
;
//
pos.y -= scrDat->pos.y;
if
(
pos
.
x
<
0
||
pos
.
y
<
0
||
pos
.
x
>=
scrDat
->
pos
.
x
||
pos
.
y
>=
scrDat
->
pos
.
y
){
if
(
pos
.
x
<
0
||
pos
.
y
<
0
||
pos
.
x
>=
scrDat
->
size
.
x
||
pos
.
y
>=
scrDat
->
size
.
y
){
return
;
//if pos is not on the screen, just do nothing.
return
;
//if pos is not on the screen, just do nothing.
}
}
printf
(
"\e[%d;%dH"
,
pos
.
x
*
2
,
pos
.
y
);
printf
(
"\e[%d;%dH"
,
pos
.
x
*
2
,
pos
.
y
);
...
@@ -274,7 +274,7 @@ void updateScreen(Matrix *map, screenData *scrDat, snakeChain *head, Direction d
...
@@ -274,7 +274,7 @@ void updateScreen(Matrix *map, screenData *scrDat, snakeChain *head, Direction d
printf
(
"\e[%d;0H\e[ K"
,
pos
.
y
);
//Clear the screen line
printf
(
"\e[%d;0H\e[ K"
,
pos
.
y
);
//Clear the screen line
for
(
pos
.
x
=
scrDat
->
pos
.
x
;
pos
.
x
<
scrDat
->
pos
.
x
+
scrDat
->
size
.
x
;
pos
.
x
+=
2
){
for
(
pos
.
x
=
scrDat
->
pos
.
x
;
pos
.
x
<
scrDat
->
pos
.
x
+
scrDat
->
size
.
x
;
pos
.
x
+=
2
){
if
(
pos
.
x
<
scrDat
->
size
.
x
+
map
->
width
||
scrDat
->
isXRepeat
){
if
(
pos
.
x
<
scrDat
->
size
.
x
+
map
->
width
||
scrDat
->
isXRepeat
){
print
Chunk
(
map
->
matrix
[
pos
.
x
%
map
->
width
][
pos
.
y
&
map
->
height
],
pos
,
scrDat
);
print
(
map
->
matrix
[
pos
.
x
%
map
->
width
][
pos
.
y
&
map
->
height
],
pos
,
scrDat
,
map
->
width
,
map
->
height
);
}
}
}
}
if
(
pos
.
y
>=
scrDat
->
size
.
y
&&
!
scrDat
->
isYRepeat
){
if
(
pos
.
y
>=
scrDat
->
size
.
y
&&
!
scrDat
->
isYRepeat
){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment