This commit is contained in:
flo 2017-05-02 20:54:48 +02:00
parent 2e5def8357
commit ff594263f6
19 changed files with 57 additions and 56 deletions

View File

@ -3,7 +3,7 @@
include $(CURDIR)/Makefile.config
# DEDUCED VARS
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(FONT))
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(FONT) $(IMG))
ALLINC = $(INC:%=$(INCDIR)/%)
# RULES

View File

@ -41,7 +41,10 @@ SRC = $(notdir $(wildcard $(SRCDIR)/*.[cs]))
# INCLUDES
INC = $(notdir $(wildcard $(INCDIR)/*.h))
# SPRITES
FONT = $(notdir $(wildcard $(FONTDIR)/*.bmp))
#IMAGE
IMG = $(notdir $(wildcard $(IMGDIR)/*.bmp))
# FONTS
FONT = $(notdir $(wildcard $(FONTDIR)/*.bmp))
# END OF FILE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

View File

@ -202,13 +202,50 @@ extern Font modern;
#define floor(x) ((int)(x))
static const int counts[] = { 2, 8, 8, 18, 18, 32, 32 };
static const int firsts[] = { 1, 2, 2, 3, 3, 18, 18 };
/* returns element number (1-118) or 0 if there is nothing at the given cell */
/* x and y can hold any value, even if it's outside the table */
int element_at(int x, int y)
{
if(x < 0 || x >= 18 || y < 0 || y >= 9) return 0;
if(y >= 7)
{
if(x < 3 || x > 17) return 0;
return ((y == 7) ? (57) : (89)) + (x - 4);
}
int result = 0;
if(x >= firsts[y])
{
if(x + (counts[y] - firsts[y]) < 18) return 0;
else x -= (18 - counts[y]);
}
while(--y >= 0) result += counts[y];
return result + x + 1 ;
}
/* updates x and y if there is an element if the requested direction */
/* in this case, returns the element's number; otherwise returns 0 */
int move(int *x, int *y, enum { up = 0, right, down, left } dir)
{
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };
int elt = element_at(*x + dx[dir], *y + dy[dir]);
if(elt) *x += dx[dir], *y += dy[dir];
return elt;
}
int main()
{
tableauElement(0);
return 1;
}
void Mini(char* chaine, int n ) // fonc defini le numero de la fonction
{
@ -236,67 +273,28 @@ text_configure(&modern, color_black);
for(i = 0; i < 118; i++)
{
x = elements[i].groupe;
y = ( elements[i].famille == 6 || elements[i].famille == 7 ? elements[i].periode + 3 : elements[i].periode);
dtext(13*x+decalx-12, 8*y+decaly-6, elements[i].symbol);
//dtext(13*(elements[i].groupe-1)+decalx+1, 8*( elements[i].famille == 6 || elements[i].famille == 7 ? elements[i].periode + 3 : elements[i].periode) +decaly-6, elements[i].symbol);
}
// x = elements[chang].groupe;
// y = ( elements[chang].famille == 6 || elements[chang].famille == 7 ? elements[chang].periode + 3 : elements[chang].periode);
dprint(1,1, "(%d,%d) => %d", x,y,element_at(x, y));
//drect(13*x,8*y,13*x+12,8*y+8, color_black);
dupdate();
/*chang=(chang>=118 ? 0 : chang<=-1 ? 117 : chang);
decalx=-(((12*elements[chang].groupe)-13)*108)/240; // on fait un decalage lorsque l'on bouge
decaly=(elements[chang].periode==5 ? -7 : elements[chang].periode>5 ? -14 : 0);
for(i=0;i<118;i++)
{
x=elements[i].groupe;
dtext(12*x+decalx-12, 7*y+decaly-6, elements[i].symbol);
dtext(12*3-11+decalx, 7*6-7+decaly, "1");
dtext(12*3-11+decalx, 7*7-7+decaly, "2");
dtext(12*3-11+decalx, 7*9+decaly-5, "1");
dtext(12*3-11+decalx, 7*10+decaly-5, "2");
}
if (element)
{
drect(12*elements[chang].groupe-13+decalx, 7*9-7+decaly, 12*elements[chang].groupe-1+decalx, 7*9+decaly, color_black);
}
else if (chang>87 && chang<103)
{
drect(12*elements[chang].groupe-13+decalx, 7*10-7+decaly, 12*elements[chang].groupe-1+decalx, 7*10+decaly, color_black);
}
else
{
drect(12*elements[chang].groupe-13+decalx, 7*elements[chang].periode-7+decaly, 12*elements[chang].groupe+decalx, 7*elements[chang].periode+decaly, color_black);
}
drect(0, 56, 128, 64, color_white); // on fait un rectangle blanc pour qu'il n'y ait rien
Mini("mini", 0);
Mini("find", 1);
Mini("mol", 2);
Mini("det", 5);
*/
//drect()
key=getkey();
switch(key)
{
case KEY_UP : y--; break;
case KEY_DOWN : y++; break;
case KEY_LEFT : x--; break;
case KEY_RIGHT : x++; break;
case KEY_LEFT : x--; break;
case KEY_DOWN : y++; break;
case KEY_UP : y--; break;
// case KEY_F4 : chang=tableauEleMini(chang); break;
case KEY_F2 : chang=find(chang); break;
// case KEY_F3 : calcul_mole(); break;
@ -304,7 +302,7 @@ text_configure(&modern, color_black);
case KEY_F6 : case KEY_EXE : chang=detailsElement(3); break;
case KEY_EXIT : return 1;
}
}
}
}