This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ Screen Scaling for Device } | |
function GetScreenScale: Single; | |
var | |
ScreenService: IFMXScreenService; | |
begin | |
Result := 1; | |
if TPlatformServices.Current.SupportsPlatformService (IFMXScreenService, IInterface(ScreenService)) then | |
begin | |
Result := ScreenService.GetScreenScale; | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ Where AVP is the TViewport3D or self on a TForm3D } | |
var tmpsp: TPoint3D := ScreenHelper.CalculateScreenPosition(AVP.Context, | |
TPoint3D.Zero, Layer3D1.Scale.Point, Layer3D1.RotationAngle.Point, Layer3D1.Position.Point); | |
Circle1.Position.X := tmpsp.X - Circle1.Width / 2; | |
Circle1.Position.Y := tmpsp.Y - Circle1.Width / 2; | |
{ FIX: TPaintBox offset position } | |
tmpsp.X := tmpsp.X - PaintBox1.Position.X; | |
tmpsp.Y := tmpsp.Y - PaintBox1.Position.Y; | |
tmpr := RectF(tmpsp.X -FSize, tmpsp.Y -FSize, tmpsp.X +FSize, tmpsp.Y +FSize); | |
{ ABMP is a TBitmap } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ Obtains device scaling } | |
function GetScreenScale: Single; | |
var | |
ScreenService: IFMXScreenService; | |
begin | |
Result := 1; | |
if TPlatformServices.Current.SupportsPlatformService (IFMXScreenService, IInterface(ScreenService)) then | |
begin | |
Result := ScreenService.GetScreenScale; | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tmpsp: TPoint3D := TPoint3D.Zero; | |
// Obtain the screen coordinate by using the WorldToScreen method | |
tmpsp := self.Context.WorldToScreen(TProjection.Camera, Layer3D1.Position.Point); | |
writeln('2D Position: ' + tmpsp.X.ToString + ', ' + tmpsp.Y.ToString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A docker-compose must always start by the version tag. | |
# We use '3' because it's the last version at this time. | |
version: '3' | |
# You should know that docker-composes works with services. | |
# 1 service = 1 container. | |
# For example, a service maybe, a server, a client, a database... | |
# We use the keyword 'services' to start to create services. | |
services: | |
# As we said at the beginning, we want to create: a server and a client. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- BEGIN_INCLUDE(manifest) --> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="%package%" | |
android:versionCode="%versionCode%" | |
android:versionName="%versionName%" | |
android:installLocation="%installLocation%"> | |
<uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="33" /> | |
<%uses-permission%> | |
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TFrmMain.FormCreate(Sender: TObject); | |
begin | |
{$IFDEF IOS} | |
if NotificationCenter1.AuthorizationStatus <> TAuthorizationStatus.Authorized then begin | |
NotificationCenter1.RequestPermission; | |
end; | |
{$ENDIF} | |
{$IFDEF ANDROID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ TErrorTodo } | |
constructor TErrorTodo.Create(ErrorMessage: string); | |
begin | |
self.ErrorMessage := ErrorMessage; | |
end; | |
function TErrorTodo.GetSelf: TObject; | |
begin | |
Result := Self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ITodo = interface | |
end; | |
TErrorTodo = class(TInterfacedObject, ITodo) | |
public | |
[JSONMarshalled(True)][JSONName('error_message')] | |
ErrorMessage: string; | |
constructor Create(ErrorMessage: string); | |
function GetSelf: TObject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ TPosthocProgSettings } | |
class function TTodoProgSettings.GetDefaultSettingsFilename: string; | |
begin | |
Result := TPath.Combine(GetSettingsFolder(), 'init.bin'); | |
end; | |
class function TTodoProgSettings.GetSettingsFolder: string; | |
var |
NewerOlder