Author Topic: Object-oriented programming (OOP) in Asmc  (Read 7081 times)

nidud

  • Member
  • *****
  • Posts: 2001
    • https://github.com/nidud/asmc
Re: Object-oriented programming (OOP) in Asmc
« Reply #45 on: October 07, 2020, 04:18:06 AM »
Simple Direct2D Application

  Draws shapes, text, and images with Direct2D.

This sample loads two images. One from disk and one from resource. However, the image is rather big (770K) so the app just download the image from the MS site instead. The first run will therefor take some time to load.

Files
SimpleDirect2dApplication.asm: Contains the application entry point and the implementation of the DemoApp class.
SimpleDirect2dApplication.inc: The header file for the DemoApp class.

Building the Sample

  To build the sample using the command prompt:

asmc64 -pe -ws -gui SimpleDirect2dApplication.asm

nidud

  • Member
  • *****
  • Posts: 2001
    • https://github.com/nidud/asmc
Re: Object-oriented programming (OOP) in Asmc
« Reply #46 on: October 12, 2020, 11:36:30 PM »
Direct2D Geometry Realization Sample

This sample shows how to use opacity masks and A8 targets to enhance performance for anti-aliased geometries. It also shows how to use meshes to enhance performance for aliased geometries.

Files
GeometryRealization.asm: Implements the IGeometryRealization interface.
GeometryRealization.inc: Defines the IGeometryRealization interface and related types.
GeometryRealizationSample.asm: Implements the DemoApp class, which creates a window and demonstrates the IGeometryRealization interface.
GeometryRealizationSample.inc: Defines the the DemoApp class.
RingBuffer.inc: The header file for the RingBuffer class. RingBuffer works like a standard array, except that when it fills up, data at the beginning is overwritten.
stdafx.inc: Defines standard system include files, or project specific include files that are used frequently, but are changed infrequently.

Building the Sample
Generate PE binary file:
  asmc64 -pe -Cs -ws -gui GeometryRealizationSample.asm
Using LINKW:
  asmc64 -q -ws -Cs GeometryRealization.asm
  asmc64 -q -ws -Cs GeometryRealizationSample.asm
  linkw system gui_64W file GeometryRealizationSample, GeometryRealization

Running the Sample
This sample uses the following controls:

  Up Arrow: Increases the number of primitives rendered
  Down Arrow: Decreases the number of primitives rendered
  Spacebar: Pauses/resumes the animation.
  Mouse Wheel: Zooms in and out.
  'T' key: Toggles between hardware and software rendering.
  'R' key: Toggles between rendering geometry with and without realizations.
  'A' key: Toggles between rendering modes.
  'S' key: Toggles Draw Stroke (outlines).
« Last Edit: October 13, 2020, 08:38:14 PM by nidud »

nidud

  • Member
  • *****
  • Posts: 2001
    • https://github.com/nidud/asmc
Re: Object-oriented programming (OOP) in Asmc
« Reply #47 on: October 17, 2020, 04:43:51 AM »
Direct2D List View Sample

This sample shows how to create and use a bitmap atlas to create and animate a list of items. The list view loads the files and directories from the current directory with the icons. The directories and files in the list view can be sorted in the alphabetical and reverse alphabetical order.

Files
ListViewSample.asm: Contains the application entry point and the implementation of the ListViewAppclass.
ListViewSample.inc: The header file for the ListViewApp class.

Running the Sample
Use the following keys to sort the list:

'A' key: sorts the list alphabetically.
'Z' Key: sorts the list in reverse alphabetical order.
'D' Key: sorts the list alphabetically with directories first.

Changes
Support for a second pointer added to INVOKE. This is added for accessing members of a class and static levels of functions in regular structures.

Example

.class ListViewApp

    m_pD2DFactory           LPID2D1Factory ?
    m_pWICFactory           LPIWICImagingFactory ?
    m_pDWriteFactory        LPIDWriteFactory ?
    m_pRT                   LPID2D1HwndRenderTarget ?
    m_pTextFormat           LPIDWriteTextFormat ?
    m_pBlackBrush           LPID2D1SolidColorBrush ?
    m_pBindContext          LPIBindCtx ?
    m_pBitmapAtlas          LPID2D1Bitmap ?

These pointers may now be accessed directly:

       .new dpiX:FLOAT
       .new dpiY:FLOAT

        this.m_pD2DFactory.GetDesktopDpi(&dpiX, &dpiY)
        this.m_pTextFormat.SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING)

It adds a move to resolve the pointer using RAX but the arguments are sorted before the call so there is no risk of trashing registers.

   *    lea r8, dpiY
   *    lea rdx, dpiX
   *    mov rax, this
   *    mov rcx, [rax].ListViewApp.m_pD2DFactory
   *    mov rax, [rcx]
   *    call [rax].ID2D1FactoryVtbl.GetDesktopDpi


nidud

  • Member
  • *****
  • Posts: 2001
    • https://github.com/nidud/asmc
Re: Object-oriented programming (OOP) in Asmc
« Reply #48 on: October 22, 2020, 02:14:51 AM »
Added some more of the mf headers and a console sample.

    mfapi.inc
    mferror.inc
    mfidl.inc
    mfobjects.inc
    mfreadwrite.inc
    mftransform.inc


AudioClip sample

Demonstrates using the IMFSourceReader API to get uncompressed media data from a media file. This sample application reads audio data from a media file and writes the uncompressed audio to a WAVE file.

Files
AudioClip.asm
« Last Edit: October 22, 2020, 12:25:48 PM by nidud »

nidud

  • Member
  • *****
  • Posts: 2001
    • https://github.com/nidud/asmc
Re: Object-oriented programming (OOP) in Asmc
« Reply #49 on: October 22, 2020, 12:27:20 PM »
Added mfplay.inc and a gui sample.

SimplePlay Sample

  Shows how to play a media file using the MFPlay API.

APIs Demonstrated
This sample demonstrates the following Microsoft Media Foundation interfaces:

  IMFPMediaItem
  IMFPMediaPlayer
  IMFPMediaPlayerCallback

Files
SimplePlay.asm