zdar lidi
prvni dotaz: dá se nějak dostat do programu obrazek? (jedná se o jednoduchý obrázek v bmp kreslený podle ruky)
druhý dost: dá se změnit velikost písma?
třetí dotaz: rozezná program stisknutí šipky? chtěl jsem vytvořit pohyblivé menu ale pohyb pomocí písmen + zmáčknutí enter není nejlepší
Fórum › Pascal
Par dotazu

urcite sa da, staci len zadat www.google.com a slovo na vyhladavanie. a preco prave Pascal ? Tipujem ze vam v skole povedali ze je to najlepsi programovaci jazyk ;) , to bolo niekedy. Skus Javu(ta nema zlozite GUI), C++ , C# alebo nieco ine, ktore sa da vauzit.
Ahoj! Vezmeme to odzadu:
3) stisknutí šipky se rozeznává funkcemi ReadKey a Keypressed. Tyto funkce jsou v jednotce Crt. Doporučuju používat tento postup:
uses Crt;
const SNahoru = 256+72;
SDolu = 256+80;
SVpravo = 256+77;
SVlevo = 256+75;
Escape = 27;
Function NactiKlavesu:word;
var c:char;
begin
c:=ReadKey; {nacte kod klavesy}
if c=0 then NactiKlavesu:=256+Readkey else NactiKlavesu:=c; {nektere klavesy vraci napred 0 a az pote primo kod klavesy. To je treba pripad sipek}
end; {a mame nacteno - at uz to byl primy kod nebo kod s prefixovou nulou}
var k:word;
begin
...
repeat
repeat
{Sem muzes vlozit akci, ktera se deje furt - at uz je klavesa stiskla nebo ne}
until Keypressed; {jestli byla zmacknuta klavesa, tak vyskoc z cyklu}
k:=NactiKlavesu; {jaka klavesa to ale byla?}
case K of
SDolu: ZpracujKlavesuDolu;
SNahoru: ZpracujKlavesuNahoru;
SDoleva: ZpracujKlavesuDoleva;
SDoprava: ZpracujKlavesuDoprava;
end;
until k=Escape; {jestli to byl Escape, tak vyskoc z celeho cyklu}
...
end.
2) Druh písma se dá měnit jenom v grafickém režimu. V textovém režimu se dá měnit jenom barva. (pomocí funkce SetTextColor z jednotky Crt)
Práce s grafikou v pascalu sebou nese omezení vyplývající z toho, že poslední verze Turbo pascalu je z roku 1993 a že je pro DOS. Nicméně existují všelijaká rozšíření, která tato omezení částečně řeší. V neposlední řadě existuje ještě jiný překladač pascalu - Freepascal, který existuje i pro Windows a pro Linux (i pro DOS)
Nicméně společný základ je stejný: práce s grafikou se dělá pomocí jednotky Graph:
uses Graph;
const
UMISTENI_OVLADACE_BGI = 'c:\pascal\bgi'; {v originalni instalaci pascalu jsou BGI soubory v podadresari BGI. Ty ale nevis, kde (a zda) je bude mit uzivatel, takze je distribuuj spolecne s tvym programem. Jestlize bude treba ve stejne slozce jako EXE, tak zadas proste prazdny retezec: UMISTENI_OVLADACE_BGI = ''}
var gd,gm:integer;
begin
gd:=Vga;
gm:=VgaHi; {640x480, 16 barev}
InitGraph(gd,gm,UMISTENI_OVLADACE_BGI);
SetTextStyle(...); {podivej se do napovedy}
OutText('Ahoj svete!');
readln;
CloseGraph;
1) Pro zobrazování obrázků zase platí, že musíš být v grafickém režimu. Tady bude problém standardní omezení na 16 barev. Tady je málo prostoru na vysvětlování, takže jestli tě to zajímá, tak si počti třeba tady:
http://www.int21h.ic.cz

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 23 hostů
Podobná vlákna
Pár dotazů — založil oxidián
Pár dotazů k VS — založil yaqwsx
GUI - pár dotazů — založil Hoptile12
Pár dotazů začátečníka — založil Marek
Par dotazu k DirectX a C++ obecne — založil CommanderZ
Moderátoři diskuze