domingo, 29 de março de 2020

C++ builder - usuário e senha

Sempre vejo iniciantes em linguagem C ou C++,
querendo utilizar blbliotecas antigas em plataformas
modernas, não sabem a dor de cabeça que estão
semeando a si mesmos; Primeiro porque estas
bibliotecas já eram bastante limitadas,
para os sistemas onde foram criadas imaginem
agora com os avanços que estes sistemas receberam,
sei bem os problemas que arrumei quando tentei utilizá-las.
O C++ Builder é uma excelente ferramenta para criação
tanto de jogos como para programas em desktops,
mobile e web, e eu ainda o coloco acima do Qt,
Porque conheço os dois e posso opinar.
Neste programinha, mostro um exemplo de sistema de login,
mas existem mil maneiras de fazer e personalizar isto,
ainda mais utilizando uma IDE deste nível,
acompanhem no vídeo por favor:




//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "OnPaint.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1 ( TComponent* Owner ) :
        TForm ( Owner ) {
}
 //---------------------------------------------------------------------------
void __fastcall TForm1::Informe ( TObject *Sender ) {
    Canvas -> Font-> Style = TFontStyles ( ) << fsItalic;
    Canvas -> Font -> Size = 11;
    Canvas -> Font -> Name = "Arial";
    Canvas -> Font -> Color = clBlack;
    Canvas -> TextOut ( 160, 240, "Por: " );
    Canvas -> Font -> Color = clRed;
    Canvas -> TextOut ( 200, 240, "Samuel Lima" );
    Canvas -> Font -> Color = clBlack;
    Canvas -> TextOut ( 160, 255, "sa_sp10@hotmail.com" );
}
 // ---------------------------------------------------------------------------
void __fastcall TForm1::Label_Manual ( TObject* Sender ) {
     Bevel1 -> Height = 170;
     Bevel1 -> Width = 210;
     Bevel1 -> Left = 145;
     Bevel1 -> Top = 55;

     Panel1 -> Font -> Size = 12;
     Panel1 -> Font -> Color = clRed;
     Panel1 -> Font -> Style = TFontStyles ( ) << fsBold << fsItalic;
     Panel1 -> Width = 175;
     Panel1 -> Height = 20;
     Panel1 -> Left = 160;
     Panel1 -> Top = 200;
     Panel1 -> Caption = "Usuário e senha";

     Panel2 -> Font -> Size = 14;
     Panel2 -> Font -> Color = clRed;
     Panel2 -> Font -> Style = TFontStyles ( ) << fsBold << fsItalic;
     Panel2 -> Width = 390;
     Panel2 -> Height = 20;
     Panel2 -> Left = 110;
     Panel2 -> Top = 15;
     Panel2 -> Caption = "C++ BUILDER - USUÁRIO E SENHA II";

     Edit1 -> SetFocus ( );
     Edit1 -> Font -> Size = 12;
     Edit1 -> Font -> Color = clRed;
     Edit1 -> Font -> Style = TFontStyles ( ) << fsBold << fsItalic;
     Edit1 -> Width = 90;
     Edit1 -> Height = 20;
     Edit1 -> Left = 240;
     Edit1 -> Top = 70;

     //Edit1 -> SetFocus ( );
     Edit2 -> Font -> Size = 12;
     Edit2 -> Font -> Color = clBlack;
     Edit2 -> Font -> Style = TFontStyles ( ) << fsBold << fsItalic;
     Edit2 -> Width = 90;
     Edit2 -> Height = 20;
     Edit2 -> Left = 240;
     Edit2 -> Top = 100;

     //Edit1 -> SetFocus ( );
     Edit3 -> Font -> Size = 12;
     Edit3 -> Font -> Color = clBlack;
     Edit3 -> Font -> Style = TFontStyles ( ) << fsBold << fsItalic;
     Edit3 -> Width = 90;
     Edit3 -> Height = 20;
     Edit3 -> Left = 240;
     Edit3 -> Top = 130;

    Label1 -> Font -> Size = 12;
    Label1 -> Font-> Style = TFontStyles ( ) << fsItalic ;
    Label1 -> Font -> Color = clBlack;
    Label1 -> Width = 130;
    Label1 -> Height = 20;
    Label1 -> Left = 160;
    Label1 -> Top = 70;
    Label1 -> Caption = "Usuário: ";

    Label2 -> Font -> Size = 12;
    Label2 -> Font-> Style = TFontStyles ( ) << fsItalic ;
    Label2 -> Font -> Color = clBlue;
    Label2 -> Width = 130;
    Label2 -> Height = 20;
    Label2 -> Left = 160;
    Label2 -> Top = 100;
    Label2 -> Caption = "Senha: ";

    Label3 -> Font -> Size = 12;
    Label3 -> Font-> Style = TFontStyles ( ) << fsItalic ;
    Label3 -> Font -> Color = clRed;
    Label3 -> Width = 130;
    Label3 -> Height = 20;
    Label3 -> Left = 160;
    Label3 -> Top = 130;
    Label3 -> Caption = "Confirma: ";

    BitBtn1 -> Font -> Size = 12;
    BitBtn1 -> Font -> Color = clBlue;
    BitBtn1 -> Font -> Style = TFontStyles ( ) << fsItalic;
    BitBtn1 -> Top = 160;
    BitBtn1 -> Left = 160;
    BitBtn1 -> Height = 23;
    BitBtn1 -> Width = 40;

    BitBtn2 -> Font -> Size = 12;
    BitBtn2 -> Font -> Color = clBlue;
    BitBtn2 -> Font -> Style = TFontStyles ( ) << fsItalic;
    BitBtn2 -> Top = 160;
    BitBtn2 -> Left = 290;
    BitBtn2 -> Height = 23;
    BitBtn2 -> Width = 40;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnPaint ( TObject *Sender ) {
      Canvas -> Font -> Size = 14;
      Canvas -> Font -> Name = "Arial";
      Canvas -> Pen -> Width = 10;
      Canvas -> Rectangle ( 05, 05, 595, 295 );
      Canvas -> Pen -> Color = clBlue;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
Label_Manual ( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
    String Usuario_1 = "Samuel";
    String Usuario_2 = Edit1 -> Text;
    Boolean Result_1 = SameText ( Usuario_1, Usuario_2 );
    String Senha_1 = Edit2 -> Text;
    String Senha_2 = Edit3 -> Text;
    if ( Result_1 == False ) {
        Panel1 -> Font -> Color = clBlue;
        Panel1 -> Caption = "Usuário não confere";
        Edit1 -> SetFocus ( );
        Edit1 -> Clear ( );
    } else {
        Boolean Result_2 = SameText ( Senha_1, Senha_2 );
        if ( Result_2 == False ) {
            Panel1 -> Font -> Color = clGreen;
            Panel1 -> Caption = "Senhas desiguais";
            Edit2 -> Clear ( );
            Edit3 -> Clear ( );
            Edit2 -> SetFocus ( );
        } else {
            Panel1 -> Font -> Color = clBlack;
            Panel1 -> Caption = "Login efetuado";
        }
    }
    Informe ( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
        Close ( );
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

#ifndef OnPaintH
#define OnPaintH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Buttons.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
    TLabel *Label1;
    TLabel *Label2;
    TLabel *Label3;
    TPanel *Panel1;
    TEdit *Edit1;
    TEdit *Edit2;
    TEdit *Edit3;
    TPanel *Panel2;
    TBitBtn *BitBtn1;
    TBitBtn *BitBtn2;
    TBevel *Bevel1;
    void __fastcall Label_Manual ( TObject* Sender );
    void __fastcall Informe ( TObject *Sender );
    void __fastcall OnPaint(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall BitBtn1Click(TObject *Sender);
    void __fastcall BitBtn2Click(TObject *Sender);
private:    // User declarations
public:        // User declarations
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif


object Form1: TForm1
  Left = 342
  Top = 219
  Width = 616
  Height = 338
  AutoScroll = True
  Caption = 'C++ BUILDER - USU'#193'RIO E SENHA II'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poDesigned
  OnPaint = OnPaint
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 149
    Top = 84
    Width = 6
    Height = 23
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 149
    Top = 113
    Width = 6
    Height = 23
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end
  object Label3: TLabel
    Left = 149
    Top = 142
    Width = 6
    Height = 23
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end
  object Bevel1: TBevel
    Left = 526
    Top = 193
    Width = 43
    Height = 25
  end
  object Panel1: TPanel
    Left = 526
    Top = 47
    Width = 43
    Height = 23
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 0
  end
  object Edit1: TEdit
    Left = 526
    Top = 84
    Width = 43
    Height = 27
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 1
  end
  object Edit2: TEdit
    Left = 526
    Top = 117
    Width = 43
    Height = 27
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    PasswordChar = '*'
    TabOrder = 2
  end
  object Edit3: TEdit
    Left = 526
    Top = 150
    Width = 43
    Height = 27
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    PasswordChar = '*'
    TabOrder = 3
  end
  object Panel2: TPanel
    Left = 526
    Top = 17
    Width = 43
    Height = 24
    Color = clWhite
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -24
    Font.Name = 'Tahoma'
    Font.Style = [fsItalic]
    ParentBackground = False
    ParentFont = False
    TabOrder = 4
  end
  object BitBtn1: TBitBtn
    Left = 526
    Top = 235
    Width = 43
    Height = 25
    Caption = 'Ok'
    TabOrder = 5
    OnClick = BitBtn1Click
  end
  object BitBtn2: TBitBtn
    Left = 526
    Top = 266
    Width = 43
    Height = 25
    Caption = 'Sair'
    TabOrder = 6
    OnClick = BitBtn2Click
  end
end

quinta-feira, 26 de março de 2020

Casting de tipos - de char para inteiros

Em linguagem C, uma string é um vetor de caracteres,
e não podemos esquecer de reservar um a mais
no final da string que será o O terminador nulo.
O C, não possui um tipo de dados string,
ao contrário de outras linguagens,
mas isto para nós não representa nenhum problema,
basta declarar um vetor de caracteres,
ou seja um vetor do tipo char como o do exemplo
que estamos mostrando no momento,
ou seguindo a forma geral representada abaixo:
char nome_da_string [ tamanho ];
Embora estamos usando o C++ Builder para criação
da interface gráfica, preferi usar a declaração oficial
de uma string em C, obviamente neste caso
estamos usando um vetor bidimensional de caracteres,
com os 100 primeiros números naturais em string,
Os compiladores de linguagem C contêm funções
como atoi( ), atof( ) e atol( ) nas suas bibliotecas-padrões.
basicamente a finalidade , destas funções é  converter
uma string de dígitos em inteiros, float ou double,
e foi isto que fizemos,  utilizamos um casting
para converter de char para inteiros usando a função atoi,
e os resultados foram excelentes,
acompanhem primeiro no vídeo abaixo:




//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#define tam 100
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
    char Vet [ 100 ] [ 4 ] = { "1", "2", "3", "4", "5", "6", "7", "8", "9",
            "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
            "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31",
            "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42",
            "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53",
            "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64",
            "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75",
            "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86",
            "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97",
            "98", "99", "100" };
    int i, j, Vetor = 0, Ve_tor [ 100 ];
//---------------------------------------------------------------------------
void __fastcall TForm1::Label_Manual ( TObject *Sender ) {
    Label1 -> Font -> Size = 12;
    Label1 -> Font-> Style = TFontStyles ( ) << fsItalic ;
    Label1 -> Font -> Color = clBlack;
    Label1 -> Width = 130;
    Label1 -> Height = 20;
    Label1 -> Left = 160;
    Label1 -> Top = 40;

    Label2 -> Font -> Size = 12;
    Label2 -> Font-> Style = TFontStyles ( ) << fsItalic ;
    Label2 -> Font -> Color = clBlue;
    Label2 -> Width = 130;
    Label2 -> Height = 20;
    Label2 -> Left = 160;
    Label2 -> Top = 40;

    Label3 -> Font -> Size = 12;
    Label3 -> Font-> Style = TFontStyles ( ) << fsItalic ;
    Label3 -> Font -> Color = clRed;
    Label3 -> Width = 130;
    Label3 -> Height = 20;
    Label3 -> Left = 160;
    Label3 -> Top = 40;

    BitBtn1 -> Visible = true;
    BitBtn1 -> Font -> Size = 12;
    BitBtn1 -> Font -> Color = clBlue;
    BitBtn1    -> Font-> Style = TFontStyles ( ) << fsItalic ;
    BitBtn1 -> Top = 258;
    BitBtn1 -> Left = 200;
    BitBtn1 -> Height = 24;
    BitBtn1 -> Width = 230;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow ( TObject *Sender ) {
    Label_Manual ( Sender );
    for ( i = 0; i < tam; i++ ) {
       if ( i % 10 == 0 )
        str_1 += "\n";
        str_1 += "  ";
      if ( i >= 0 && i < 9 ) {
           str_1 += "0";
       }
        str_1 += Vet [ i ];
    }
       Label1 -> Caption = str_1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click ( TObject *Sender ){
    a++;
    str_1 = " ";
    //Casting
    Vetor = ( int ) atoi ( *Vet );
    for ( i = 0; i < tam; i++ ) {
       if ( i % 10 == 0 )
        str_1 += "\n";
        str_1 += "  ";
        Ve_tor [ i ] = ( Vetor + i );
      if ( Ve_tor [ i ] >= 0 && Ve_tor [ i ] < 10 ) {
           str_1 += "0";
       }
        str_1 += Ve_tor [ i ];
    }
        if ( a == 1 ) {
         Label2 -> Caption = str_1;
         }

       if ( a == 2 ) {
       srand ( time ( NULL ) );
       str_1 = " ";
       Label1 -> Caption = " ";
       for ( i = 0; i < tam; i++ ) {
       if ( i % 10 == 0 )
        str_2 += "\n";
        str_2 += "  ";
         j = i + rand ( ) % ( tam - i );
            char t = Ve_tor [ j ];
            Ve_tor [ j ] = Ve_tor [ i ];
            Ve_tor [ i ] = t;
       if ( Ve_tor [ i ] >= 0 && Ve_tor [ i ] < 10 ) {
           str_2 += "0";
       }
        str_2 += Ve_tor [ i ];
        }
       Label2 -> Caption = " ";
       Label3 -> Caption = str_2;
       }
       if ( a == 3 ) {
           Close ( );
       }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint ( TObject *Sender ) {
         Canvas -> Font -> Size = 14;
         Canvas -> Font-> Style = TFontStyles ( ) << fsItalic;
         Canvas -> Font -> Name = "Arial";
         Canvas -> Pen -> Width = 10;
         Canvas -> Pen -> Color = clRed;
         Canvas -> Rectangle ( 05, 05, 595, 295 );
         SetTextColor ( Canvas -> Handle, RGB ( 255, 25, 2 ) );
         Canvas -> TextOut ( 80, 10, "CASTING DE TIPOS - DE CHAR PARA INTEIROS" );
         Canvas -> Font -> Size = 11;
         Canvas -> Font -> Color = clBlue;
         Canvas -> TextOut ( 210, 35, "Abaixo o vetor de caracteres" );
        if ( a == 0 ) {
        BitBtn1 -> Caption = "Converter para vetor de inteiros";
        }
        Canvas -> Font -> Size = 11;
        Canvas -> Font -> Color = clBlack;
        if ( a == 1 ) {
        Canvas -> TextOut ( 210, 35, "Abaixo o vetor de inteiros      " );
          BitBtn1 -> Font -> Color = clRed;
          BitBtn1 -> Caption = "Embaralhar o vetor de inteiros";
         }
         if ( a == 2 ) {
        Canvas -> TextOut ( 200, 35, "Vetor de inteiros embaralhados" );
            BitBtn1 -> Font -> Color = clBlack;
            BitBtn1 -> Caption = "Finalizar o programa agora";
         }
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Buttons.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
    TLabel *Label1;
    TBitBtn *BitBtn1;
    TLabel *Label2;
    TLabel *Label3;
    void __fastcall FormShow(TObject *Sender);
    void __fastcall BitBtn1Click(TObject *Sender);
    void __fastcall FormPaint(TObject *Sender);
private: // User declarations
String str_1;
String str_2;
int a;
void __fastcall Label_Manual ( TObject *Sender );
public:  // User declarations
 __fastcall TForm1 ( TComponent* Owner );
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif


object Form1: TForm1
  Left = 413
  Top = 118
  Caption = 'CASTING DE TIPOS - DE CHAR PARA INTEIROS'
  ClientHeight = 300
  ClientWidth = 608
  Color = clCream
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poDesigned
  OnPaint = FormPaint
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 40
    Top = 208
    Width = 3
    Height = 13
  end
  object Label2: TLabel
    Left = 536
    Top = 128
    Width = 3
    Height = 13
  end
  object Label3: TLabel
    Left = 536
    Top = 144
    Width = 3
    Height = 13
  end
  object BitBtn1: TBitBtn
    Left = 536
    Top = 80
    Width = 33
    Height = 25
    TabOrder = 0
    OnClick = BitBtn1Click
  end
end

sábado, 21 de março de 2020

C++ Builder - Novo jogo Snake

A nossa cobrinha entrou na arena muito faminta,
ela sabe que encontrará frutas boas para sua alimentação, 
o que ela não sabe é que na arena estão espalhadas,
frutas venenosas que se parece bem com as frutas boas.
Use as setas direcionais do teclado do seu computador,
para conduzir nossa simpática cobrinha dentro da arena,
em busca das frutas comestíveis.
Lembrem sempre que se ela comer uma fruta venenosa,
ficará doente, sua cor muda para amarelo,
e se tornar a comer mais uma fruta venenosa,
ficará gravemente enferma, sua cor ficará vermelha,
e se ainda assim comer mais uma fruta venenosa,
ela morrerá, "GAME OVER".





//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstopFlag
#include "Unit2.h"
#include "Unit3.h"
#include <memory>
#define P_CIMA 0
#define P_DIREITA 1
#define P_BAIXO 2
#define P_ESQUERDA 3
#define CLS 0
#define COBRA 1
#define PRESA 2
#define LOCAL 3



//Percebeu a falta de alguns códigos?
//Fale comigo ainda hoje.

//---------------------------------------------------------------------------
void __fastcall TForm2::FormKeyDown ( TObject *Sender, WORD &Key,
        TShiftState Shift )
{
    if ( Key == VK_LEFT ) sentido = 3;
    if ( Key == VK_RIGHT) sentido = 1;
    if ( Key == VK_UP   ) sentido = 0;
    if ( Key == VK_DOWN ) sentido = 2;
}
//---------------------------------------------------------------------------
 void __fastcall TForm2::Partida ( TObject *Sender ) {
   Limpa_Tela ( Sender );
   Sorteia_Posicao_Snake ( );
   Embaralha_Frutas ( Sender );
   Posiciona_Coordenadas ( );

   Inicializa_Processos ( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Timer1Timer ( TObject *Sender )
{
    Form2 -> Timer1 -> Enabled = true;
    Direciona_Snake ( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Label1Click(TObject *Sender)
{
   x = true;
   Partida ( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Label2Click(TObject *Sender)
{
  exit ( 0 );
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormShow(TObject *Sender)
{    a = -1;
    a_1 = 6;
    b = false;
    c = false;
    d = false;
    Form2 -> Image1 -> Visible = true;
    Form2 -> Label5 -> Visible = true;
    Lbl -> Visible = true;
    Label3 -> Caption = " ";
    Label4 -> Caption = " ";

}
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------

#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Vcl.Imaging.GIFImg.hpp>
#include <Vcl.Imaging.pngimage.hpp>
#include <Vcl.Buttons.hpp>
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published:    // IDE-managed Components
    TImage *Imagem_P_cima;
    TImage *Imagem_P_baixo;
    TImage *Imagem_P_direita;
    TImage *Imagem_P_esquerda;
    TTimer *Timer1;
    TImage *Image1;
    TShape *Shape1;
    TLabel *Label1;
    TLabel *Label2;
    TLabel *Label3;
    TLabel *Label4;
    TLabel *Label5;
   void __fastcall FormKeyDown ( TObject *Sender, WORD &Key,
          TShiftState Shift );
    void __fastcall Timer1Timer ( TObject *Sender );
    void __fastcall Inicializa_Processos ( TObject *Sender );
    void __fastcall gameOver ( TObject *Sender );
    void __fastcall Partida ( TObject *Sender );
    void __fastcall Direciona_Snake ( TObject *Sender );
    void __fastcall Limpa_Tela ( TObject *Sender );
    void __fastcall Label1Click ( TObject *Sender );
    void __fastcall Label2Click ( TObject *Sender );
    void __fastcall FormShow ( TObject *Sender );
    void __fastcall Embaralha_Frutas ( TObject *Sender );
private:    // User declarations
public:        // User declarations
        __fastcall TForm2(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif