📄 nx.cc
字号:
/* * Copyright (C) 200-2002 Century Embedded Techonlogies * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include "objects.h"#include "NX.h"//static int in_popup = 0;/**********************//* Callback functions *//**********************/voidnew_game_cb(GR_WINDOW_ID w){ game.start(1);}voidquit_game_cb(GR_WINDOW_ID w){ game.quit();}voidget_coords(GR_EVENT * event, int *x, int *y){ *x = event->mouse.x; *y = event->mouse.y;}#ifdef NOTUSEDvoidpopup(Widget w, Widget * box, XtPointer call_data){ Position x, y; in_popup = 1;#ifdef athena get_coords(&x, &y); XtMoveWidget(XtParent(*box), x, y);#endif XtManageChild(*box); XtAddCallback(XtParent(*box), XtNpopdownCallback, (XtCallbackProc) popdown, NULL); XtPopup(XtParent(*box), XtGrabExclusive); while (in_popup || XtAppPending(ui.app)) XtAppProcessEvent(ui.app, XtIMXEvent);}voidpopdown(Widget w, XtPointer client_data, XtPointer call_data){ in_popup = 0;}#endif/******************//* Event handlers *//******************/voidredraw_menubar_eh(GR_EVENT * event){ ui.redraw_menubar();}voidmenubar_buttonup_eh(GR_EVENT * event){ ui.menubar_buttonup(event->button.x, event->button.y);}voidmenubar_buttondown_eh(GR_EVENT * event){ /* NOP */}voidleave_window_eh(GR_EVENT * event){ ui.pause_game();}voidenter_window_eh(GR_EVENT * event){ ui.resume_game();}voidredraw_window_eh(GR_EVENT * event){ ui.refresh();}voidbutton_press_eh(GR_EVENT * event){ game.button_press(event->button.x, event->button.y);}voidbutton_release_eh(GR_EVENT * event){ game.button_release(event->button.x, event->button.y);}voidtimer_eh(){ ui.restart_timer(); game.update();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -