-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjimie.cpp
69 lines (60 loc) · 1.81 KB
/
jimie.cpp
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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "jimie.h"
#include "wspolne.h"
#include <iostream.h>
#include <fstream.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Timie *imie;
//---------------------------------------------------------------------------
__fastcall Timie::Timie(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Timie::BitBtn1Click(TObject *Sender)
{
if(Edit1->Text!="")Close();
}
//---------------------------------------------------------------------------
void __fastcall Timie::FormActivate(TObject *Sender)
{
Edit1->Text=""; ListBox1->Clear();
TSearchRec sr;
if (FindFirst("*.gra", faAnyFile, sr) == 0)
{
do
{
if ((sr.Attr & faDirectory) != sr.Attr)
{
sr.Name.SetLength(sr.Name.Length()-4);
ListBox1->Items->Add(ExtractFileName(sr.Name));
}
} while (FindNext(sr) == 0);
FindClose(sr);
}
}
//---------------------------------------------------------------------------
void __fastcall Timie::SpeedButton1Click(TObject *Sender)
{
if(Edit1->Text=="") return;
unsigned char RYSUNKI[LRYS];
memset(RYSUNKI,1,sizeof RYSUNKI);
AnsiString s = Edit1->Text;
s+=".gra";
ofstream out(s.c_str(),ios::out | ios::binary);
if(out){
out.put(1);
out.write((unsigned char *)RYSUNKI,sizeof RYSUNKI);
Close(); }
}
//---------------------------------------------------------------------------
void __fastcall Timie::ListBox1Click(TObject *Sender)
{
Edit1->Text = ListBox1->Items->Strings[ListBox1->ItemIndex];
BitBtn1->Enabled=true;
}
//---------------------------------------------------------------------------