/
vuvk
/
ws3d_pascal
Обзор
Документация
Войти
/
vuvk
/
ws3d_pascal
Код
Запросы
0
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
FreePascal/Examples/03_BitmapFont.pas
92 строки
3 KB
Anton Vuvk
Initial commit v0.5.0
05 ноя 2018, 08:47
05 ноя 2018, 08:47
1ccdc16
Код
Авторство
О чём код?
// ---------------------------------------------------------------------------- // ������ ������ Vuvk // ����������� Nikolas (WorldSim3D developer) // ---------------------------------------------------------------------------- // ������ 03: ������ Bitmap (.bmp) // � ���� ������� ��� ����������� ������ �� ������ ������������ �����, ���������� // �� bitmap. ����� ����� ������������ ��� ���� ���� ������ .png // ---------------------------------------------------------------------------- program p03_BitmapFont; uses // ���������� ������� ���������� ������ SysUtils, WorldSim3D, SampleFunctions; var BitmapFont:wFont =nil; BitmapFont_2:wFont =nil; BitmapFont_3:wFont =nil; BitmapFont_Cyrillic:wFont =nil; fromPos:wVector2i =(x:120;y:0); toPos:wVector2i =(x:250;y:0); textColor:wColor4s =(alpha:255; red:255; green:255; blue:255); wndCaption:PWChar ='Example 03: Bitmap Fonts fps: '; prevFPS:Int32 =0; fontPath:PChar ='../../Assets/Fonts/thunder16.png'; fontPath2:PChar ='../../Assets/Fonts/myfont4.png'; fontPath3:PChar ='../../Assets/Fonts/papyrus_bold.png'; fontPath4:PChar ='../../Assets/Fonts/Cyr.xml'; begin {Start engine} if not wEngineStart(wDRT_OPENGL,wDEFAULT_SCREENSIZE,32,false,true,true,false) then Halt; {Check resources} CheckFilePath(fontPath); CheckFilePath(fontPath2); CheckFilePath(fontPath3); CheckFilePath(fontPath4); {Load resources} BitmapFont:= wFontLoad(fontPath); BitmapFont_2:= wFontLoad(fontPath2); BitmapFont_3:= wFontLoad(fontPath3); BitmapFont_Cyrillic:= wFontLoad(fontPath4); wEngineShowLogo(true); while wEngineRunning() do begin wSceneBegin(wCOLOR4s_BLACK); fromPos.y:=70; toPos.y:=86; textColor.red:=255; textColor.green:=0; textColor.blue:=0; wFontDraw ( BitmapFont, 'I''ll be back!', fromPos,toPos,textColor); fromPos.y:=100; toPos.y:=116; textColor.red:=0; textColor.green:=255; textColor.blue:=0; wFontDraw ( BitmapFont_2, 'WorldSim3D', fromPos,toPos,textColor); fromPos.y:=130; toPos.y:=146; textColor.red:=0; textColor.green:=0; textColor.blue:=255; wFontDraw ( BitmapFont_3, 'Game Over', fromPos,toPos,textColor); fromPos.y:=170; toPos.y:=186; textColor.red:=0; textColor.green:=255; textColor.blue:=255; wFontDraw ( BitmapFont_Cyrillic, WStr('� ���� ��������� ������� ���� �����!'), fromPos,toPos,textColor); wSceneEnd(); wEngineCloseByEsc(); if prevFPS<>wEngineGetFPS() then begin prevFPS:=wEngineGetFPS(); wWindowSetCaption(wndCaption+WStr(FormatFloat('0',prevFPS))); end; end; wEngineStop(true); end.