2023-07-06 22:02:37 +02:00
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
#include <gint/display.h>
|
|
|
|
#include <gint/keyboard.h>
|
2023-07-06 22:02:37 +02:00
|
|
|
|
|
|
|
#define USB_FEATURE 1
|
|
|
|
|
|
|
|
#if USB_FEATURE==1
|
|
|
|
#include <gint/usb-ff-bulk.h>
|
|
|
|
#include <gint/usb.h>
|
|
|
|
#endif //USB_FEATURE
|
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
|
2023-07-06 21:16:07 +02:00
|
|
|
#ifdef COLOR2BIT
|
|
|
|
#include <gint/gray.h>
|
2023-07-06 22:02:37 +02:00
|
|
|
#endif //COLOR2BIT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "map.h"
|
|
|
|
#include "player.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Player MyPlayer = { 10, 5, 100 };
|
|
|
|
|
|
|
|
|
|
|
|
bool exittoOS = false;
|
|
|
|
|
|
|
|
bool screenshot = false;
|
|
|
|
bool record = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void get_inputs( void )
|
|
|
|
{
|
|
|
|
key_event_t ev;
|
|
|
|
while((ev = pollevent()).type != KEYEV_NONE)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Key binding for the Player action */
|
|
|
|
/*************************************/
|
|
|
|
|
|
|
|
|
|
|
|
if(keydown(KEY_EXIT)) exittoOS = true;
|
|
|
|
|
|
|
|
if(keydown(KEY_LEFT)) PlayerLeft();
|
|
|
|
if(keydown(KEY_RIGHT)) PlayerRight();
|
|
|
|
if(keydown(KEY_UP)) PlayerUp();
|
|
|
|
if(keydown(KEY_DOWN)) PlayerDown();
|
|
|
|
if(keydown(KEY_SHIFT)) PlayerAction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if USB_FEATURE==1
|
|
|
|
|
|
|
|
if(keydown(KEY_7)) screenshot = true;
|
|
|
|
if(keydown(KEY_8)) record = !record;
|
|
|
|
|
|
|
|
#endif //USB_FEATURE
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if USB_FEATURE==1
|
|
|
|
|
|
|
|
void USB_feature( void )
|
|
|
|
{
|
|
|
|
if (screenshot && usb_is_open()) {
|
|
|
|
if (!dgray_enabled())
|
|
|
|
usb_fxlink_screenshot(false);
|
|
|
|
else
|
|
|
|
usb_fxlink_screenshot_gray(false);
|
|
|
|
screenshot = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (record && usb_is_open()) {
|
|
|
|
if (!dgray_enabled())
|
|
|
|
usb_fxlink_videocapture(false);
|
|
|
|
else
|
|
|
|
usb_fxlink_videocapture_gray(false);
|
|
|
|
}
|
|
|
|
}
|
2023-07-05 23:22:15 +02:00
|
|
|
|
2023-07-06 22:02:37 +02:00
|
|
|
#endif
|
2023-07-05 23:22:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2023-07-06 22:02:37 +02:00
|
|
|
|
|
|
|
#if USB_FEATURE==1
|
|
|
|
usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL};
|
|
|
|
usb_open(interfaces, GINT_CALL_NULL);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
dclear(C_WHITE);
|
|
|
|
|
2023-07-06 21:16:07 +02:00
|
|
|
#ifdef COLOR2BIT
|
|
|
|
dgray( DGRAY_ON );
|
|
|
|
#endif
|
2023-07-05 23:22:15 +02:00
|
|
|
|
|
|
|
|
2023-07-06 22:02:37 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
|
|
|
|
RenderMap();
|
|
|
|
|
|
|
|
dupdate();
|
|
|
|
|
|
|
|
#if USB_FEATURE==1
|
|
|
|
USB_feature();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
get_inputs();
|
|
|
|
|
|
|
|
}
|
|
|
|
while (exittoOS == false);
|
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
|
2023-07-06 21:16:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef COLOR2BIT
|
|
|
|
dgray( DGRAY_OFF );
|
|
|
|
#endif
|
|
|
|
|
2023-07-06 22:02:37 +02:00
|
|
|
#if USB_FEATURE==1
|
|
|
|
usb_close();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
return 1;
|
|
|
|
}
|