|
@@ -1,13 +1,13 @@
|
|
|
/*****************************************************************************
|
|
/*****************************************************************************
|
|
|
* Product: "Fly 'n' Shoot" game example, Win32-GUI
|
|
* Product: "Fly 'n' Shoot" game example, Win32-GUI
|
|
|
-* Last Updated for Version: 5.4.0
|
|
|
|
|
-* Date of the Last Update: 2015-03-07
|
|
|
|
|
|
|
+* Last Updated for Version: 5.4.2
|
|
|
|
|
+* Date of the Last Update: 2015-06-03
|
|
|
*
|
|
*
|
|
|
* Q u a n t u m L e a P s
|
|
* Q u a n t u m L e a P s
|
|
|
* ---------------------------
|
|
* ---------------------------
|
|
|
* innovating embedded systems
|
|
* innovating embedded systems
|
|
|
*
|
|
*
|
|
|
-* Copyright (C) Quantum Leaps, LLC. state-machine.com.
|
|
|
|
|
|
|
+* Copyright (C) Quantum Leaps, LLC. All rights reserved.
|
|
|
*
|
|
*
|
|
|
* This program is open source software: you can redistribute it and/or
|
|
* This program is open source software: you can redistribute it and/or
|
|
|
* modify it under the terms of the GNU General Public License as published
|
|
* modify it under the terms of the GNU General Public License as published
|
|
@@ -28,34 +28,34 @@
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*
|
|
*
|
|
|
* Contact information:
|
|
* Contact information:
|
|
|
-* Web : http://www.state-machine.com
|
|
|
|
|
|
|
+* Web: www.state-machine.com
|
|
|
* Email: info@state-machine.com
|
|
* Email: info@state-machine.com
|
|
|
*****************************************************************************/
|
|
*****************************************************************************/
|
|
|
#include "qpc.h"
|
|
#include "qpc.h"
|
|
|
#include "game.h"
|
|
#include "game.h"
|
|
|
#include "bsp.h"
|
|
#include "bsp.h"
|
|
|
|
|
|
|
|
-#include "win32_gui.h" /* Win32 GUI elements for embedded front panels */
|
|
|
|
|
|
|
+#include "win32_gui.h" /* Win32 GUI elements for embedded front panels */
|
|
|
#include "resource.h" /* GUI resource IDs generated by the resource editior */
|
|
#include "resource.h" /* GUI resource IDs generated by the resource editior */
|
|
|
-#include <stdio.h> /* for _snprintf() */
|
|
|
|
|
|
|
+#include <stdio.h> /* for _snprintf() */
|
|
|
|
|
|
|
|
Q_DEFINE_THIS_FILE
|
|
Q_DEFINE_THIS_FILE
|
|
|
|
|
|
|
|
/* local variables ---------------------------------------------------------*/
|
|
/* local variables ---------------------------------------------------------*/
|
|
|
-static HINSTANCE l_hInst; /* this application instance */
|
|
|
|
|
-static HWND l_hWnd; /* main window handle */
|
|
|
|
|
-static LPSTR l_cmdLine; /* the command line string */
|
|
|
|
|
|
|
+static HINSTANCE l_hInst; /* this application instance */
|
|
|
|
|
+static HWND l_hWnd; /* main window handle */
|
|
|
|
|
+static LPSTR l_cmdLine; /* the command line string */
|
|
|
|
|
|
|
|
static GraphicDisplay l_oled; /* the OLED display of the EK-LM3S811 board */
|
|
static GraphicDisplay l_oled; /* the OLED display of the EK-LM3S811 board */
|
|
|
-static SegmentDisplay l_userLED; /* USER LED of the EK-LM3S811 board */
|
|
|
|
|
-static SegmentDisplay l_scoreBoard; /* segment display for the score */
|
|
|
|
|
-static OwnerDrawnButton l_userBtn; /* USER button of the EK-LM3S811 board */
|
|
|
|
|
|
|
+static SegmentDisplay l_userLED; /* USER LED of the EK-LM3S811 board */
|
|
|
|
|
+static SegmentDisplay l_scoreBoard; /* segment display for the score */
|
|
|
|
|
+static OwnerDrawnButton l_userBtn; /* USER button of the EK-LM3S811 board */
|
|
|
|
|
|
|
|
/* (R,G,B) colors for the OLED display */
|
|
/* (R,G,B) colors for the OLED display */
|
|
|
-static BYTE const c_onColor [3] = { 255U, 255U, 255U }; /* white */
|
|
|
|
|
-static BYTE const c_offColor[3] = { 15U, 15U, 15U }; /* very dark grey */
|
|
|
|
|
|
|
+static BYTE const c_onColor [3] = { 255U, 255U, 255U }; /* white */
|
|
|
|
|
+static BYTE const c_offColor[3] = { 15U, 15U, 15U }; /* very dark grey */
|
|
|
|
|
|
|
|
-static BYTE l_ship_pos = GAME_SHIP_Y; /* the current ship Y-position */
|
|
|
|
|
|
|
+static BYTE l_ship_pos = GAME_SHIP_Y; /* the current ship Y-position */
|
|
|
|
|
|
|
|
#ifdef Q_SPY
|
|
#ifdef Q_SPY
|
|
|
enum QSUserRecords {
|
|
enum QSUserRecords {
|
|
@@ -70,21 +70,65 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
WPARAM wParam, LPARAM lParam);
|
|
WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
|
|
+static void playerTrigger(void) {
|
|
|
|
|
+ static QEvt const fireEvt = { PLAYER_TRIGGER_SIG, 0U, 0U };
|
|
|
|
|
+ QF_PUBLISH(&fireEvt, (void*)0);
|
|
|
|
|
+}
|
|
|
|
|
+/*..........................................................................*/
|
|
|
|
|
+static void moveShipUp(void) {
|
|
|
|
|
+ ObjectPosEvt *ope;
|
|
|
|
|
+ if (l_ship_pos > 0U) {
|
|
|
|
|
+ --l_ship_pos;
|
|
|
|
|
+ }
|
|
|
|
|
+ ope = Q_NEW(ObjectPosEvt, PLAYER_SHIP_MOVE_SIG);
|
|
|
|
|
+ ope->x = (uint8_t)GAME_SHIP_X;
|
|
|
|
|
+ ope->y = (uint8_t)l_ship_pos;
|
|
|
|
|
+ QACTIVE_POST(AO_Ship, (QEvt *)ope, &l_mouse);
|
|
|
|
|
+}
|
|
|
|
|
+//............................................................................
|
|
|
|
|
+static void moveShipDown(void) {
|
|
|
|
|
+ ObjectPosEvt *ope;
|
|
|
|
|
+ if (l_ship_pos < (GAME_SCREEN_HEIGHT - 3U)) {
|
|
|
|
|
+ ++l_ship_pos;
|
|
|
|
|
+ }
|
|
|
|
|
+ ope = Q_NEW(ObjectPosEvt, PLAYER_SHIP_MOVE_SIG);
|
|
|
|
|
+ ope->x = (uint8_t)GAME_SHIP_X;
|
|
|
|
|
+ ope->y = (uint8_t)l_ship_pos;
|
|
|
|
|
+ QACTIVE_POST(AO_Ship, (QEvt *)ope, &l_mouse);
|
|
|
|
|
+}
|
|
|
|
|
+/*..........................................................................*/
|
|
|
|
|
+void terminate(int16_t result) {
|
|
|
|
|
+ QF_stop(); /* stop the main QF application and the ticker thread */
|
|
|
|
|
+ PostQuitMessage(result); /* post the Quit message to the GUI */
|
|
|
|
|
+
|
|
|
|
|
+ GraphicDisplay_xtor(&l_oled); /* cleanup the l_oled resources */
|
|
|
|
|
+ OwnerDrawnButton_xtor(&l_userBtn); /* cleanup the l_userBtn resources */
|
|
|
|
|
+ SegmentDisplay_xtor(&l_userLED); /* cleanup the l_userLED resources */
|
|
|
|
|
+ SegmentDisplay_xtor(&l_scoreBoard); /* cleanup the scoreBoard resources */
|
|
|
|
|
+}
|
|
|
|
|
+/*..........................................................................*/
|
|
|
|
|
+/* thread function for running the application main_gui() */
|
|
|
|
|
+static DWORD WINAPI appThread(LPVOID par) {
|
|
|
|
|
+ (void)par; /* unused parameter */
|
|
|
|
|
+ return (DWORD)main_gui(); /* run the QF-nano application */
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/*--------------------------------------------------------------------------*/
|
|
|
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
|
|
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
|
|
|
LPSTR cmdLine, int iCmdShow)
|
|
LPSTR cmdLine, int iCmdShow)
|
|
|
{
|
|
{
|
|
|
HWND hWnd;
|
|
HWND hWnd;
|
|
|
MSG msg;
|
|
MSG msg;
|
|
|
|
|
|
|
|
- (void)hPrevInst; /* avoid compiler warning about unused parameter */
|
|
|
|
|
|
|
+ (void)hPrevInst; /* unused parameter */
|
|
|
|
|
|
|
|
- l_hInst = hInst; /* save the application instance */
|
|
|
|
|
- l_cmdLine = cmdLine; /* save the command line string */
|
|
|
|
|
|
|
+ l_hInst = hInst; /* save the application instance */
|
|
|
|
|
+ l_cmdLine = cmdLine; /* save the command line string */
|
|
|
|
|
|
|
|
/* create the main custom dialog window */
|
|
/* create the main custom dialog window */
|
|
|
hWnd = CreateCustDialog(hInst, IDD_APPLICATION, NULL,
|
|
hWnd = CreateCustDialog(hInst, IDD_APPLICATION, NULL,
|
|
|
&WndProc, "QP_APP");
|
|
&WndProc, "QP_APP");
|
|
|
- ShowWindow(hWnd, iCmdShow); /* show the main window */
|
|
|
|
|
|
|
+ ShowWindow(hWnd, iCmdShow); /* show the main window */
|
|
|
|
|
|
|
|
/* enter the message loop... */
|
|
/* enter the message loop... */
|
|
|
while (GetMessage(&msg, NULL, 0, 0)) {
|
|
while (GetMessage(&msg, NULL, 0, 0)) {
|
|
@@ -94,14 +138,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
|
|
|
return msg.wParam;
|
|
return msg.wParam;
|
|
|
}
|
|
}
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
-extern int main_gui(void); /* prototype for appThread() */
|
|
|
|
|
-
|
|
|
|
|
-/* thread function for running the application main() */
|
|
|
|
|
-static DWORD WINAPI appThread(LPVOID par) {
|
|
|
|
|
- (void)par; /* unused parameter */
|
|
|
|
|
- return main_gui(); /* run the QF application */
|
|
|
|
|
-}
|
|
|
|
|
-/*..........................................................................*/
|
|
|
|
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
WPARAM wParam, LPARAM lParam)
|
|
WPARAM wParam, LPARAM lParam)
|
|
|
{
|
|
{
|
|
@@ -112,7 +148,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
* the GetDlgItem() function can't be used (it will return NULL).
|
|
* the GetDlgItem() function can't be used (it will return NULL).
|
|
|
*/
|
|
*/
|
|
|
case WM_CREATE: {
|
|
case WM_CREATE: {
|
|
|
- l_hWnd = hWnd; /* save the window handle */
|
|
|
|
|
|
|
+ l_hWnd = hWnd; /* save the window handle */
|
|
|
|
|
|
|
|
/* initialize the owner-drawn buttons...
|
|
/* initialize the owner-drawn buttons...
|
|
|
* NOTE: must be done *before* the first drawing of the buttons,
|
|
* NOTE: must be done *before* the first drawing of the buttons,
|
|
@@ -128,13 +164,13 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
/* Perform initialization after all child windows have been created */
|
|
/* Perform initialization after all child windows have been created */
|
|
|
case WM_INITDIALOG: {
|
|
case WM_INITDIALOG: {
|
|
|
GraphicDisplay_init(&l_oled,
|
|
GraphicDisplay_init(&l_oled,
|
|
|
- BSP_SCREEN_WIDTH, 2U, /* scale horizontally by 2 */
|
|
|
|
|
- BSP_SCREEN_HEIGHT, 2U, /* scale vertically by 2 */
|
|
|
|
|
|
|
+ BSP_SCREEN_WIDTH, 2U, /* scale horizontally by 2 */
|
|
|
|
|
+ BSP_SCREEN_HEIGHT, 2U, /* scale vertically by 2 */
|
|
|
GetDlgItem(hWnd, IDC_LCD), c_offColor);
|
|
GetDlgItem(hWnd, IDC_LCD), c_offColor);
|
|
|
|
|
|
|
|
SegmentDisplay_init(&l_userLED,
|
|
SegmentDisplay_init(&l_userLED,
|
|
|
- 1U, /* 1 "segment" (the LED itself) */
|
|
|
|
|
- 2U); /* 2 bitmaps (for LED OFF/ON states) */
|
|
|
|
|
|
|
+ 1U, /* 1 "segment" (the LED itself) */
|
|
|
|
|
+ 2U); /* 2 bitmaps (for LED OFF/ON states) */
|
|
|
SegmentDisplay_initSegment(&l_userLED,
|
|
SegmentDisplay_initSegment(&l_userLED,
|
|
|
0U, GetDlgItem(hWnd, IDC_LED));
|
|
0U, GetDlgItem(hWnd, IDC_LED));
|
|
|
SegmentDisplay_initBitmap(&l_userLED,
|
|
SegmentDisplay_initBitmap(&l_userLED,
|
|
@@ -143,8 +179,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
1U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_LED_ON)));
|
|
1U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_LED_ON)));
|
|
|
|
|
|
|
|
SegmentDisplay_init(&l_scoreBoard,
|
|
SegmentDisplay_init(&l_scoreBoard,
|
|
|
- 4U, /* 4 "segments" (digits 0-3) */
|
|
|
|
|
- 10U); /* 10 bitmaps (for 0-9 states) */
|
|
|
|
|
|
|
+ 4U, /* 4 "segments" (digits 0-3) */
|
|
|
|
|
+ 10U); /* 10 bitmaps (for 0-9 states) */
|
|
|
SegmentDisplay_initSegment(&l_scoreBoard,
|
|
SegmentDisplay_initSegment(&l_scoreBoard,
|
|
|
0U, GetDlgItem(hWnd, IDC_SEG0));
|
|
0U, GetDlgItem(hWnd, IDC_SEG0));
|
|
|
SegmentDisplay_initSegment(&l_scoreBoard,
|
|
SegmentDisplay_initSegment(&l_scoreBoard,
|
|
@@ -183,7 +219,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
case WM_DESTROY: {
|
|
case WM_DESTROY: {
|
|
|
- BSP_terminate(0);
|
|
|
|
|
|
|
+ terminate(0);
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -193,7 +229,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
switch (wParam) {
|
|
switch (wParam) {
|
|
|
case IDOK:
|
|
case IDOK:
|
|
|
case IDCANCEL: {
|
|
case IDCANCEL: {
|
|
|
- BSP_terminate(0);
|
|
|
|
|
|
|
+ terminate(0);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -204,10 +240,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
case WM_DRAWITEM: {
|
|
case WM_DRAWITEM: {
|
|
|
LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam;
|
|
LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam;
|
|
|
switch (pdis->CtlID) {
|
|
switch (pdis->CtlID) {
|
|
|
- case IDC_USER: { /* USER owner-drawn button */
|
|
|
|
|
|
|
+ case IDC_USER: { /* USER owner-drawn button */
|
|
|
switch (OwnerDrawnButton_draw(&l_userBtn, pdis)) {
|
|
switch (OwnerDrawnButton_draw(&l_userBtn, pdis)) {
|
|
|
case BTN_DEPRESSED: {
|
|
case BTN_DEPRESSED: {
|
|
|
- BSP_playerTrigger();
|
|
|
|
|
|
|
+ playerTrigger();
|
|
|
SegmentDisplay_setSegment(&l_userLED, 0U, 1U);
|
|
SegmentDisplay_setSegment(&l_userLED, 0U, 1U);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -228,10 +264,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
/* mouse input... */
|
|
/* mouse input... */
|
|
|
case WM_MOUSEWHEEL: {
|
|
case WM_MOUSEWHEEL: {
|
|
|
if ((HIWORD(wParam) & 0x8000U) == 0U) {/* wheel turned forward? */
|
|
if ((HIWORD(wParam) & 0x8000U) == 0U) {/* wheel turned forward? */
|
|
|
- BSP_moveShipUp();
|
|
|
|
|
|
|
+ moveShipUp();
|
|
|
}
|
|
}
|
|
|
- else { /* the wheel was turned backwards */
|
|
|
|
|
- BSP_moveShipDown();
|
|
|
|
|
|
|
+ else { /* the wheel was turned backwards */
|
|
|
|
|
+ moveShipDown();
|
|
|
}
|
|
}
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
@@ -240,13 +276,13 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
case WM_KEYDOWN: {
|
|
case WM_KEYDOWN: {
|
|
|
switch (wParam) {
|
|
switch (wParam) {
|
|
|
case VK_UP:
|
|
case VK_UP:
|
|
|
- BSP_moveShipUp();
|
|
|
|
|
|
|
+ moveShipUp();
|
|
|
break;
|
|
break;
|
|
|
case VK_DOWN:
|
|
case VK_DOWN:
|
|
|
- BSP_moveShipDown();
|
|
|
|
|
|
|
+ moveShipDown();
|
|
|
break;
|
|
break;
|
|
|
case VK_SPACE:
|
|
case VK_SPACE:
|
|
|
- BSP_playerTrigger();
|
|
|
|
|
|
|
+ playerTrigger();
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
return 0;
|
|
return 0;
|
|
@@ -255,9 +291,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
|
|
|
}
|
|
}
|
|
|
return DefWindowProc(hWnd, iMsg, wParam, lParam) ;
|
|
return DefWindowProc(hWnd, iMsg, wParam, lParam) ;
|
|
|
}
|
|
}
|
|
|
-/*..........................................................................*/
|
|
|
|
|
|
|
+
|
|
|
|
|
+/*--------------------------------------------------------------------------*/
|
|
|
void QF_onStartup(void) {
|
|
void QF_onStartup(void) {
|
|
|
- QF_setTickRate(BSP_TICKS_PER_SEC); /* set the desired tick rate */
|
|
|
|
|
|
|
+ QF_setTickRate(BSP_TICKS_PER_SEC); /* set the desired tick rate */
|
|
|
}
|
|
}
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
void QF_onCleanup(void) {
|
|
void QF_onCleanup(void) {
|
|
@@ -265,19 +302,21 @@ void QF_onCleanup(void) {
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
void QF_onClockTick(void) {
|
|
void QF_onClockTick(void) {
|
|
|
static QEvt const tickEvt = { TIME_TICK_SIG, 0U, 0U };
|
|
static QEvt const tickEvt = { TIME_TICK_SIG, 0U, 0U };
|
|
|
- QF_TICK_X(0U, &l_clock_tick); /* process time events for rate 0 */
|
|
|
|
|
- QF_PUBLISH(&tickEvt, &l_clock_tick); /* publish the tick event */
|
|
|
|
|
|
|
+ QF_TICK_X(0U, &l_clock_tick); /* process time events for rate 0 */
|
|
|
|
|
+ QF_PUBLISH(&tickEvt, &l_clock_tick); /* publish the tick event */
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
void Q_onAssert(char const Q_ROM * const file, int line) {
|
|
void Q_onAssert(char const Q_ROM * const file, int line) {
|
|
|
char message[80];
|
|
char message[80];
|
|
|
- QF_stop(); /* stop ticking */
|
|
|
|
|
- snprintf(message, Q_DIM(message) - 1,
|
|
|
|
|
- "Assertion failed in module %s line %d", file, line);
|
|
|
|
|
|
|
+ QF_stop(); /* stop the main QF application and the ticker thread */
|
|
|
|
|
+ SNPRINTF_S(message, Q_DIM(message) - 1,
|
|
|
|
|
+ "Assertion failed in module %s line %d", file, line);
|
|
|
MessageBox(l_hWnd, message, "!!! ASSERTION !!!",
|
|
MessageBox(l_hWnd, message, "!!! ASSERTION !!!",
|
|
|
MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
|
|
MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
|
|
|
PostQuitMessage(-1);
|
|
PostQuitMessage(-1);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
void BSP_init(void) {
|
|
void BSP_init(void) {
|
|
|
Q_ALLEGE(QS_INIT(l_cmdLine));
|
|
Q_ALLEGE(QS_INIT(l_cmdLine));
|
|
@@ -285,16 +324,6 @@ void BSP_init(void) {
|
|
|
QS_USR_DICTIONARY(PLAYER_TRIGGER);
|
|
QS_USR_DICTIONARY(PLAYER_TRIGGER);
|
|
|
}
|
|
}
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
-void BSP_terminate(int result) {
|
|
|
|
|
- QF_stop(); /* stop the main QF applicatin thread */
|
|
|
|
|
- PostQuitMessage(result); /* post the Quit message to the GUI */
|
|
|
|
|
-
|
|
|
|
|
- GraphicDisplay_xtor(&l_oled); /* cleanup the l_oled resources */
|
|
|
|
|
- OwnerDrawnButton_xtor(&l_userBtn); /* cleanup the l_userBtn resources */
|
|
|
|
|
- SegmentDisplay_xtor(&l_userLED); /* cleanup the l_userLED resources */
|
|
|
|
|
- SegmentDisplay_xtor(&l_scoreBoard); /* cleanup the scoreBoard resources */
|
|
|
|
|
-}
|
|
|
|
|
-/*..........................................................................*/
|
|
|
|
|
void BSP_drawBitmap(uint8_t const *bitmap) {
|
|
void BSP_drawBitmap(uint8_t const *bitmap) {
|
|
|
UINT x, y;
|
|
UINT x, y;
|
|
|
/* map the EK-LM3S811 OLED pixels to the GraphicDisplay pixels... */
|
|
/* map the EK-LM3S811 OLED pixels to the GraphicDisplay pixels... */
|
|
@@ -309,106 +338,106 @@ void BSP_drawBitmap(uint8_t const *bitmap) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- GraphicDisplay_redraw(&l_oled); /* redraw the updated display */
|
|
|
|
|
|
|
+ GraphicDisplay_redraw(&l_oled); /* redraw the updated display */
|
|
|
}
|
|
}
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
void BSP_drawNString(uint8_t x, uint8_t y, char const *str) {
|
|
void BSP_drawNString(uint8_t x, uint8_t y, char const *str) {
|
|
|
static uint8_t const font5x7[95][5] = {
|
|
static uint8_t const font5x7[95][5] = {
|
|
|
- { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ' ' */
|
|
|
|
|
- { 0x00, 0x00, 0x4F, 0x00, 0x00 }, /* ! */
|
|
|
|
|
- { 0x00, 0x07, 0x00, 0x07, 0x00 }, /* " */
|
|
|
|
|
- { 0x14, 0x7F, 0x14, 0x7F, 0x14 }, /* # */
|
|
|
|
|
- { 0x24, 0x2A, 0x7F, 0x2A, 0x12 }, /* $ */
|
|
|
|
|
- { 0x23, 0x13, 0x08, 0x64, 0x62 }, /* % */
|
|
|
|
|
- { 0x36, 0x49, 0x55, 0x22, 0x50 }, /* & */
|
|
|
|
|
- { 0x00, 0x05, 0x03, 0x00, 0x00 }, /* ' */
|
|
|
|
|
- { 0x00, 0x1C, 0x22, 0x41, 0x00 }, /* ( */
|
|
|
|
|
- { 0x00, 0x41, 0x22, 0x1C, 0x00 }, /* ) */
|
|
|
|
|
- { 0x14, 0x08, 0x3E, 0x08, 0x14 }, /* * */
|
|
|
|
|
- { 0x08, 0x08, 0x3E, 0x08, 0x08 }, /* + */
|
|
|
|
|
- { 0x00, 0x50, 0x30, 0x00, 0x00 }, /* , */
|
|
|
|
|
- { 0x08, 0x08, 0x08, 0x08, 0x08 }, /* - */
|
|
|
|
|
- { 0x00, 0x60, 0x60, 0x00, 0x00 }, /* . */
|
|
|
|
|
- { 0x20, 0x10, 0x08, 0x04, 0x02 }, /* / */
|
|
|
|
|
- { 0x3E, 0x51, 0x49, 0x45, 0x3E }, /* 0 */
|
|
|
|
|
- { 0x00, 0x42, 0x7F, 0x40, 0x00 }, /* 1 */
|
|
|
|
|
- { 0x42, 0x61, 0x51, 0x49, 0x46 }, /* 2 */
|
|
|
|
|
- { 0x21, 0x41, 0x45, 0x4B, 0x31 }, /* 3 */
|
|
|
|
|
- { 0x18, 0x14, 0x12, 0x7F, 0x10 }, /* 4 */
|
|
|
|
|
- { 0x27, 0x45, 0x45, 0x45, 0x39 }, /* 5 */
|
|
|
|
|
- { 0x3C, 0x4A, 0x49, 0x49, 0x30 }, /* 6 */
|
|
|
|
|
- { 0x01, 0x71, 0x09, 0x05, 0x03 }, /* 7 */
|
|
|
|
|
- { 0x36, 0x49, 0x49, 0x49, 0x36 }, /* 8 */
|
|
|
|
|
- { 0x06, 0x49, 0x49, 0x29, 0x1E }, /* 9 */
|
|
|
|
|
- { 0x00, 0x36, 0x36, 0x00, 0x00 }, /* : */
|
|
|
|
|
- { 0x00, 0x56, 0x36, 0x00, 0x00 }, /* ; */
|
|
|
|
|
- { 0x08, 0x14, 0x22, 0x41, 0x00 }, /* < */
|
|
|
|
|
- { 0x14, 0x14, 0x14, 0x14, 0x14 }, /* = */
|
|
|
|
|
- { 0x00, 0x41, 0x22, 0x14, 0x08 }, /* > */
|
|
|
|
|
- { 0x02, 0x01, 0x51, 0x09, 0x06 }, /* ? */
|
|
|
|
|
- { 0x32, 0x49, 0x79, 0x41, 0x3E }, /* @ */
|
|
|
|
|
- { 0x7E, 0x11, 0x11, 0x11, 0x7E }, /* A */
|
|
|
|
|
- { 0x7F, 0x49, 0x49, 0x49, 0x36 }, /* B */
|
|
|
|
|
- { 0x3E, 0x41, 0x41, 0x41, 0x22 }, /* C */
|
|
|
|
|
- { 0x7F, 0x41, 0x41, 0x22, 0x1C }, /* D */
|
|
|
|
|
- { 0x7F, 0x49, 0x49, 0x49, 0x41 }, /* E */
|
|
|
|
|
- { 0x7F, 0x09, 0x09, 0x09, 0x01 }, /* F */
|
|
|
|
|
- { 0x3E, 0x41, 0x49, 0x49, 0x7A }, /* G */
|
|
|
|
|
- { 0x7F, 0x08, 0x08, 0x08, 0x7F }, /* H */
|
|
|
|
|
- { 0x00, 0x41, 0x7F, 0x41, 0x00 }, /* I */
|
|
|
|
|
- { 0x20, 0x40, 0x41, 0x3F, 0x01 }, /* J */
|
|
|
|
|
- { 0x7F, 0x08, 0x14, 0x22, 0x41 }, /* K */
|
|
|
|
|
- { 0x7F, 0x40, 0x40, 0x40, 0x40 }, /* L */
|
|
|
|
|
- { 0x7F, 0x02, 0x0C, 0x02, 0x7F }, /* M */
|
|
|
|
|
- { 0x7F, 0x04, 0x08, 0x10, 0x7F }, /* N */
|
|
|
|
|
- { 0x3E, 0x41, 0x41, 0x41, 0x3E }, /* O */
|
|
|
|
|
- { 0x7F, 0x09, 0x09, 0x09, 0x06 }, /* P */
|
|
|
|
|
- { 0x3E, 0x41, 0x51, 0x21, 0x5E }, /* Q */
|
|
|
|
|
- { 0x7F, 0x09, 0x19, 0x29, 0x46 }, /* R */
|
|
|
|
|
- { 0x46, 0x49, 0x49, 0x49, 0x31 }, /* S */
|
|
|
|
|
- { 0x01, 0x01, 0x7F, 0x01, 0x01 }, /* T */
|
|
|
|
|
- { 0x3F, 0x40, 0x40, 0x40, 0x3F }, /* U */
|
|
|
|
|
- { 0x1F, 0x20, 0x40, 0x20, 0x1F }, /* V */
|
|
|
|
|
- { 0x3F, 0x40, 0x38, 0x40, 0x3F }, /* W */
|
|
|
|
|
- { 0x63, 0x14, 0x08, 0x14, 0x63 }, /* X */
|
|
|
|
|
- { 0x07, 0x08, 0x70, 0x08, 0x07 }, /* Y */
|
|
|
|
|
- { 0x61, 0x51, 0x49, 0x45, 0x43 }, /* Z */
|
|
|
|
|
- { 0x00, 0x7F, 0x41, 0x41, 0x00 }, /* [ */
|
|
|
|
|
- { 0x02, 0x04, 0x08, 0x10, 0x20 }, /* \ */
|
|
|
|
|
- { 0x00, 0x41, 0x41, 0x7F, 0x00 }, /* ] */
|
|
|
|
|
- { 0x04, 0x02, 0x01, 0x02, 0x04 }, /* ^ */
|
|
|
|
|
- { 0x40, 0x40, 0x40, 0x40, 0x40 }, /* _ */
|
|
|
|
|
- { 0x00, 0x01, 0x02, 0x04, 0x00 }, /* ` */
|
|
|
|
|
- { 0x20, 0x54, 0x54, 0x54, 0x78 }, /* a */
|
|
|
|
|
- { 0x7F, 0x48, 0x44, 0x44, 0x38 }, /* b */
|
|
|
|
|
- { 0x38, 0x44, 0x44, 0x44, 0x20 }, /* c */
|
|
|
|
|
- { 0x38, 0x44, 0x44, 0x48, 0x7F }, /* d */
|
|
|
|
|
- { 0x38, 0x54, 0x54, 0x54, 0x18 }, /* e */
|
|
|
|
|
- { 0x08, 0x7E, 0x09, 0x01, 0x02 }, /* f */
|
|
|
|
|
- { 0x0C, 0x52, 0x52, 0x52, 0x3E }, /* g */
|
|
|
|
|
- { 0x7F, 0x08, 0x04, 0x04, 0x78 }, /* h */
|
|
|
|
|
- { 0x00, 0x44, 0x7D, 0x40, 0x00 }, /* i */
|
|
|
|
|
- { 0x20, 0x40, 0x44, 0x3D, 0x00 }, /* j */
|
|
|
|
|
- { 0x7F, 0x10, 0x28, 0x44, 0x00 }, /* k */
|
|
|
|
|
- { 0x00, 0x41, 0x7F, 0x40, 0x00 }, /* l */
|
|
|
|
|
- { 0x7C, 0x04, 0x18, 0x04, 0x78 }, /* m */
|
|
|
|
|
- { 0x7C, 0x08, 0x04, 0x04, 0x78 }, /* n */
|
|
|
|
|
- { 0x38, 0x44, 0x44, 0x44, 0x38 }, /* o */
|
|
|
|
|
- { 0x7C, 0x14, 0x14, 0x14, 0x08 }, /* p */
|
|
|
|
|
- { 0x08, 0x14, 0x14, 0x18, 0x7C }, /* q */
|
|
|
|
|
- { 0x7C, 0x08, 0x04, 0x04, 0x08 }, /* r */
|
|
|
|
|
- { 0x48, 0x54, 0x54, 0x54, 0x20 }, /* s */
|
|
|
|
|
- { 0x04, 0x3F, 0x44, 0x40, 0x20 }, /* t */
|
|
|
|
|
- { 0x3C, 0x40, 0x40, 0x20, 0x7C }, /* u */
|
|
|
|
|
- { 0x1C, 0x20, 0x40, 0x20, 0x1C }, /* v */
|
|
|
|
|
- { 0x3C, 0x40, 0x30, 0x40, 0x3C }, /* w */
|
|
|
|
|
- { 0x44, 0x28, 0x10, 0x28, 0x44 }, /* x */
|
|
|
|
|
- { 0x0C, 0x50, 0x50, 0x50, 0x3C }, /* y */
|
|
|
|
|
- { 0x44, 0x64, 0x54, 0x4C, 0x44 }, /* z */
|
|
|
|
|
- { 0x00, 0x08, 0x36, 0x41, 0x00 }, /* { */
|
|
|
|
|
- { 0x00, 0x00, 0x7F, 0x00, 0x00 }, /* | */
|
|
|
|
|
- { 0x00, 0x41, 0x36, 0x08, 0x00 }, /* } */
|
|
|
|
|
- { 0x02, 0x01, 0x02, 0x04, 0x02 }, /* ~ */
|
|
|
|
|
|
|
+ { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ' ' */
|
|
|
|
|
+ { 0x00U, 0x00U, 0x4FU, 0x00U, 0x00U }, /* ! */
|
|
|
|
|
+ { 0x00U, 0x07U, 0x00U, 0x07U, 0x00U }, /* " */
|
|
|
|
|
+ { 0x14U, 0x7FU, 0x14U, 0x7FU, 0x14U }, /* # */
|
|
|
|
|
+ { 0x24U, 0x2AU, 0x7FU, 0x2AU, 0x12U }, /* $ */
|
|
|
|
|
+ { 0x23U, 0x13U, 0x08U, 0x64U, 0x62U }, /* % */
|
|
|
|
|
+ { 0x36U, 0x49U, 0x55U, 0x22U, 0x50U }, /* & */
|
|
|
|
|
+ { 0x00U, 0x05U, 0x03U, 0x00U, 0x00U }, /* ' */
|
|
|
|
|
+ { 0x00U, 0x1CU, 0x22U, 0x41U, 0x00U }, /* ( */
|
|
|
|
|
+ { 0x00U, 0x41U, 0x22U, 0x1CU, 0x00U }, /* ) */
|
|
|
|
|
+ { 0x14U, 0x08U, 0x3EU, 0x08U, 0x14U }, /* * */
|
|
|
|
|
+ { 0x08U, 0x08U, 0x3EU, 0x08U, 0x08U }, /* + */
|
|
|
|
|
+ { 0x00U, 0x50U, 0x30U, 0x00U, 0x00U }, /* , */
|
|
|
|
|
+ { 0x08U, 0x08U, 0x08U, 0x08U, 0x08U }, /* - */
|
|
|
|
|
+ { 0x00U, 0x60U, 0x60U, 0x00U, 0x00U }, /* . */
|
|
|
|
|
+ { 0x20U, 0x10U, 0x08U, 0x04U, 0x02U }, /* / */
|
|
|
|
|
+ { 0x3EU, 0x51U, 0x49U, 0x45U, 0x3EU }, /* 0 */
|
|
|
|
|
+ { 0x00U, 0x42U, 0x7FU, 0x40U, 0x00U }, /* 1 */
|
|
|
|
|
+ { 0x42U, 0x61U, 0x51U, 0x49U, 0x46U }, /* 2 */
|
|
|
|
|
+ { 0x21U, 0x41U, 0x45U, 0x4BU, 0x31U }, /* 3 */
|
|
|
|
|
+ { 0x18U, 0x14U, 0x12U, 0x7FU, 0x10U }, /* 4 */
|
|
|
|
|
+ { 0x27U, 0x45U, 0x45U, 0x45U, 0x39U }, /* 5 */
|
|
|
|
|
+ { 0x3CU, 0x4AU, 0x49U, 0x49U, 0x30U }, /* 6 */
|
|
|
|
|
+ { 0x01U, 0x71U, 0x09U, 0x05U, 0x03U }, /* 7 */
|
|
|
|
|
+ { 0x36U, 0x49U, 0x49U, 0x49U, 0x36U }, /* 8 */
|
|
|
|
|
+ { 0x06U, 0x49U, 0x49U, 0x29U, 0x1EU }, /* 9 */
|
|
|
|
|
+ { 0x00U, 0x36U, 0x36U, 0x00U, 0x00U }, /* : */
|
|
|
|
|
+ { 0x00U, 0x56U, 0x36U, 0x00U, 0x00U }, /* ; */
|
|
|
|
|
+ { 0x08U, 0x14U, 0x22U, 0x41U, 0x00U }, /* < */
|
|
|
|
|
+ { 0x14U, 0x14U, 0x14U, 0x14U, 0x14U }, /* = */
|
|
|
|
|
+ { 0x00U, 0x41U, 0x22U, 0x14U, 0x08U }, /* > */
|
|
|
|
|
+ { 0x02U, 0x01U, 0x51U, 0x09U, 0x06U }, /* ? */
|
|
|
|
|
+ { 0x32U, 0x49U, 0x79U, 0x41U, 0x3EU }, /* @ */
|
|
|
|
|
+ { 0x7EU, 0x11U, 0x11U, 0x11U, 0x7EU }, /* A */
|
|
|
|
|
+ { 0x7FU, 0x49U, 0x49U, 0x49U, 0x36U }, /* B */
|
|
|
|
|
+ { 0x3EU, 0x41U, 0x41U, 0x41U, 0x22U }, /* C */
|
|
|
|
|
+ { 0x7FU, 0x41U, 0x41U, 0x22U, 0x1CU }, /* D */
|
|
|
|
|
+ { 0x7FU, 0x49U, 0x49U, 0x49U, 0x41U }, /* E */
|
|
|
|
|
+ { 0x7FU, 0x09U, 0x09U, 0x09U, 0x01U }, /* F */
|
|
|
|
|
+ { 0x3EU, 0x41U, 0x49U, 0x49U, 0x7AU }, /* G */
|
|
|
|
|
+ { 0x7FU, 0x08U, 0x08U, 0x08U, 0x7FU }, /* H */
|
|
|
|
|
+ { 0x00U, 0x41U, 0x7FU, 0x41U, 0x00U }, /* I */
|
|
|
|
|
+ { 0x20U, 0x40U, 0x41U, 0x3FU, 0x01U }, /* J */
|
|
|
|
|
+ { 0x7FU, 0x08U, 0x14U, 0x22U, 0x41U }, /* K */
|
|
|
|
|
+ { 0x7FU, 0x40U, 0x40U, 0x40U, 0x40U }, /* L */
|
|
|
|
|
+ { 0x7FU, 0x02U, 0x0CU, 0x02U, 0x7FU }, /* M */
|
|
|
|
|
+ { 0x7FU, 0x04U, 0x08U, 0x10U, 0x7FU }, /* N */
|
|
|
|
|
+ { 0x3EU, 0x41U, 0x41U, 0x41U, 0x3EU }, /* O */
|
|
|
|
|
+ { 0x7FU, 0x09U, 0x09U, 0x09U, 0x06U }, /* P */
|
|
|
|
|
+ { 0x3EU, 0x41U, 0x51U, 0x21U, 0x5EU }, /* Q */
|
|
|
|
|
+ { 0x7FU, 0x09U, 0x19U, 0x29U, 0x46U }, /* R */
|
|
|
|
|
+ { 0x46U, 0x49U, 0x49U, 0x49U, 0x31U }, /* S */
|
|
|
|
|
+ { 0x01U, 0x01U, 0x7FU, 0x01U, 0x01U }, /* T */
|
|
|
|
|
+ { 0x3FU, 0x40U, 0x40U, 0x40U, 0x3FU }, /* U */
|
|
|
|
|
+ { 0x1FU, 0x20U, 0x40U, 0x20U, 0x1FU }, /* V */
|
|
|
|
|
+ { 0x3FU, 0x40U, 0x38U, 0x40U, 0x3FU }, /* W */
|
|
|
|
|
+ { 0x63U, 0x14U, 0x08U, 0x14U, 0x63U }, /* X */
|
|
|
|
|
+ { 0x07U, 0x08U, 0x70U, 0x08U, 0x07U }, /* Y */
|
|
|
|
|
+ { 0x61U, 0x51U, 0x49U, 0x45U, 0x43U }, /* Z */
|
|
|
|
|
+ { 0x00U, 0x7FU, 0x41U, 0x41U, 0x00U }, /* [ */
|
|
|
|
|
+ { 0x02U, 0x04U, 0x08U, 0x10U, 0x20U }, /* \ */
|
|
|
|
|
+ { 0x00U, 0x41U, 0x41U, 0x7FU, 0x00U }, /* ] */
|
|
|
|
|
+ { 0x04U, 0x02U, 0x01U, 0x02U, 0x04U }, /* ^ */
|
|
|
|
|
+ { 0x40U, 0x40U, 0x40U, 0x40U, 0x40U }, /* _ */
|
|
|
|
|
+ { 0x00U, 0x01U, 0x02U, 0x04U, 0x00U }, /* ` */
|
|
|
|
|
+ { 0x20U, 0x54U, 0x54U, 0x54U, 0x78U }, /* a */
|
|
|
|
|
+ { 0x7FU, 0x48U, 0x44U, 0x44U, 0x38U }, /* b */
|
|
|
|
|
+ { 0x38U, 0x44U, 0x44U, 0x44U, 0x20U }, /* c */
|
|
|
|
|
+ { 0x38U, 0x44U, 0x44U, 0x48U, 0x7FU }, /* d */
|
|
|
|
|
+ { 0x38U, 0x54U, 0x54U, 0x54U, 0x18U }, /* e */
|
|
|
|
|
+ { 0x08U, 0x7EU, 0x09U, 0x01U, 0x02U }, /* f */
|
|
|
|
|
+ { 0x0CU, 0x52U, 0x52U, 0x52U, 0x3EU }, /* g */
|
|
|
|
|
+ { 0x7FU, 0x08U, 0x04U, 0x04U, 0x78U }, /* h */
|
|
|
|
|
+ { 0x00U, 0x44U, 0x7DU, 0x40U, 0x00U }, /* i */
|
|
|
|
|
+ { 0x20U, 0x40U, 0x44U, 0x3DU, 0x00U }, /* j */
|
|
|
|
|
+ { 0x7FU, 0x10U, 0x28U, 0x44U, 0x00U }, /* k */
|
|
|
|
|
+ { 0x00U, 0x41U, 0x7FU, 0x40U, 0x00U }, /* l */
|
|
|
|
|
+ { 0x7CU, 0x04U, 0x18U, 0x04U, 0x78U }, /* m */
|
|
|
|
|
+ { 0x7CU, 0x08U, 0x04U, 0x04U, 0x78U }, /* n */
|
|
|
|
|
+ { 0x38U, 0x44U, 0x44U, 0x44U, 0x38U }, /* o */
|
|
|
|
|
+ { 0x7CU, 0x14U, 0x14U, 0x14U, 0x08U }, /* p */
|
|
|
|
|
+ { 0x08U, 0x14U, 0x14U, 0x18U, 0x7CU }, /* q */
|
|
|
|
|
+ { 0x7CU, 0x08U, 0x04U, 0x04U, 0x08U }, /* r */
|
|
|
|
|
+ { 0x48U, 0x54U, 0x54U, 0x54U, 0x20U }, /* s */
|
|
|
|
|
+ { 0x04U, 0x3FU, 0x44U, 0x40U, 0x20U }, /* t */
|
|
|
|
|
+ { 0x3CU, 0x40U, 0x40U, 0x20U, 0x7CU }, /* u */
|
|
|
|
|
+ { 0x1CU, 0x20U, 0x40U, 0x20U, 0x1CU }, /* v */
|
|
|
|
|
+ { 0x3CU, 0x40U, 0x30U, 0x40U, 0x3CU }, /* w */
|
|
|
|
|
+ { 0x44U, 0x28U, 0x10U, 0x28U, 0x44U }, /* x */
|
|
|
|
|
+ { 0x0CU, 0x50U, 0x50U, 0x50U, 0x3CU }, /* y */
|
|
|
|
|
+ { 0x44U, 0x64U, 0x54U, 0x4CU, 0x44U }, /* z */
|
|
|
|
|
+ { 0x00U, 0x08U, 0x36U, 0x41U, 0x00U }, /* { */
|
|
|
|
|
+ { 0x00U, 0x00U, 0x7FU, 0x00U, 0x00U }, /* | */
|
|
|
|
|
+ { 0x00U, 0x41U, 0x36U, 0x08U, 0x00U }, /* } */
|
|
|
|
|
+ { 0x02U, 0x01U, 0x02U, 0x04U, 0x02U }, /* ~ */
|
|
|
};
|
|
};
|
|
|
UINT dx, dy;
|
|
UINT dx, dy;
|
|
|
|
|
|
|
@@ -429,7 +458,7 @@ void BSP_drawNString(uint8_t x, uint8_t y, char const *str) {
|
|
|
++str;
|
|
++str;
|
|
|
x += 6;
|
|
x += 6;
|
|
|
}
|
|
}
|
|
|
- GraphicDisplay_redraw(&l_oled); /* redraw the updated display */
|
|
|
|
|
|
|
+ GraphicDisplay_redraw(&l_oled); /* redraw the updated display */
|
|
|
}
|
|
}
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
void BSP_updateScore(uint16_t score) {
|
|
void BSP_updateScore(uint16_t score) {
|
|
@@ -452,36 +481,10 @@ void BSP_displayOff(void) {
|
|
|
GraphicDisplay_clear(&l_oled);
|
|
GraphicDisplay_clear(&l_oled);
|
|
|
GraphicDisplay_redraw(&l_oled);
|
|
GraphicDisplay_redraw(&l_oled);
|
|
|
}
|
|
}
|
|
|
-/*..........................................................................*/
|
|
|
|
|
-void BSP_playerTrigger(void) {
|
|
|
|
|
- static QEvt const fireEvt = { PLAYER_TRIGGER_SIG, 0U, 0U };
|
|
|
|
|
- QF_PUBLISH(&fireEvt, (void*)0);
|
|
|
|
|
-}
|
|
|
|
|
-/*..........................................................................*/
|
|
|
|
|
-void BSP_moveShipUp(void) {
|
|
|
|
|
- ObjectPosEvt *ope;
|
|
|
|
|
- if (l_ship_pos > 0U) {
|
|
|
|
|
- --l_ship_pos;
|
|
|
|
|
- }
|
|
|
|
|
- ope = Q_NEW(ObjectPosEvt, PLAYER_SHIP_MOVE_SIG);
|
|
|
|
|
- ope->x = (uint8_t)GAME_SHIP_X;
|
|
|
|
|
- ope->y = (uint8_t)l_ship_pos;
|
|
|
|
|
- QACTIVE_POST(AO_Ship, (QEvt *)ope, &l_mouse);
|
|
|
|
|
-}
|
|
|
|
|
-//............................................................................
|
|
|
|
|
-void BSP_moveShipDown(void) {
|
|
|
|
|
- ObjectPosEvt *ope;
|
|
|
|
|
- if (l_ship_pos < (GAME_SCREEN_HEIGHT - 3U)) {
|
|
|
|
|
- ++l_ship_pos;
|
|
|
|
|
- }
|
|
|
|
|
- ope = Q_NEW(ObjectPosEvt, PLAYER_SHIP_MOVE_SIG);
|
|
|
|
|
- ope->x = (uint8_t)GAME_SHIP_X;
|
|
|
|
|
- ope->y = (uint8_t)l_ship_pos;
|
|
|
|
|
- QACTIVE_POST(AO_Ship, (QEvt *)ope, &l_mouse);
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
/*--------------------------------------------------------------------------*/
|
|
|
-#ifdef Q_SPY /* define QS callbacks */
|
|
|
|
|
|
|
+#ifdef Q_SPY /* define QS callbacks */
|
|
|
|
|
|
|
|
#include "qspy.h"
|
|
#include "qspy.h"
|
|
|
#include <time.h>
|
|
#include <time.h>
|
|
@@ -503,17 +506,17 @@ static DWORD WINAPI idleThread(LPVOID par) {/* signature for CreateThread() */
|
|
|
if (block != (uint8_t *)0) {
|
|
if (block != (uint8_t *)0) {
|
|
|
QSPY_parse(block, nBytes);
|
|
QSPY_parse(block, nBytes);
|
|
|
}
|
|
}
|
|
|
- Sleep(10U); /* wait for a while */
|
|
|
|
|
|
|
+ Sleep(10U); /* wait for a clock tick of 10ms */
|
|
|
}
|
|
}
|
|
|
- return 0; /* return success */
|
|
|
|
|
|
|
+ return 0U; /* return success */
|
|
|
}
|
|
}
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
static int custParserFun(QSpyRecord * const qrec) {
|
|
static int custParserFun(QSpyRecord * const qrec) {
|
|
|
static uint32_t mpool1;
|
|
static uint32_t mpool1;
|
|
|
- int ret = 1; /* perform standard QSPY parsing */
|
|
|
|
|
|
|
+ int ret = 1; /* perform standard QSPY parsing */
|
|
|
switch (qrec->rec) {
|
|
switch (qrec->rec) {
|
|
|
- case QS_QF_MPOOL_INIT: { /* example record to parse */
|
|
|
|
|
- if (mpool1 == 1U) { /* MPool[1]? */
|
|
|
|
|
|
|
+ case QS_QF_MPOOL_INIT: { /* example record to parse */
|
|
|
|
|
+ if (mpool1 == 1U) { /* MPool[1]? */
|
|
|
mpool1 = (uint32_t)QSpyRecord_getUint64(qrec,QS_OBJ_PTR_SIZE);
|
|
mpool1 = (uint32_t)QSpyRecord_getUint64(qrec,QS_OBJ_PTR_SIZE);
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -521,7 +524,7 @@ static int custParserFun(QSpyRecord * const qrec) {
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- case QS_QF_MPOOL_GET: { /* example record to parse */
|
|
|
|
|
|
|
+ case QS_QF_MPOOL_GET: { /* example record to parse */
|
|
|
int nFree;
|
|
int nFree;
|
|
|
uint32_t mpool;
|
|
uint32_t mpool;
|
|
|
(void)QSpyRecord_getUint32(qrec, QS_TIME_SIZE);
|
|
(void)QSpyRecord_getUint32(qrec, QS_TIME_SIZE);
|
|
@@ -530,7 +533,7 @@ static int custParserFun(QSpyRecord * const qrec) {
|
|
|
(void)QSpyRecord_getUint32(qrec, QF_MPOOL_CTR_SIZE); /* nMin */
|
|
(void)QSpyRecord_getUint32(qrec, QF_MPOOL_CTR_SIZE); /* nMin */
|
|
|
if (QSpyRecord_OK(qrec) && (mpool == mpool1)) { /* MPool[1]? */
|
|
if (QSpyRecord_OK(qrec) && (mpool == mpool1)) { /* MPool[1]? */
|
|
|
SetDlgItemInt(l_hWnd, IDC_MPOOL0, nFree, FALSE);
|
|
SetDlgItemInt(l_hWnd, IDC_MPOOL0, nFree, FALSE);
|
|
|
- ret = 0; /* don't perform standard QSPY parsing */
|
|
|
|
|
|
|
+ ret = 0; /* don't perform standard QSPY parsing */
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -539,7 +542,7 @@ static int custParserFun(QSpyRecord * const qrec) {
|
|
|
}
|
|
}
|
|
|
/*..........................................................................*/
|
|
/*..........................................................................*/
|
|
|
uint8_t QS_onStartup(void const *arg) {
|
|
uint8_t QS_onStartup(void const *arg) {
|
|
|
- static uint8_t qsBuf[4*1024]; // 4K buffer for Quantum Spy
|
|
|
|
|
|
|
+ static uint8_t qsBuf[4*1024]; // 4K buffer for Quantum Spy
|
|
|
QS_initBuf(qsBuf, sizeof(qsBuf));
|
|
QS_initBuf(qsBuf, sizeof(qsBuf));
|
|
|
|
|
|
|
|
/* here 'arg' is ignored, but this command-line parameter can be used
|
|
/* here 'arg' is ignored, but this command-line parameter can be used
|
|
@@ -673,5 +676,5 @@ void QSPY_onPrintLn(void) {
|
|
|
OutputDebugString(QSPY_line);
|
|
OutputDebugString(QSPY_line);
|
|
|
OutputDebugString("\n");
|
|
OutputDebugString("\n");
|
|
|
}
|
|
}
|
|
|
-#endif /* Q_SPY */
|
|
|
|
|
|
|
+#endif /* Q_SPY */
|
|
|
/*--------------------------------------------------------------------------*/
|
|
/*--------------------------------------------------------------------------*/
|