Пример #1
0
void wxsItemEditor::RebuildIcons()
{
    RebuildInsTypeIcons();
    RebuildQuickPropsIcon();
    m_DelBtn->SetBitmapLabel(m_DelImg);
    m_PreviewBtn->SetBitmapLabel(m_PreviewImg);
    BuildPalette(m_WidgetsSet);
    Layout();
}
Пример #2
0
void wxsItemEditor::InitializeVisualStuff()
{
    // Loading images if needed
    InitializeImages();

    // Creating content of editor window
    m_VertSizer = new wxBoxSizer(wxVERTICAL);
    m_WidgetsSet = new wxNotebook(this,-1);
    BuildPalette(m_WidgetsSet);
    m_ToolSpace = new wxsToolSpace(this,m_Data);
    m_VertSizer->Add(m_ToolSpace,0,wxEXPAND);
    m_HorizSizer = new wxBoxSizer(wxHORIZONTAL);
    m_VertSizer->Add(m_HorizSizer,1,wxEXPAND);
    m_VertSizer->Add(m_WidgetsSet,0,wxEXPAND);

    m_Content = new wxsItemEditorContent(this,m_Data,this);
    m_HorizSizer->Add(m_Content,1,wxEXPAND);

    m_QPArea = new wxScrolledWindow(this,-1,wxDefaultPosition,wxDefaultSize,wxVSCROLL|wxSUNKEN_BORDER|wxALWAYS_SHOW_SB);
    m_QPArea->SetScrollbars(0,5,0,0);
    m_HorizSizer->Add(m_QPArea,0,wxEXPAND);
    m_QPSizer = new wxBoxSizer(wxVERTICAL);
    m_QPArea->SetSizer(m_QPSizer);

    m_OpsSizer = new wxBoxSizer(wxVERTICAL);
    m_HorizSizer->Add(m_OpsSizer,0,wxEXPAND);

    m_OpsSizer->Add(m_InsPointBtn  = new wxBitmapButton(this,wxsInsPointId,m_InsPointImg));
    m_OpsSizer->Add(m_InsIntoBtn   = new wxBitmapButton(this,wxsInsIntoId,m_InsIntoImg));
    m_OpsSizer->Add(m_InsBeforeBtn = new wxBitmapButton(this,wxsInsBeforeId,m_InsBeforeImg));
    m_OpsSizer->Add(m_InsAfterBtn  = new wxBitmapButton(this,wxsInsAfterId,m_InsAfterImg));
    m_OpsSizer->Add(1,5);
    m_OpsSizer->Add(m_DelBtn       = new wxBitmapButton(this,wxsDelId,m_DelImg));
    m_OpsSizer->Add(m_PreviewBtn   = new wxBitmapButton(this,wxsPreviewId,m_PreviewImg));
    m_OpsSizer->Add(1,5);
    m_OpsSizer->Add(m_QuickPanelBtn = new wxBitmapButton(this,wxsQuickPropsId,m_QuickPropsImgOpen));
    m_InsPointBtn  ->SetToolTip(_("Insert new widgets by pointing with mouse"));
    m_InsIntoBtn   ->SetToolTip(_("Insert new widgets into current selection"));
    m_InsBeforeBtn ->SetToolTip(_("Insert new widgets before current selection"));
    m_InsAfterBtn  ->SetToolTip(_("Insert new widgets after current selection"));
    m_DelBtn       ->SetToolTip(_("Delete current selection"));
    m_PreviewBtn   ->SetToolTip(_("Show preview"));
    m_QuickPanelBtn->SetToolTip(_("Open / Close Quick Properties panel"));
    SetSizer(m_VertSizer);

    SetInsertionTypeMask(0);
    ToggleQuickPropsPanel(false);       // TODO: Shouldn't store initial state of panel somewhere?

    RebuildPreview();
    UpdateSelection();
}
Пример #3
0
void Terrain()
{
    // Allocate the offscreen bitmap
    offMap = CreateBitmap(256, 200);
    if (!offMap) return;

    // Allocate the surface maps
    if (!ISurface()) return;

	// Build tables
	BuildProjectionTable();
                
    // Attempt to randomize
    gSeed = time(NULL) + clock();
        
    // Generate the fractal surface
    Fractify(0, 0, 256, 256);
	Smoothify();
	
    // Build obelisk
    for (int j=-3; j<4; j++)
    	for (int i=-3; i<4; i++)
        	Point(128+i, 128+j) = 240;
        
    // Generate the palette
    BuildPalette();
    // Colorize the surface (w/ sealevel  parameter)
    Colorize(80);

    // Initialize values
	int elev = 10 << (YFIX+FIX);
    gX = gY = gZ = 0;
   	gY = HeightAt(gX, gZ) + elev;

    // Do some display
    int  mx, my;
    char q = 0, clr=0;
    int  c, f = 0;
    char msg[80];
	
    clock_t clk = clock();
    while (!q)
    {
		// Count the frame
        f++;

        //------------Refresh the display-------------
        // Clear the offmap
        ClearScreen(254, 256, 200, offMap);
        // Draw the surface
		Caster();
        // Copy the offmap to the screen                
        Display(offMap, 256, 200);

        //------------Handle user input-------------
        MouseMove(&mx, &my);
        if (mx || my)
        {
            gZ -= my;
            gZ = gZ & 4095;
                        
            gX += mx;
            gX = gX & 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }
        else if (kbhit())
        {
            c = getch();
            switch (c)
            {
                case 0:
                	c = getch();
                    switch (c)
                    {
                        case UP_ARROW_KEY:
                                gZ += 1;
                                break;

                        case DN_ARROW_KEY:
                                gZ -= 1;
                                break;
                                        
                        case LF_ARROW_KEY:
                                gX -= 1;
                                break;

                        case RT_ARROW_KEY:
                                gX += 1;
                            break;
                    }   
                    break;
                                
                case 'w':
                	elev += 8;
                	break;

                case 'x':
                	elev -= 8;
                	 break;

                case ESC_KEY:
                	q = 1;
               		break;
            }

            gZ &= 4095;
            gX &= 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }                                   
    }
    clk = clock() - clk;
    
    _settextposition(1, 2);
    _settextcolor(255);
    sprintf(msg, "Frames: %ld,  Time: %5.2fs,  FPS: %5.2f\n", f, clk/(float)CLOCKS_PER_SEC, f * (float)CLOCKS_PER_SEC / clk);
    _outtext(msg);
}