예제 #1
0
void         g_module_unload()
{
    PRINTF("unloading libS52.so ...\n");

    S52_done();

    return;
}
예제 #2
0
static int      _s52_done       (s52engine *engine)
{
    (void)engine;

    S52_done();

    return TRUE;
}
예제 #3
0
파일: s52glx.c 프로젝트: sduclos/S52
int main(int argc, char* argv[])
{
    (void)argc;
    (void)argv;

    Display     *dpy = _getXdis  ();
    XVisualInfo *vis = _getXvis  (dpy, _attr);
    Window       win = _setXwin  (dpy, vis);
    GLXContext   ctx = _getGLXctx(dpy, vis);

    // bind the rendering context to the window
    Bool ret = glXMakeCurrent(dpy, win, ctx);
    if (False == ret) {
        printf("ERROR: glXMakeCurrent() fail\n");
        exit(0);
    }

    {   // init S52 lib (Screen No 0)
#ifdef SET_SCREEN_SIZE
        int w      = 1280;
        int h      = 1024;
        int wmm    = 376;
        int hmm    = 307;
#else
        int h   = XDisplayHeight  (dpy, 0);
        int hmm = XDisplayHeightMM(dpy, 0);
        int w   = XDisplayWidth   (dpy, 0);
        int wmm = XDisplayWidthMM (dpy, 0);
#endif
        S52_init(w, h, wmm, hmm, NULL);
    }

    // differ from w/h
    S52_setViewPort(0, 0, WIDTH, HEIGHT);

    /* debug - use for timing rendering
    S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_SY);
    //S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_LS);
    S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_LC);
    S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_AC);
    S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_AP);
    S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_TX);
    //*/

    // load cell from s52.cfg
    S52_loadCell(NULL, NULL);

    { // main loop
        XEvent event;
        while (True) {
            do {
                XNextEvent(dpy, &event);
                switch (event.type) {
                case ConfigureNotify: break;
                //case GraphicsExpose:
                //    S52_setViewPort(0, 0, event.xconfigure.width, event.xconfigure.height); break;
                //case ...

                case KeyPress:
                case KeyRelease:
                    {
                        unsigned int keycode = ((XKeyEvent *)&event)->keycode;
                        unsigned int keysym  = XkbKeycodeToKeysym(dpy, keycode, 0, 1);

                        // ESC - quit
                        if (XK_Escape == keysym) {
                            goto exit;
                        }
                    }
                }
            } while (XPending(dpy));
            S52_draw();
            S52_drawLast();  // nothing to do

            glXSwapBuffers(dpy,  win);
        }
    }

exit:

    XKillClient(dpy, win);

    S52_done();

    return True;
}
예제 #4
0
파일: s52gv.c 프로젝트: MasterLivens/S52
static void _destroy(GtkWidget *widget, gpointer data)
{
    S52_done();

    gtk_main_quit();
}