wow
This commit is contained in:
parent
580bdaa245
commit
dfe5190d72
72
main.c
72
main.c
|
@ -42,23 +42,6 @@
|
|||
#define WINDOW_TITLE "Topaz's Pizza Timer"
|
||||
#define WINDOW_CHROME_WIDTH (4)
|
||||
|
||||
struct NewWindow winlayout = {
|
||||
20, 20, // x, y
|
||||
WINDOW_WIDTH, WINDOW_HEIGHT, // w, h
|
||||
0, 1, // detailpen, blockpen,
|
||||
// you have to add the different gadget types you're looking for
|
||||
// http://amigadev.elowar.com/read/ADCD_2.1/Includes_and_Autodocs_2._guide/node0106.html
|
||||
IDCMP_REFRESHWINDOW | IDCMP_CLOSEWINDOW | BUTTONIDCMP | SLIDERIDCMP | IDCMP_MENUPICK, // IDCMP flags
|
||||
WFLG_SMART_REFRESH | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE, // window flag from Window struct
|
||||
NULL, // FirstGadget
|
||||
NULL, // menu checkmark
|
||||
WINDOW_TITLE, // title
|
||||
NULL, // default screen
|
||||
NULL, // bitmap
|
||||
WINDOW_WIDTH, WINDOW_HEIGHT, // min size
|
||||
WINDOW_WIDTH, WINDOW_HEIGHT, // max size,
|
||||
WBENCHSCREEN // screen where you want the window to open
|
||||
};
|
||||
struct Screen *screen;
|
||||
struct Window *window;
|
||||
struct Gadget *windowGadgets;
|
||||
|
@ -66,22 +49,6 @@ struct Gadget *windowGadgets;
|
|||
#define ABOUT_WINDOW_WIDTH (350)
|
||||
#define ABOUT_WINDOW_HEIGHT (75)
|
||||
|
||||
struct NewWindow aboutWindowLayout = {
|
||||
40, 40,
|
||||
ABOUT_WINDOW_WIDTH, ABOUT_WINDOW_HEIGHT,
|
||||
0, 1,
|
||||
IDCMP_CLOSEWINDOW,
|
||||
WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE,
|
||||
NULL,
|
||||
NULL,
|
||||
"About Pizza Timer",
|
||||
NULL,
|
||||
NULL,
|
||||
ABOUT_WINDOW_WIDTH, ABOUT_WINDOW_HEIGHT,
|
||||
ABOUT_WINDOW_WIDTH, ABOUT_WINDOW_HEIGHT,
|
||||
WBENCHSCREEN
|
||||
};
|
||||
|
||||
// Fonts!
|
||||
struct TextAttr Topaz80 = { "topaz.font", 8, 0, 0 };
|
||||
|
||||
|
@ -532,7 +499,18 @@ int openAboutWindow(void) {
|
|||
// nope, false positive, checked with avail before and after running and
|
||||
// the used/free counts are exactly the same:
|
||||
// https://eab.abime.net/showthread.php?t=104360
|
||||
aboutWindow = OpenWindow(&aboutWindowLayout);
|
||||
aboutWindow = OpenWindowTags(NULL,
|
||||
WA_Left, 40, WA_Top, 40,
|
||||
WA_Width, ABOUT_WINDOW_WIDTH, WA_Height, ABOUT_WINDOW_HEIGHT,
|
||||
WA_DetailPen, 0, WA_BlockPen, 1,
|
||||
WA_IDCMP, IDCMP_CLOSEWINDOW,
|
||||
WA_DragBar, TRUE,
|
||||
WA_DepthGadget, TRUE,
|
||||
WA_CloseGadget, TRUE,
|
||||
WA_Activate, TRUE,
|
||||
WA_Title, "Acout Pizza Timer",
|
||||
TAG_END
|
||||
);
|
||||
|
||||
if (!aboutWindow) {
|
||||
return 1;
|
||||
|
@ -743,7 +721,7 @@ void startBellSound(void) {
|
|||
|
||||
// eventually wait for the sound to stop playing
|
||||
TimerIO->tr_node.io_Command = TR_ADDREQUEST;
|
||||
TimerIO->tr_time.tv_secs = 3;
|
||||
TimerIO->tr_time.tv_secs = 2;
|
||||
TimerIO->tr_time.tv_micro = 0;
|
||||
SendIO((struct IORequest *)TimerIO);
|
||||
}
|
||||
|
@ -759,6 +737,11 @@ void waitForBellToFinish(void) {
|
|||
if (bellSound) {
|
||||
TimerPort = TimerIO->tr_node.io_Message.mn_ReplyPort;
|
||||
|
||||
// TODO: move this into the main event loop, so that
|
||||
// we can update the UI while the sound is finishing up?
|
||||
// I'm sure there is a way to add metadata to an IO request.
|
||||
// or do we need two timer.devices with two separate IOs?
|
||||
// https://amigadev.elowar.com/read/ADCD_2.1/Devices_Manual_guide/node00C4.html
|
||||
timerSignal = 1L << TimerPort->mp_SigBit;
|
||||
Wait(timerSignal);
|
||||
|
||||
|
@ -776,13 +759,13 @@ void endTimer(void) {
|
|||
uiHours = uiMinutes = uiSeconds = 0;
|
||||
setTimerText();
|
||||
|
||||
waitForBellToFinish();
|
||||
|
||||
timerIsRunning = FALSE;
|
||||
timerStarted = FALSE;
|
||||
|
||||
clearUI();
|
||||
renderUI();
|
||||
|
||||
waitForBellToFinish();
|
||||
}
|
||||
|
||||
void handleTimerMessage(void) {
|
||||
|
@ -837,7 +820,20 @@ int main() {
|
|||
timerIsRunning = FALSE;
|
||||
|
||||
// open the empty window
|
||||
window = OpenWindow(&winlayout);
|
||||
window = OpenWindowTags(NULL,
|
||||
WA_Left, 20, WA_Top, 20,
|
||||
WA_Width, WINDOW_WIDTH, WA_Height, WINDOW_HEIGHT,
|
||||
WA_DetailPen, 0, WA_BlockPen, 1,
|
||||
WA_IDCMP, IDCMP_REFRESHWINDOW | IDCMP_CLOSEWINDOW | BUTTONIDCMP | SLIDERIDCMP | IDCMP_MENUPICK, // IDCMP flags
|
||||
WA_SmartRefresh, TRUE,
|
||||
WA_DragBar, TRUE,
|
||||
WA_DepthGadget, TRUE,
|
||||
WA_CloseGadget, TRUE,
|
||||
WA_Activate, TRUE,
|
||||
WA_Title, WINDOW_TITLE,
|
||||
TAG_END
|
||||
);
|
||||
|
||||
if (!window) {
|
||||
teardown();
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue