Example #1
0
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

#ifdef __WXGTK20__
    // Draw grip first
    if ( ShowsSizeGrip() )
    {
        const wxRect& rc = GetSizeGripRect();
        GdkWindowEdge edge =
            GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST :
                                                           GDK_WINDOW_EDGE_SOUTH_EAST;
        gtk_paint_resize_grip( m_widget->style,
                            GTKGetDrawingWindow(),
                            (GtkStateType) GTK_WIDGET_STATE (m_widget),
                            NULL,
                            m_widget,
                            "statusbar",
                            edge,
                            rc.x, rc.y, rc.width, rc.height );
    }
#endif // __WXGTK20__

    if (GetFont().IsOk())
        dc.SetFont(GetFont());

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
    for (size_t i = 0; i < m_panes.GetCount(); i ++)
        DrawField(dc, i, textHeight);
}
Example #2
0
int main() {
	ConsoleInit();
	DrawField();
	DrawBaord();


	SetCur(0, 0);
}
Example #3
0
int main() {
    ConsoleInit();
    DrawField();
    CreateBoard();
    StartGame();

    SetCursors(0, 0);
}
Example #4
0
void CGroundHandler::DrawModus3(int index, int radius, int id)
{
	while (groundRadiusMan.HasNextElement())
	{
		aktElem = index + groundRadiusMan.GetNextElement(); // da der Wert relativ zum angeklickten Feld ist
		DrawField(aktElem, id);
	}
}
Example #5
0
int main()
{
#ifdef debug
    printf("%X %X\n",&player,main);
#endif
	do
	{
		printf("请选择走棋次序。\n输入1先走,或者-1后走。");
		scanf("%d",&player);
	}
	while(player!=1&&player!=-1);	
	int pl;                      //落子位置
	DrawField();
	int i;
	for(i=1;i<=9;i++)
	{
		if(isWin())break;
		if(player==1)
		{
			printf("请输入落子位置:");
			scanf("%d",&pl);
			if(pl>9||pl<1||field[pl]!=0)
			{
				printf("输入错误,无此格子或格内已有子\n请重新输入:");
				i--;
				DrawField();
				continue;
			}
			else
			{
				field[pl]=player;
				
				player=-player;
				if(isWin())break;
			}
		}
		else AI();
	}
	if(i>=9)printf("平局\n");
	else printf("赢家是%d\n",sym(-player));
	getchar();getchar();                       //延迟窗口关闭 
	return 0;
}
Example #6
0
void GS_Game::Draw(sf::RenderTarget& renderTarget)
{
	_fieldFrame.Draw(renderTarget);

	DrawShade(renderTarget);
	DrawField(renderTarget);
	DrawActiveBlock(renderTarget);

	_expManager.Draw(renderTarget);
}
Example #7
0
void Game :: DrawWorld() const
{
    DrawField();
    DrawBlocksOnTheField();
    if ( mpCurrentFigure != NULL )
        mpCurrentFigure -> Draw();

    for ( ComponentsVec :: const_iterator comp_it = mCollapseComponents.begin(); comp_it != mCollapseComponents.end(); ++comp_it )
	for ( BlocksVec :: const_iterator block_it = comp_it -> begin(); block_it != comp_it -> end(); ++block_it  )
            ( block_it -> first ) -> Draw();
}
Example #8
0
void wxLEDPanel::OnPaint(wxPaintEvent &event)
{
    wxBufferedPaintDC dc(this);
    //dc.SetBackground(this->GetBackgroundColour());
    //dc.Clear();

    // background
    dc.Blit(0,0,m_mdc_background.GetSize().GetWidth(),m_mdc_background.GetSize().GetHeight(),&m_mdc_background,0,0);
    // field
    DrawField(dc);
}
Example #9
0
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

#ifdef __WXGTK20__
    // Draw grip first
    if ( ShowsSizeGrip() )
    {
        const wxRect& rc = GetSizeGripRect();
#ifdef __WXGTK3__
        GtkWidget* toplevel = gtk_widget_get_toplevel(m_widget);
        GdkRectangle rect;
        if (toplevel && (!gtk_window_get_resize_grip_area(GTK_WINDOW(toplevel), &rect) ||
            rect.width == 0 || rect.height == 0))
        {
            GtkStyleContext* sc = gtk_widget_get_style_context(toplevel);
            gtk_style_context_save(sc);
            gtk_style_context_add_class(sc, GTK_STYLE_CLASS_GRIP);
            GtkJunctionSides sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT;
            if (GetLayoutDirection() == wxLayout_RightToLeft)
                sides = GTK_JUNCTION_CORNER_BOTTOMLEFT;
            gtk_style_context_set_junction_sides(sc, sides);
            gtk_render_handle(sc,
                static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext()),
                rc.x, rc.y, rc.width, rc.height);
            gtk_style_context_restore(sc);
        }
#else
        GdkWindowEdge edge =
            GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST :
                                                           GDK_WINDOW_EDGE_SOUTH_EAST;
        gtk_paint_resize_grip(gtk_widget_get_style(m_widget),
                            GTKGetDrawingWindow(),
                            gtk_widget_get_state(m_widget),
                            NULL,
                            m_widget,
                            "statusbar",
                            edge,
                            rc.x, rc.y, rc.width, rc.height );
#endif
    }
#endif // __WXGTK20__

    if (GetFont().IsOk())
        dc.SetFont(GetFont());

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
    for (size_t i = 0; i < m_panes.GetCount(); i ++)
        DrawField(dc, i, textHeight);
}
Example #10
0
	//[!] 메인 함수
	void Tetris()
	{
		ConsoleInit(); // 시작 화면 

		DrawField(); // 게임 영역 출력

		ShowPoint(); // 점수판 출력

		StartGame(); // 게임 시작

		EndGame(); // 게임 종료화 면
	}
Example #11
0
//---------------------------------------------------------------------------
void __fastcall TMainForm::SpeedButton2Click(TObject *Sender)
{
  delete fEngine;
  //
  Refresh();
  frogOK=true;
  fEngine = new MFrogEngine();
  fEngine->Init();
  DrawField(false,true);
  //
  Timer1->Enabled=true;
}
Example #12
0
// ---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent * Owner) :
  TForm(Owner)
{
  fieldWidth=400;
  fieldHeight=220;
  ClientWidth=fieldWidth;
  ClientHeight=Panel1->Height+fieldHeight+1;
  frogOK=true;
  fEngine = new MFrogEngine();
  fEngine->Init();
  DrawField(false,true);
}
Example #13
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    dc.Clear();

    int w, h;
    GetSize( &w, &h );

    // Notice that wxOSXGetKeyWindow (aka [NSApp keyWindow] used below is
    // subtly different from IsActive() (aka [NSWindow iskeyWindow]): the
    // former remains non-NULL if another application shows a temporary
    // floating window or a status icon's menu is used. That's what we want: in
    // that case, statusbar appearance shouldn't change. It also shouldn't
    // change if a window-modal sheet attached to this window is key.
    wxTopLevelWindow *tlw = wxDynamicCast(MacGetTopLevelWindow(), wxTopLevelWindow);
    wxNonOwnedWindow* directKeyWindow = wxNonOwnedWindow::GetFromWXWindow(wxOSXGetKeyWindow());
    wxWindow *keyWindow = directKeyWindow ? directKeyWindow->MacGetTopLevelWindow() : NULL;
    while ( keyWindow && keyWindow != tlw )
    {
        wxDialog *dlg = wxDynamicCast(keyWindow, wxDialog);
        if ( dlg && dlg->GetModality() == wxDIALOG_MODALITY_WINDOW_MODAL )
            keyWindow = dlg->GetParent();
        else
            break;
    }

    if ( tlw == keyWindow )
    {
        dc.GradientFillLinear(dc.GetSize(), m_bgActiveFrom, m_bgActiveTo, wxBOTTOM);

        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderActive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textActive);
    }
    else
    {
        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderInactive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textInactive);
    }

    dc.DrawLine(0, 0, w, 0);

    if ( GetFont().IsOk() )
        dc.SetFont(GetFont());
    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    for ( size_t i = 0; i < m_panes.GetCount(); i ++ )
        DrawField(dc, i, textHeight);
}
Example #14
0
// ---------------------------------------------------------------------------
void __fastcall TMainForm::Timer1Timer(TObject * Sender)
{
  if (!fEngine)
  {
    return;
  }
  //
  fEngine->MoveTiles();
  DrawField(false,true);
  int lives = fEngine->ManageFrogLives(0, 0,0);
  Label1->Caption = "Lives: " + IntToStr(lives);
  //
  int frogY=fEngine->GetFrogCoords().y;
  if (lives==0 || frogY==0)
  {
    frogOK=false;
    Timer1->Enabled=false;
    //
    Graphics::TBitmap *bmp=NULL;
    if (lives==0)
      bmp=Image1->Picture->Bitmap;
    else if (frogY==0)
      bmp=Image2->Picture->Bitmap;
    if (bmp)
    {
      int qq=20;
      for (int i=0; i<qq; i++)
      {
        int w=i*bmp->Width/qq;
        int h=i*bmp->Height/qq;
        int x=(ClientWidth-w)/2;
        int y=(ClientHeight+Panel1->Height-h)/2;
        TRect r=Rect(x,y,x+w,y+h);
        DrawField(false,true);
        Canvas->StretchDraw(r,bmp);
        ::Sleep(100);
      }
    }
  }
}
Example #15
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
  	wxPaintDC dc(this);
  	dc.Clear() ;

    int major,minor;
    wxGetOsVersion( &major, &minor );
    int w, h ;
    GetSize( &w , &h ) ;

	if ( MacIsReallyHilited() )
	{
		wxPen white( *wxWHITE , 1 , wxSOLID ) ;
        if (major >= 10 ) 
        {
            //Finder statusbar border color: (Project builder similar is 9B9B9B)
            if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
                dc.SetPen(wxPen(wxColour(0x40,40,40) ,1,wxSOLID)) ;
            else
                dc.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID));  
        }
        else
        {
            wxPen black( *wxBLACK , 1 , wxSOLID ) ;
            dc.SetPen(black);
    	}
		dc.DrawLine(0, 0 ,
		       w , 0);
		dc.SetPen(white);
		dc.DrawLine(0, 1 ,
		       w , 1);
	}
	else
	{
        if (major >= 10) 
            //Finder statusbar border color: (Project builder similar is 9B9B9B)
            dc.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID)); 
        else
            dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));

		dc.DrawLine(0, 0 ,
		       w , 0);
	}

	int i;
	if ( GetFont().Ok() )
		dc.SetFont(GetFont());
	dc.SetBackgroundMode(wxTRANSPARENT);

	for ( i = 0; i < m_nFields; i ++ )
		DrawField(dc, i);
}
Example #16
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    dc.Clear();

    int major, minor;
    wxGetOsVersion( &major, &minor );
    int w, h;
    GetSize( &w, &h );

    if ( MacIsReallyHilited() )
    {
        wxPen white( *wxWHITE , 1 , wxSOLID );
        if (major >= 10)
        {
            // Finder statusbar border color: (Project Builder similar is 9B9B9B)
            if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
                dc.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID));
            else
                dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID));
        }
        else
        {
            wxPen black( *wxBLACK , 1 , wxSOLID );
            dc.SetPen(black);
        }

        dc.DrawLine(0, 0, w, 0);
        dc.SetPen(white);
        dc.DrawLine(0, 1, w, 1);
    }
    else
    {
        if (major >= 10)
            // Finder statusbar border color: (Project Builder similar is 9B9B9B)
            dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID));
        else
            dc.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID));

        dc.DrawLine(0, 0, w, 0);
    }

    if ( GetFont().IsOk() )
        dc.SetFont(GetFont());
    dc.SetBackgroundMode(wxTRANSPARENT);

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    for ( size_t i = 0; i < m_panes.GetCount(); i ++ )
        DrawField(dc, i, textHeight);
}
Example #17
0
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

    dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
#ifdef __WXGTK20__
    // Draw grip first
    if (HasFlag( wxST_SIZEGRIP ))
    {
        int width, height;
        GetClientSize(&width, &height);

        if (GetLayoutDirection() == wxLayout_RightToLeft)
        {
            gtk_paint_resize_grip( m_widget->style,
                               GTK_PIZZA(m_wxwindow)->bin_window,
                               (GtkStateType) GTK_WIDGET_STATE (m_widget),
                               NULL,
                               m_widget,
                               "statusbar",
                               GDK_WINDOW_EDGE_SOUTH_WEST,
                               2, 2, height-2, height-4 );
        }
        else
        {
            gtk_paint_resize_grip( m_widget->style,
                               GTK_PIZZA(m_wxwindow)->bin_window,
                               (GtkStateType) GTK_WIDGET_STATE (m_widget),
                               NULL,
                               m_widget,
                               "statusbar",
                               GDK_WINDOW_EDGE_SOUTH_EAST,
                               width-height-2, 2, height-2, height-4 );
        }
    }
#endif

    if (GetFont().Ok())
        dc.SetFont(GetFont());

    dc.SetBackgroundMode(wxTRANSPARENT);

#ifdef __WXPM__
    wxColour vColor;

    vColor = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR);
    ::WinFillRect(dc.m_hPS, &dc.m_vRclPaint, vColor.GetPixel());
#endif

    for (int i = 0; i < m_nFields; i ++)
        DrawField(dc, i);
}
Example #18
0
void	DrawBoard()
{
	int x;
	int y;

	for( y = 0; y < MAZEH; y++ )
	{
		for( x = 0; x < MAZEW; x++)
		{
		DrawField( x, y);
		}
	}
}
Example #19
0
void display() {

     glClear(GL_COLOR_BUFFER_BIT);

    DrawField();

    DrawSnake(); 

   for (int i=0;i<10;i++)
     m[i].DrawApple();

   glFlush();
   glutSwapBuffers();
}
Example #20
0
/** Prepares the backgroundimage, to optimze speed */
void wxLEDPanel::PrepareBackground()
{
    wxSize s=DoGetBestSize();
    wxBitmap bmpBG(s.GetWidth(),s.GetHeight());

    m_mdc_background.SelectObject(bmpBG);

    // clear the background
    m_mdc_background.SetBackground(this->GetBackgroundColour());
    m_mdc_background.Clear();

    if(m_invert || m_show_inactivs)
        DrawField(m_mdc_background, true);
}
Example #21
0
/// this code is based on wxStatusBarGeneric::OnPaint
void wxStatusBarEx::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

    if (GetFont().Ok())
        dc.SetFont(GetFont());

    dc.SetBackgroundMode(wxTRANSPARENT);

    /// this is added to allow the text to be sensible in the status bar
    /// when using red theme
    dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));

    for (int i = 0; i < m_nFields; i ++)
        DrawField(dc, i);
}
Example #22
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
  	wxPaintDC dc(this);
  	dc.Clear() ;

    int major,minor;
    wxGetOsVersion( &major, &minor );

	if ( IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
	{
		wxPen white( wxWHITE , 1 , wxSOLID ) ;
        if (major >= 10) 
        {
            //Finder statusbar border color: (Project builder similar is 9B9B9B)
            dc.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID));  
        }
        else
        {
            wxPen black( wxBLACK , 1 , wxSOLID ) ;
            dc.SetPen(black);
    	}
		dc.DrawLine(0, 0 ,
		       m_width , 0);
		dc.SetPen(white);
		dc.DrawLine(0, 1 ,
		       m_width , 1);
	}
	else
	{
        if (major >= 10) 
            //Finder statusbar border color: (Project builder similar is 9B9B9B)
            dc.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID)); 
        else
            dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));

		dc.DrawLine(0, 0 ,
		       m_width , 0);
	}

	int i;
	if ( GetFont().Ok() )
		dc.SetFont(GetFont());
	dc.SetBackgroundMode(wxTRANSPARENT);

	for ( i = 0; i < m_nFields; i ++ )
		DrawField(dc, i);
}
Example #23
0
void Start(){
	
	int k, ki,kj, li,lj, tmp;
	for(k=0;k<100;k++){
		ki=rand()%4;
		kj=rand()%4;
		li=rand()%4;
		lj=rand()%4;
		tmp=cells[li][lj];
		cells[li][lj]=cells[ki][kj];
		cells[ki][kj]=tmp;
	}
	DrawField();	
	for(int i=0;i<4;i++)
	for(int j=0;j<4;j++)
	if(!cells[i][j]) {cur_i=j;cur_j=i;break;}
}
Example #24
0
Int16
CreateDragon(UInt16 x, UInt16 y)
{
	welem_t node;
	int rv = 0;

	zone_lock(lz_world);
	zone_lock(lz_flags);
	node = getWorld(WORLDPOS(x, y));
	if (node != Z_REALWATER && node != Z_CRATER) {
		game.objects[obj_dragon].x = x;
		game.objects[obj_dragon].y = y;
		game.objects[obj_dragon].dir = (UInt16)GetRandomNumber(8);
		game.objects[obj_dragon].active = 1;
		DrawField(x, y);
		rv = 1;
	}
	zone_unlock(lz_flags);
	zone_unlock(lz_world);
	return (rv);
}
Example #25
0
void AI()
{
	for(int j=1;j<=9;j++)
	{
		if(field[j]==0)
		{
			field[j]=player;
			if(isWin())goto finish;
			field[j]=0;
		}
	}
	for(int j=1;j<=9;j++)
	{
		if(field[j]==0)
		{
			field[j]=-player;
			if(isWin()){field[j]=player;goto finish;}
			field[j]=0;
		}
	}
	if(field[5]==0){field[5]=player;goto finish;}
	// the next can be inprove
	if((field[1]!=0||field[9]!=0)&&field[3]==0){field[3]=player;goto finish;}
	if(field[3]!=0&&field[9]==0){field[9]=player;goto finish;}
	if(field[7]!=0&&field[1]==0){field[1]=player;goto finish;}
	if(field[2]!=0&&field[4]==0){field[4]=player;goto finish;}
	if(field[4]!=0&&field[2]==0){field[2]=player;goto finish;}
	if(field[8]!=0&&field[4]==0){field[4]=player;goto finish;}
	if(field[6]!=0&&field[8]==0){field[8]=player;goto finish;}
	for(int q=1;q<=9;q++)
	{
		if(field[q]==0)
		  {
		    field[q]=player;break;
		  }
	}
	finish:player=-player;DrawField();
}
Example #26
0
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    dc.Clear();

    int w, h;
    GetSize( &w, &h );

    wxTopLevelWindow *tlw = wxDynamicCast(MacGetTopLevelWindow(), wxTopLevelWindow);
    if ( tlw && tlw->IsActive() )
    {
        dc.GradientFillLinear(dc.GetSize(), m_bgActiveFrom, m_bgActiveTo, wxBOTTOM);

        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderActive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textActive);
    }
    else
    {
        // Finder statusbar border color
        dc.SetPen(wxPen(m_borderInactive, 2, wxPENSTYLE_SOLID));
        dc.SetTextForeground(m_textInactive);
    }

    dc.DrawLine(0, 0, w, 0);

    if ( GetFont().IsOk() )
        dc.SetFont(GetFont());
    dc.SetBackgroundMode(wxTRANSPARENT);

    // compute char height only once for all panes:
    int textHeight = dc.GetCharHeight();

    for ( size_t i = 0; i < m_panes.GetCount(); i ++ )
        DrawField(dc, i, textHeight);
}
Example #27
0
// run over the glyphs collecting information before calling client
// with APPDrawString
void scDrawLine::Draw()
{
	caseState	prevCase = noCase;
	caseState	curCase  = noCase;
	
	CharRecord chRec;

	SetCharData( );

	if ( !fOffset && scCachedStyle::GetParaStyle().GetNumbered() )
		DrawBullet();

	scCachedStyle& cachedStyle = scCachedStyle::GetCurrentCache();

	for ( ; fToDraw > 0; ) {

			// if there is a spec change dump any characters in the buffer
		if ( fOffset >= fSpecRec->offset()	) {
			cachedStyle = UpdateSpec(); 
			prevCase = noCase;
		}

#ifdef jis4051
		if ( fChRec->flags.GetRenMoji() > 0 )
			ProcessRenMoji();
		else 
#endif
		{  
			UCS2 ch = CMctToAPP( fChRec->character );

			switch ( fChRec->character ) {
				case scField:
					DrawField();
					break;

				case scRulePH:
					DrawRule();
					break;

				case scFillSpace:
				case scTabSpace:
					DrawTabSpace();
					break;
					
				default:
					if (ch)
					{
						chRec.Set( CMctToAPP( ch ), fChRec->flags, fChRec->escapement );
						SetCharArray( chRec, LETTERSPACE( fChRec ) );
					}
					break;
	
				case scFixRelSpace:
					chRec.Set( CMctToAPP( ch ), SCRLUCompGS( cachedStyle.GetGlyphWidth() , (RLU)fChRec->escapement ) );
					SetCharArray( chRec, false );
					break;
	
				case scFixAbsSpace:
					chRec.Set( CMctToAPP( ch ), fChRec->escapement );
					SetCharArray( chRec, false );
					break;
			}	
			IncrementBackingStore();
		}
		prevCase = curCase;
	}

	if ( fEndOffset == fPara.GetContentSize() ) {
		UCS2 ch = fCount ? (fChRec-1)->character : (UCS2)0;

		switch ( ch ) {
			case scHardReturn:
			case scVertTab:
				break;
			default:
				if ( fPara.Next() )
					fStreamPosition = eEndOfPara;
				else
					fStreamPosition = eEndOfStream;
				break;
		}
	}

	if ( fCount || fStreamPosition != eNoEnd ) {
		if ( fCount ) {
			scCharFlags flags	= (fChRec-1)->flags;

			if ( flags.IsHyphPresent() )
				ProcessHyphen( flags );
		}
			
		if ( fStreamPosition == eEndOfPara ) {
			if ( CMctToAPP( scParaEnd ) ) { 
				chRec.Set( CMctToAPP( scParaEnd ),	scCachedStyle::GetCurrentCache().GetPtSize() );
				SetCharArray( chRec, false );
			}
		}
		else if ( fStreamPosition == eEndOfStream ) {
			if ( CMctToAPP( scEndStream ) ) {
				chRec.Set( CMctToAPP( scEndStream ),  scCachedStyle::GetCurrentCache().GetPtSize() );
				SetCharArray( chRec, false );
			}
		}
				
		OutputLine();
	}
}
Example #28
0
//add
void WorldDrawer2d::init(){
	cs1 = new CoordinateSystem2d();
	cs2 = new CoordinateSystem2d();
	cs_used.push_back(cs2);
	cs_used.push_back(cs1);
	DrawCircle(&o1,0.0f,0.0f,0.5f);
	o1->scaleRelativeToPoint(o1->points.at(0),0.5f,0.5f);
	DrawCircle(&b1,1.0f,1.0f,1.0f);
	DrawCircle(&b2,1.0f,1.0f,1.0f);
	DrawCircle(&b3,1.0f,1.0f,1.0f);
	DrawCircle(&b4,1.0f,1.0f,1.0f);
	DrawTribune(&spectatori);
	DrawFour(0.25f,18.0f,&o3,1.0f,1.0f,1.0f);
	DrawFour(0.25f,18.0f,&o4,1.0f,1.0f,1.0f);
	DrawFour(4.0f,0.25f,&o5,1.0f,1.0f,1.0f);
	DrawFour(4.0f,0.25f,&o6,1.0f,1.0f,1.0f);
	DrawFour(4.0f,0.25f,&o7,1.0f,1.0f,1.0f);
	DrawFour(4.0f,0.25f,&o8,1.0f,1.0f,1.0f);
	DrawFour(4.0f,0.25f,&o9,1.0f,1.0f,1.0f);
	DrawFour(4.0f,0.25f,&o10,1.0f,1.0f,1.0f);
	DrawFour(0.25f,1.0f,&o11,1.0f,1.0f,1.0f);
	DrawFour(0.25f,1.0f,&o12,1.0f,1.0f,1.0f);
	DrawFour(0.25f,1.0f,&o13,1.0f,1.0f,1.0f);
	DrawFour(0.25f,1.0f,&o14,1.0f,1.0f,1.0f);
	DrawFour(12.0f,0.1f,&o15,1.0f,1.0f,1.0f);
	DrawFour(6.0f,0.1f,&o16,1.0f,1.0f,1.0f);
	DrawFour(6.0f,0.1f,&o17,1.0f,1.0f,1.0f);
	DrawFour(0.1f,1.3f,&o18,1.0f,1.0f,1.0f);
	DrawFour(0.1f,1.3f,&o19,1.0f,1.0f,1.0f);
	DrawFour(0.1f,1.3f,&o20,1.0f,1.0f,1.0f);
	DrawFour(0.1f,1.3f,&o21,1.0f,1.0f,1.0f);

	DrawPlayers(&players1,1.0f,1.0f,0.0f);
	DrawPlayers(&players2,1.0f,0.1f,0.1f);
	DrawScore(1.0f,1.0f,0.0f,1.0f,0.1f,0.1f);
	DrawField(18,12);
	
	o3->translate(12.25f,0.0f);
	o4->translate(-12.25f,0.0f);
	o5->translate(-8.25f,18.0f);
	o6->translate(8.25f,18.0f);
	o7->translate(-8.25f,-18.0f);
	o8->translate(8.25f,-18.0f);
	o9->translate(0.0f,19.7f);
	o10->translate(0.0f,-19.7f);
	o11->translate(4.0f,18.75f);
	o12->translate(-4.0f,18.75f);
	o13->translate(-4.0f,-18.75f);
	o14->translate(4.0f,-18.75f);
	o16->translate(0.0f,15.5f);
	o17->translate(0.0f,-15.5f);
	o18->translate(6.0f,16.8f);
	o19->translate(-6.0f,16.8f);
	o20->translate(6.0f,-16.8f);
	o21->translate(-6.0f,-16.8f);
	players1.at(0)->translate(0.0f,17.7f);
	players1.at(1)->translate(-5.0f,10.0f);
	players1.at(2)->translate(5.0f,10.0f);
	players1.at(3)->translate(3.0f,-3.0f);
	players1.at(4)->translate(-6.0f,-3.0f);
	players1.at(5)->translate(0.0f,-9.0f);
	players2.at(0)->translate(0.0f,-17.7f);
	players2.at(1)->translate(5.0f,-10.0f);
	players2.at(2)->translate(-5.0f,-10.0f);
	players2.at(3)->translate(-3.0f,3.0f);
	players2.at(4)->translate(6.0f,3.0f);
	players2.at(5)->translate(0.0f,9.0f);

	putBall();
	b1->scaleRelativeToPoint(b1->points[0],0.75f,0.75f);
	b2->scaleRelativeToPoint(b2->points[0],0.75f,0.75f);
	b3->scaleRelativeToPoint(b3->points[0],0.75f,0.75f);
	b4->scaleRelativeToPoint(b4->points[0],0.75f,0.75f);

	b1->translate(-4.0f,18.0f);
	b2->translate(4.0f,18.0f);
	b3->translate(-4.0f,-18.0f);
	b4->translate(4.0f,-18.0f);

}
Example #29
0
void __fastcall TMainForm::FormKeyDown(TObject * Sender, WORD & Key, TShiftState Shift)

{
  if (!frogOK)
    return;
  if (!fEngine)
  {
    return;
  }
  MatrixData md = fEngine->GetFrogCoords();
  MatrixData fd = fEngine->GetSize();
  //
  int moveX = md.x;
  int moveY = md.y;
  //
  if (Key == VK_UP)
  {
    if (md.y > 0)
    {
      moveX = md.x;
      moveY = md.y - 1;
    }
  }
  else if (Key == VK_DOWN)
  {
    if (md.y < fd.y - 1)
    {
      moveX = md.x;
      moveY = md.y + 1;
    }
  }
  else if (Key == VK_LEFT)
  {
    if (md.x > 0)
    {
      moveX = md.x - 1;
      moveY = md.y;
    }
  }
  else if (Key == VK_RIGHT)
  {
    if (md.x < fd.x - 1)
    {
      moveX = md.x + 1;
      moveY = md.y;
    }
  }
  //
  if (moveX != md.x || moveY != md.y)
  {
    fEngine->SetFrogCoords(moveX, moveY);
    bool ok=fEngine->GetTileState(moveX, moveY);
    DrawField(false,ok);
    if (!ok)
    {
      int lives = fEngine->ManageFrogLives(moveX, moveY, -1);
      Label1->Caption = "Lives: " + IntToStr(lives);
      fEngine->SetFrogCoords(fd.x / 2, fd.y - 1);
    }
  }
}
Example #30
0
void
MoveAllObjects(void)
{
	UInt16 i, x, y;

	for (i = 0; i < NUM_OF_OBJECTS; i++) {
		if (game.objects[i].active != 0) {
			/* hmm, is this thing destructive? */
			if (i == obj_dragon) {
				if (!BurnField(game.objects[i].x,
				    game.objects[i].y, 1)) {
					CreateWaste(game.objects[i].x,
					    game.objects[i].y);
				}
				MonsterCheckSurrounded(i);
			} else if (i == obj_monster) {
				/* whoo-hoo, bingo again */
				CreateWaste(game.objects[i].x,
				    game.objects[i].y);
				MonsterCheckSurrounded(i);
			}

			x = game.objects[i].x; /* save old position */
			y = game.objects[i].y;

			switch (GetRandomNumber(OBJ_CHANCE_OF_TURNING)) {
			case 1: /* yes, clockwise */
				game.objects[i].dir = (game.objects[i].dir+1)%8;
				break;
			case 2: /* yes, counter-clockwise */
				game.objects[i].dir = (game.objects[i].dir+7)%8;
				break;
			default:
				break;
			}
			/* now move it a nod */
			switch (game.objects[i].dir) { /* first up/down */
			case 0: /* up */
			case 1: /* up-right */
			case 7: /* up-left */
				if (game.objects[i].y > 0) {
					game.objects[i].y--;
				} else {
					game.objects[i].dir = 4;
				}
				break;
			case 3: /* down-right */
			case 4: /* down */
			case 5: /* down-left */
				if (game.objects[i].y <
				    (UInt16)(getMapHeight()-1)) {
					game.objects[i].y++;
				} else {
					game.objects[i].dir = 0;
				}
				break;
			default:
				break;
			}

			switch (game.objects[i].dir) { /* then left/right */
			case 1: /* up-right */
			case 2: /* right */
			case 3: /* down-right */
				if (game.objects[i].x <
				    (UInt16)(getMapWidth()-1)) {
					game.objects[i].x++;
				} else {
					game.objects[i].dir = 6;
				}
				break;
			case 5: /* down-left */
			case 6: /* left */
			case 7: /* up-left */
				if (game.objects[i].x > 0) {
					game.objects[i].x--;
				} else {
					game.objects[i].dir = 2;
				}
				break;
			default:
				break;
			}
			zone_lock(lz_world);
			zone_lock(lz_flags);
			DrawCross(x, y, 1, 1); /* (erase it) */
			DrawField(game.objects[i].x, game.objects[i].y);
			zone_unlock(lz_flags);
			zone_unlock(lz_world);
		}
	}
}