void Visualisation::check_input(GLfloat delta_time)
    {
        if (main_window->check1Key())
        {
            initContainer();
            loader->applyAlgorithm(new Algorithm::ConstructionAlgorithm(loader->getContainer(), loader->getPackages()));
        }

        if (main_window->check2Key())
        {
            initContainer();
            loader->applyAlgorithm(new Algorithm::SimulatedAnnealing(loader->getContainer(), loader->getPackages()));
        }

        if (main_window->check3Key())
        {
            initContainer();
            loader->applyAlgorithm(new Algorithm::TabuSearch(loader->getContainer(), loader->getPackages()));
        }

        if (main_window->checkUpKey() && !pressed)
        {
            pressed = true;
            loader->singleStep();
            printResulst();
        }

        if (main_window->checkDownKey() && !pressed)
        {
            pressed = true;
            loader->run(5000);
            printResulst();
        }

        if (main_window->checkLeftKey())
        {
            camera->rotate_left(delta_time);
        }

        if (main_window->checkRightKey())
        {
            camera->rotate_right(delta_time);
        }

        if (main_window->check_add_key())
        {
            camera->zoom_in(delta_time);
        }

        if (main_window->check_subtract_key())
        {
            camera->zoom_out(delta_time);
        }

        if (!main_window->checkUpKey() && !main_window->checkDownKey())
            pressed = false;
    }
bool EquipContainer::init()
{
    bool bRet=false;
    do
    {
        if (!Node::init()) {
            break;
        }
        initContainer();
        bRet=true;
    }while(0);
    return bRet;
}
bool PortRepairLayer::init()
{
    bool bRet=false;
    do
    {
        if (!Layer::init()) {
            break;
        }
        initLayer();
        initContainer();

        bRet=true;
    } while(0);
    return bRet;
}
Esempio n. 4
0
SectionContainer::SectionContainer(const SectionContainer& _rhs, Section* _section) : m_section(0), m_layer(0), m_rootSection(0), m_sectionModel(0)
{
    initContainer(_section, _rhs.m_rootSection);
    KoShapeOdfSaveHelper saveHelper(_rhs.m_layer->shapes());
    KoDrag drag;
    drag.setOdf(KoOdf::mimeType(KoOdf::Text), saveHelper);
    QMimeData* mimeData = drag.mimeData();

    Q_ASSERT(mimeData->hasFormat(KoOdf::mimeType(KoOdf::Text)));

    SectionContainerShapePaste paste(this, m_layer, _section->layout());
    bool success = paste.paste(KoOdf::Text, mimeData);
    Q_ASSERT(success); Q_UNUSED(success)

    delete mimeData;
}
    Visualisation::Visualisation()
    {
        pressed = false;
        loader = nullptr;

        try
        {
            main_window = new Engine::Window(1024, 768, "Container loading");
            main_window->create();

            render = new Engine::Render();

            camera = new Engine::Camera(render->getProgramID());
            camera->init();

            initContainer();
            loader->applyAlgorithm(new Algorithm::ConstructionAlgorithm(loader->getContainer(), loader->getPackages()));
        }
        catch (std::string s)
        {
            std::cout << s << std::endl;
        }
    }
Esempio n. 6
0
SectionContainer::SectionContainer(Section* section, RootSection* _rootSection) : m_section(0), m_layer(0), m_rootSection(0), m_sectionModel(0)
{
    initContainer(section, _rootSection);
}
Esempio n. 7
0
// コンストラクタ
RippleFactory::RippleFactory()
{
	// コンテナの初期化
	initContainer();
}
Esempio n. 8
0
const char *uiInit(uiInitOptions *o)
{
	STARTUPINFOW si;
	const char *ce;
	HICON hDefaultIcon;
	HCURSOR hDefaultCursor;
	NONCLIENTMETRICSW ncm;
	INITCOMMONCONTROLSEX icc;
	HRESULT hr;

	options = *o;

	initAlloc();

	nCmdShow = SW_SHOWDEFAULT;
	GetStartupInfoW(&si);
	if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
		nCmdShow = si.wShowWindow;

	SetProcessDPIAware();

	hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
	if (hDefaultIcon == NULL)
		return ieLastErr("loading default icon for window classes");
	hDefaultCursor = LoadCursorW(NULL, IDC_ARROW);
	if (hDefaultCursor == NULL)
		return ieLastErr("loading default cursor for window classes");

	ce = initUtilWindow(hDefaultIcon, hDefaultCursor);
	if (ce != NULL)
		return initerr(ce, L"GetLastError() ==", GetLastError());

	if (registerWindowClass(hDefaultIcon, hDefaultCursor) == 0)
		return ieLastErr("registering uiWindow window class");

	ZeroMemory(&ncm, sizeof (NONCLIENTMETRICSW));
	ncm.cbSize = sizeof (NONCLIENTMETRICSW);
	if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof (NONCLIENTMETRICSW), &ncm, sizeof (NONCLIENTMETRICSW)) == 0)
		return ieLastErr("getting default fonts");
	hMessageFont = CreateFontIndirectW(&(ncm.lfMessageFont));
	if (hMessageFont == NULL)
		return ieLastErr("loading default messagebox font; this is the default UI font");

	if (initContainer(hDefaultIcon, hDefaultCursor) == 0)
		return ieLastErr("initializing uiWindowsMakeContainer() window class");

	hollowBrush = (HBRUSH) GetStockObject(HOLLOW_BRUSH);
	if (hollowBrush == NULL)
		return ieLastErr("getting hollow brush");

	ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
	icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
	icc.dwICC = wantedICCClasses;
	if (InitCommonControlsEx(&icc) == 0)
		return ieLastErr("initializing Common Controls");

	hr = CoInitialize(NULL);
	if (hr != S_OK && hr != S_FALSE)
		return ieHRESULT("initializing COM", hr);
	// LONGTERM initialize COM security
	// LONGTERM (windows vista) turn off COM exception handling

	hr = initDraw();
	if (hr != S_OK)
		return ieHRESULT("initializing Direct2D", hr);

	hr = initDrawText();
	if (hr != S_OK)
		return ieHRESULT("initializing DirectWrite", hr);

	if (registerAreaClass(hDefaultIcon, hDefaultCursor) == 0)
		return ieLastErr("registering uiArea window class");

	if (registerMessageFilter() == 0)
		return ieLastErr("registering libui message filter");

	if (registerD2DScratchClass(hDefaultIcon, hDefaultCursor) == 0)
		return ieLastErr("initializing D2D scratch window class");

	return NULL;
}
Esempio n. 9
-1
File: init.c Progetto: mantyr/libui
const char *uiInit(uiInitOptions *o)
{
    STARTUPINFOW si;
    const char *ce;
    HICON hDefaultIcon;
    HCURSOR hDefaultCursor;
    NONCLIENTMETRICSW ncm;
    INITCOMMONCONTROLSEX icc;
    HRESULT hr;

    options = *o;

    if (initAlloc() == 0)
        return loadLastError("error initializing memory allocations");

    initResizes();

    nCmdShow = SW_SHOWDEFAULT;
    GetStartupInfoW(&si);
    if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
        nCmdShow = si.wShowWindow;

    hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
    if (hDefaultIcon == NULL)
        return loadLastError("loading default icon for window classes");
    hDefaultCursor = LoadCursorW(NULL, IDC_ARROW);
    if (hDefaultCursor == NULL)
        return loadLastError("loading default cursor for window classes");

    ce = initUtilWindow(hDefaultIcon, hDefaultCursor);
    if (ce != NULL)
        return loadLastError(ce);

    if (registerWindowClass(hDefaultIcon, hDefaultCursor) == 0)
        return loadLastError("registering uiWindow window class");

    ZeroMemory(&ncm, sizeof (NONCLIENTMETRICSW));
    ncm.cbSize = sizeof (NONCLIENTMETRICSW);
    if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof (NONCLIENTMETRICSW), &ncm, sizeof (NONCLIENTMETRICSW)) == 0)
        return loadLastError("getting default fonts");
    hMessageFont = CreateFontIndirectW(&(ncm.lfMessageFont));
    if (hMessageFont == NULL)
        return loadLastError("loading default messagebox font; this is the default UI font");

    if (initContainer(hDefaultIcon, hDefaultCursor) == 0)
        return loadLastError("initializing uiMakeContainer() window class");

    if (SetConsoleCtrlHandler(consoleCtrlHandler, TRUE) == 0)
        return loadLastError("setting up console end session handler");

    hollowBrush = (HBRUSH) GetStockObject(HOLLOW_BRUSH);
    if (hollowBrush == NULL)
        return loadLastError("getting hollow brush");

    ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
    icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
    icc.dwICC = wantedICCClasses;
    if (InitCommonControlsEx(&icc) == 0)
        return loadLastError("initializing Common Controls");

    if (initDialogHelper(hDefaultIcon, hDefaultCursor) == 0)
        return loadLastError("initializing the dialog helper");

    hr = CoInitialize(NULL);
    if (hr != S_OK && hr != S_FALSE)
        return loadHRESULT("initializing COM", hr);
    // TODO initialize COM security
    // TODO (windows vista) turn off COM exception handling

    return NULL;
}