20220628 - Scrolling en cours de développement.
This commit is contained in:
parent
0f81e6a140
commit
e46be95995
25
src/main.c
25
src/main.c
|
@ -21,7 +21,7 @@ void drawselectedgame(int selected) {
|
|||
drect(1, WORLDSEL_MARGIN+selected*(LINEHEIGHT)-(int)(LINEPADDING/2), 128, WORLDSEL_MARGIN+(selected+1)*(LINEHEIGHT)-(int)(LINEPADDING/2), C_INVERT);
|
||||
dupdate();
|
||||
}
|
||||
void mappartdisplaying(int x, int y, unsigned short terrain) {
|
||||
void mappartdisplaying(int x, int y, unsigned short int * terrain) {
|
||||
int firsttile_x = x>>3, firsttile_y = y>>3;
|
||||
int base_x = firsttile_x*8, base_y = firsttile_y*8;
|
||||
int sx = base_x - x, sy = base_y - y, tx = (SCREEN_WIDTH>>3) + 1, ty = (SCREEN_HEIGHT>>3) + 1;
|
||||
|
@ -29,11 +29,16 @@ void mappartdisplaying(int x, int y, unsigned short terrain) {
|
|||
unsigned short type;
|
||||
for(cy = 0;cy != ty;cy++){
|
||||
for(cx = 0;cx != tx;cx++){
|
||||
type = terrain[(int *)(cy*tx+px)];
|
||||
type = terrain[cy*tx+px];
|
||||
switch(type){
|
||||
case 1:
|
||||
dimage(px, py, &soil_tile);
|
||||
dimage(px, py, &soil_tile); break;
|
||||
case 2:
|
||||
dimage(px, py, &stone_tile); break;
|
||||
case 3:
|
||||
dimage(px, py, &coal_tile); break;
|
||||
}
|
||||
dupdate();
|
||||
px += 8;
|
||||
}
|
||||
py += 8;
|
||||
|
@ -78,7 +83,7 @@ int main(void) {
|
|||
|
||||
}
|
||||
}else if(game == 2){
|
||||
dtext(1, 1, C_BLACK, WORLDSEL_EMPTY);
|
||||
dtext(1, 1, C_BLACK, WORLDGEN_INFO);
|
||||
dupdate();
|
||||
for(i=0;i!=WORLD_WIDTH*WORLD_HEIGHT;i++){
|
||||
terrain[i] = 0;
|
||||
|
@ -93,10 +98,16 @@ int main(void) {
|
|||
y = 0;
|
||||
dclear(C_WHITE);
|
||||
if(key==KEY_RIGHT){
|
||||
//
|
||||
x++;
|
||||
}else if(key==KEY_LEFT){
|
||||
x--;
|
||||
}else if(key==KEY_UP){
|
||||
y--;
|
||||
}else if(key==KEY_DOWN){
|
||||
y++;
|
||||
}
|
||||
mappartdisplaying(0, 256, terrain);
|
||||
dupdate();
|
||||
// dtext(1, 1, C_BLACK, "test");
|
||||
mappartdisplaying(x, y, terrain);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# define TITLE_START "[EXE] pour jouer" // Start screen text.
|
||||
# define WORLDSEL_EMPTY "--- VIDE ---" // Empty slot in the game selection menu.
|
||||
# define WORLDGEN_INFO "Génération du terrain ..." // Text when waiting for world generation.
|
||||
# define WORLDGEN_INFO "Generation ..." // Text when waiting for world generation.
|
Loading…
Reference in New Issue