

Wak
Members-
Content Count
5 -
Joined
-
Last visited
Everything posted by Wak
-
I've worked with generics quite a bit, but I have never tried to define a generic pointer type to another generic type: TMyType<T> = record ID: T; end; PMyType<T> = ^TMyType<T>; // Error: E2508 type parameters not allowed on this type TMyTypes<T> = array of TMyType<T>; // OK PMyTypes<T> = array of ^TMyType<T>; // OK TMyTypeHack<T> = record P: ^TMyType<T>; // OK end; This raises a compiler error. It seems Delphi doesn't allow type aliases like this, but allows using them in the definition of array/record types. Has anyone found a trick to achieve it? Thanks!
-
I have never used Datamodules and wonder if it is compressed after compilation? Yes, Patrick's method is better because compression is unnecessary for IPA and APK files, which are also Zip-compressed. For the Mac and Windows apps, compressing them and using conditional resources should help. Including eight styles resulted in a size increase of 965 KB for the Mac app and 3.24 MB for the Windows app. They are 8 MB and 15.5 MB without compression. {$IFDEF MSWINDOWS} {$R 'Styles\Polar.Win.res'} {$ENDIF} {$IFDEF MACOS} {$R 'Styles\Polar.Mac.res'} {$ENDIF}
-
Does anyone know a delphi component that can play videos from a stream
Wak replied to ToddFrankson's topic in VCL
Gabriel Corneanu wrote a DirectShow filter for this purpose: https://cc.embarcadero.com/Item/21110 Back in the day, I modified it and successfully got it running with DirectShow9 and Delphi 2009. I used it to play encrypted videos, decrypting them on-the-fly. With the codecs installed, it plays avi, mpeg, mkv, ogg, rmvb, mp4... Playing wmv videos requires some tricks. The catch: DirectShow9 seems to briefly load the whole video into memory, so it cannot play large videos (like 1GB). -
I used TStyleManager for style control and added the .styles files to the resource. However, this increased the size too much and I want to include multiple styles. So I embedded compressed zip files instead. Each style became ~15% of its original size. It is also not difficult to handle: // modified from my code, not tested but should work function LoadZippedStyleFromResource(const ResName, Filename: string): TFmxObject; var rs, ms: TStream; ZipFile: TZipFile; ZipHeader: TZipHeader; begin try rs := TResourceStream.Create(HInstance, ResName, RT_RCDATA); ZipFile := TZipFile.Create; try ZipFile.Open(rs, zmRead); ZipFile.Read(Filename, ms, ZipHeader); try ms.Position := 0; Result := TStyleStreaming.LoadFromStream(ms); finally ms.Free; end; finally ZipFile.Free; FreeAndNil(rs); end except FreeAndNil(rs); Exit(nil); end; end; // used like this Style := LoadZippedStyleFromResource('Polar', 'PolarDark.style'); if Assigned(Style) then TStyleManager.SetStyle(Style);
-
Class alias for class helper doesn't make class helper visible for compiler.
Wak replied to dmitrybv's topic in RTL and Delphi Object Pascal
The helper is not in the scope because Unit1 is not in the Uses list.