Exemplo n.º 1
0
WinFrame::WinFrame(const wxString& title, const wxPoint& pos, const wxSize& size) :
    wxFrame( nullptr, wxID_ANY, title, pos, size, GetStyle() )
{
#ifdef AC_MULTI_THREADED
    computing_ = false;
#endif

#ifdef _WINDOWS
    SetIcon(wxICON(app_icon));
#endif

    Ac::SetFloatPrecision(50);

    /* Create window layout */
    CreateStatBar();
    CreateFont();
    CreateInputCtrl();
    CreateOutputCtrl();
    CreateMenuItems();

    SetMinClientSize(wxSize(300, 100));

    Bind(wxEVT_CLOSE_WINDOW, &WinFrame::OnClose, this);
    Bind(wxEVT_SIZE, &WinFrame::OnResize, this);

    Centre();

    ShowIntro();

    LoadConfig(configFilename);
}
Exemplo n.º 2
0
static bool tcInit(void)
{
    SDL_Init(0);

    if (setup.Debug >= ERR_DEBUG) {
        pcErrOpen(ERR_OUTPUT_TO_DISK, "debug.txt");
    } else {
        pcErrOpen(ERR_NO_OUTPUT, NULL);
    }

    InitAudio();

    StdBuffer1 = TCAllocMem(STD_BUFFER1_SIZE, true);
    StdBuffer0 = TCAllocMem(STD_BUFFER0_SIZE, true);

    if (!StdBuffer0 || !StdBuffer1) {
        return false;
    }

    if (setup.CDAudio) {
        if ((CDRomInstalled = CDROM_Install())) {
            CDROM_WaitForMedia();
            return false;
        }
    }

    gfxInit();
    SDL_WM_SetCaption("Der Clou!", NULL);

    sndInit();

    if (!(GamePlayMode & GP_NO_SAMPLES))
        sndInitFX();

    ShowIntro();

    /* Start game. */
    inpOpenAllInputDevs();

    txtInit(AutoDetectLanguage());

    AutoDetectVersion();

    InitAnimHandler();

    dbInit();
    plInit();

    gfxCollToMem(128, &StdRP0InMem);    /* cache Menu in StdRP0InMem */
    gfxCollToMem(129, &StdRP1InMem);    /* cache Bubbles in StdRP1InMem */

    CurrentBackground = BGD_LONDON;
    return true;
}
Exemplo n.º 3
0
bool WinFrame::ExecExpr(const std::string& expr)
{
    /* If expression is empty -> show information */
    if (expr.empty())
        ShowIntro();
    else if (expr == "exit")
    {
        /* Clear input to avoid storing "exit" in the config-file */
        SetInput("");
        Close();
    }
    else if (expr == "demo")
        ShowDemo();
    else if (expr == "const")
        ShowConstants();
    else if (expr == "clear")
    {
        constantsSet_.constants.clear();
        constantsSet_.ResetStd();
        ShowConstants();
    }
    else
    {
        /* Setup compute mode */
        Ac::ComputeMode mode;
        mode.degree = GetOptionDegree();

        /* Show status message */
        SetOutput("computing ...");

#ifdef AC_MULTI_THREADED

        /* Wait until previous thread has successfully terminated */
        if (computing_)
            return false;
        JoinThread();

#endif

        /* Compute expression */
#ifdef AC_MULTI_THREADED

        computing_ = true;
        thread_ = std::unique_ptr<std::thread>(new std::thread(&WinFrame::ComputeThreadProc, this, expr, mode));

#else

        ComputeThreadProc(expr.ToStdString(), mode);

#endif
    }

    return true;
}
Exemplo n.º 4
0
void WinFrame::OnMenuItem(wxCommandEvent& event)
{
    switch (event.GetId())
    {
    case MENU_QUIT:
        Close();
        break;
    case MENU_INTRO:
        ShowIntro();
        break;
    case MENU_DEMO:
        ShowDemo();
        break;
    case MENU_INFO:
        ShowAbout();
        break;
    }
}