push
This commit is contained in:
parent
3cbe5bd731
commit
933718fe07
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@
|
|||
include $(CURDIR)/Makefile.config
|
||||
|
||||
# DEDUCED VARS
|
||||
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(FONT) $(IMG))
|
||||
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(IMG) $(FONT))
|
||||
ALLINC = $(INC:%=$(INCDIR)/%)
|
||||
|
||||
# RULES
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
BIN
img/plane.png
BIN
img/plane.png
Binary file not shown.
Before Width: | Height: | Size: 617 B |
|
@ -1,6 +1,4 @@
|
|||
#ifndef WINGS
|
||||
#define WINGS
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Binary file not shown.
Binary file not shown.
BIN
obj/wings.c.o
BIN
obj/wings.c.o
Binary file not shown.
106
src/wings.c
106
src/wings.c
|
@ -1,21 +1,125 @@
|
|||
#include "wings.h"
|
||||
|
||||
#include "display.h" // bopti.h => images // tales.h => fonts
|
||||
#include "bopti.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#include "timer.h"
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
#define SIZE_MAP_X 256
|
||||
#define SIZE_MAP_Y 128
|
||||
|
||||
|
||||
extern image_t plane;
|
||||
extern image_t img_menu;
|
||||
/*
|
||||
7 0 1
|
||||
6 plane 2
|
||||
5 4 3
|
||||
*/
|
||||
/*
|
||||
touche
|
||||
KEY_UP : 0x18 : 24
|
||||
KEY_RIGHT : 0x17 : 23
|
||||
KEY_DOWN : 0x27 : 39
|
||||
KEY_LEFT : 0x28 : 40
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
dimage(0, 0, &plane);
|
||||
menu();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void menu()
|
||||
{
|
||||
unsigned char menu = 0;
|
||||
unsigned int key = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
dclear();
|
||||
|
||||
dimage(0, 0, &img_menu);
|
||||
drect(67 + menu * 19, 10 + menu * 27, 100 + menu * 19, 25 + menu * 27, color_invert);
|
||||
|
||||
dupdate();
|
||||
|
||||
key = getkey();
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case KEY_UP : case KEY_DOWN : menu = (menu == 1 ? 0 : 1); break;
|
||||
case KEY_EXE :
|
||||
{
|
||||
if (menu==0)
|
||||
{
|
||||
jeu(); break;
|
||||
}
|
||||
else return 1;
|
||||
}
|
||||
case KEY_EXIT : return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void update_frame(int *dir)
|
||||
{
|
||||
dclear();
|
||||
dimage_part(60, 24, &plane, 16*(*dir), 0, 16, 16);
|
||||
dupdate();
|
||||
}
|
||||
|
||||
int jeu()
|
||||
{
|
||||
int dir = 0;
|
||||
unsigned char fire = 0; // fire disable
|
||||
unsigned int sum = 0;
|
||||
int *keys = NULL;
|
||||
unsigned int key;
|
||||
unsigned char i;
|
||||
|
||||
timer_t *timer = NULL;
|
||||
|
||||
timer = timer_create(40, 0);
|
||||
timer_attach(timer, update_frame, &dir);
|
||||
timer_start(timer);
|
||||
|
||||
while(1)
|
||||
{
|
||||
/*multigetkey(keys, 4, 40);
|
||||
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
if(keys[i] == KEY_UP || keys[i] == KEY_DOWN || keys[i] == KEY_LEFT || keys[i] == KEY_RIGHT)
|
||||
{
|
||||
sum += keys[i];
|
||||
}
|
||||
else if (keys[i] == KEY_SHIFT)
|
||||
{
|
||||
fire = 1; // fire on ennemies
|
||||
}
|
||||
}
|
||||
*/
|
||||
key = getkey();
|
||||
switch(sum)
|
||||
{
|
||||
case KEY_LEFT : dir = 6; break;
|
||||
case KEY_RIGHT : dir = 2; break;
|
||||
case KEY_UP : dir = 0; break;
|
||||
case KEY_DOWN : dir = 4; break;
|
||||
|
||||
/*case 0x2F : dir = 1;
|
||||
case 0x3E : dir = 3;
|
||||
case 0x4F : dir = 5;
|
||||
case 0x40 : dir = 7;
|
||||
*/
|
||||
case KEY_EXIT : timer_stop(timer); return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue