July 08, 2021

On Thursday, 8 July 2021 at 14:20:16 UTC, Виталий Фадеев wrote:

>

Has dub flag for disable "warnings are treated as errors" ?

You have to edit the package file to include buildRequirements "allowWarnings", see https://dub.pm/package-format-sdl.html#build-requirements

July 08, 2021
On Thursday, 8 July 2021 at 15:57:53 UTC, drug wrote:
> 08.07.2021 18:46, Виталий Фадеев пишет:
>> On Thursday, 8 July 2021 at 15:30:07 UTC, drug wrote:
>>> 08.07.2021 17:20, Виталий Фадеев пишет:
>>>> [...]
>>>
>>> I failed to reproduce that. What platform you use and what is the compiler version?
>> 
>> drug, Linux, Ubuntu, x64
>> # uname -a
>> Linux unknown 5.11.0-22-generic #23-Ubuntu SMP Thu Jun 17 00:34:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
>> 
>> # dmd --version
>> DMD64 D Compiler v2.097.0
>> 
>> # dub --version
>> DUB version 1.26.0, built on Jun  3 2021
>> 
>> #  pkg-config --modversion sdl2
>> 2.0.14
>
> Yes, it's reproducible with dmd 2.097. Trivial fix is deleting that line `../../sdl2/gfm/sdl2/timer.d:69` then it works.

Thank, drug.
I think some like this:

  env DFLAGS=-wi dub run

or like this

  "buildRequirements": [ "allowWarnings" ]

without gfm/sdl2/timer.d editing.

Yes, you right. It can be removed. I will do it.

        try
        {
            SDL2Timer timer = cast(SDL2Timer)param;
            return timer.onTimer(interval);
        }
        catch (Throwable e)
        {
            // No Throwable is supposed to cross C callbacks boundaries
            // Crash immediately
            exit(-1);
            return 0; // <--HERE WARMING
        }

It is worked! Thank!


July 08, 2021
On Thursday, 8 July 2021 at 14:09:30 UTC, drug wrote:
> 08.07.2021 16:51, Виталий Фадеев пишет:
>> Hi!
>> 
>> I searching trivial simple D/OpenGL working in 2021 year example.
>> 
>> It may be triangle.
>> It may be based on any library: SDL, GLFW, Derelict, etc.
>> 
>> Can you help me ?
>> 
>
> https://github.com/drug007/gfm7/tree/master/examples/simpleshader
>
> it's not trivial though but it works (tested in linux)
> just `dub fetch gfm7` then go to `path\to\gfm7\examples\simpleshader` and run `dub`.
>
> All kudos to Guillaume Piolat, original author of gfm library.

If like me you hate OpenGL :) you can can also get software-rendered DPI-aware triangles with the "turtle" package:
https://code.dlang.org/packages/turtle

(Courtesy of Cerjones for the software renderer. )
July 08, 2021
On Thursday, 8 July 2021 at 16:01:37 UTC, Dennis wrote:
> On Thursday, 8 July 2021 at 14:20:16 UTC, Виталий Фадеев wrote:
>> Has dub flag for disable "warnings are treated as errors" ?
>
> You have to edit the package file to include `buildRequirements "allowWarnings"`, see https://dub.pm/package-format-sdl.html#build-requirements

Dennis. thank.

# gfm7/examples/simpleshader/dub.json
{
    "targetType": "executable",
    "name": "simpleshader",
    "sourcePaths": [ "." ],
    "importPaths": [ "." ],
    "mainSourceFile": "simpleshader.d",

    "dependencies":
    {
        "gfm7:sdl2": {"path": "../../",.
            "buildRequirements": [ "allowWarnings" ]
        },
        "gfm7:opengl": {"path": "../../"},
        "gfm7:logger": {"path": "../../"}
    },
    "versions": [ "SDL_205", "GL_33", "GL_ARB"],
....
    "buildRequirements": [ "allowWarnings" ]
}


No effect. Same error.
I fix source code, as drug say.


July 08, 2021
08.07.2021 19:11, Виталий Фадеев пишет:

> I fix source code, as drug say.
> 
> 

I've fixed the issue upstream, shortly gfm7 v1.1.2 will be available.
July 08, 2021
On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote:
> Hi!
>
> I searching trivial simple D/OpenGL working in 2021 year example.
>
> It may be triangle.
> It may be based on any library: SDL, GLFW, Derelict, etc.
>
> Can you help me ?

this one of mine [1] was very simple in the beginning. It even runs on browser now.

[1] https://github.com/aferust/drawee
July 09, 2021
On Thursday, 8 July 2021 at 16:11:17 UTC, Guillaume Piolat wrote:
> On Thursday, 8 July 2021 at 14:09:30 UTC, drug wrote:
>> 08.07.2021 16:51, Виталий Фадеев пишет:
>>> Hi!
>>> 
>>> I searching trivial simple D/OpenGL working in 2021 year example.
>>> 
>>> It may be triangle.
>>> It may be based on any library: SDL, GLFW, Derelict, etc.
>>> 
>>> Can you help me ?
>>> 
>>
>> https://github.com/drug007/gfm7/tree/master/examples/simpleshader
>>
>> it's not trivial though but it works (tested in linux)
>> just `dub fetch gfm7` then go to `path\to\gfm7\examples\simpleshader` and run `dub`.
>>
>> All kudos to Guillaume Piolat, original author of gfm library.
>
> If like me you hate OpenGL :) you can can also get software-rendered DPI-aware triangles with the "turtle" package:
> https://code.dlang.org/packages/turtle
>
> (Courtesy of Cerjones for the software renderer. )

Thank, Guillaume Piolat.

I using CPU Pentium B970 It is old CPU, but even it contains a graphics accelerator.
Mesa DRI Intel(R) HD Graphics 2000 (SNB GT1), has 4 conveers on GPU.
Smartphones also contains GPU.
Because OpenGL has high priority.

CPU render, may be later.

Thanks, I noticed turtle, dg2d. It has clipping, it usefull.
What about text rendering ?

July 09, 2021
On Thursday, 8 July 2021 at 16:32:44 UTC, drug wrote:
> 08.07.2021 19:11, Виталий Фадеев пишет:
>
>> I fix source code, as drug say.
>> 
>> 
>
> I've fixed the issue upstream, shortly gfm7 v1.1.2 will be available.

Drug, thank! I using!
July 09, 2021

On Thursday, 8 July 2021 at 17:20:14 UTC, Ferhat Kurtulmuş wrote:

>

On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote:

>

Hi!

I searching trivial simple D/OpenGL working in 2021 year example.

It may be triangle.
It may be based on any library: SDL, GLFW, Derelict, etc.

Can you help me ?

this one of mine [1] was very simple in the beginning. It even runs on browser now.

[1] https://github.com/aferust/drawee

Ferhat Kurtulmuş, thank you!

I has error on build:

# dub run

## Warning for package drawee, configuration wasm ##

The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:

-c: Automatically issued by DUB, do not specify in dub.json

Performing "debug" build using /usr/bin/dmd for x86_64.
bcaa 0.0.7: target for configuration "default" is up to date.
bindbc-loader 0.2.1: target for configuration "yesBC" is up to date.
bindbc-opengl 0.12.0: target for configuration "dynamicBC" is up to date.
bindbc-sdl 0.13.0: target for configuration "staticBC" is up to date.
chipmunkd 1.0.1+7.0.1: target for configuration "library" is up to date.
dvector 0.0.5: target for configuration "library" is up to date.
earcutd 0.0.2: target for configuration "default" is up to date.
drawee 0.0.1: building configuration "default"...
Linking...
/usr/bin/ld: cannot find -lchipmunk
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
/usr/bin/dmd failed with exit code 1.

And second chance:

# dub build --config=wasm --compiler=ldc2 --build=release --build-mode=allAtOnce --combined --arch=wasm32-unknown-unknown-wasm -v

Using dub registry url 'https://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/vital/.dub/packages/local-packages.json
Looking for local package map at /home/vital/src/dtest/working-example-5/drawee/.dub/packages/local-packages.json
Ignoring version specification (>=0.0.0) for path based dependency .
Ignoring version specification (>=0.0.0) for path based dependency .
Ignoring version specification (>=0.0.0) for path based dependency .
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/vital/.dub/packages/local-packages.json
Looking for local package map at /home/vital/src/dtest/working-example-5/drawee/.dub/packages/local-packages.json
  Found dependency bindbc-opengl 0.12.0
    Found dependency bindbc-loader 0.2.1
  Found dependency dvector 0.0.5
  Found dependency earcutd 0.0.2
  Found dependency bcaa 0.0.7
  Found dependency bindbc-sdl 0.13.0
  Found dependency bettercmath 0.3.1
  Found dependency chipmunkd 1.0.1+7.0.1
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/vital/.dub/packages/local-packages.json
Looking for local package map at /home/vital/src/dtest/working-example-5/drawee/.dub/packages/local-packages.json
  Found dependency bindbc-opengl 0.12.0
    Found dependency bindbc-loader 0.2.1
  Found dependency dvector 0.0.5
  Found dependency earcutd 0.0.2
  Found dependency bcaa 0.0.7
  Found dependency bindbc-sdl 0.13.0
  Found dependency bettercmath 0.3.1
  Found dependency chipmunkd 1.0.1+7.0.1

## Warning for package drawee, configuration wasm ##

The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:

-c: Automatically issued by DUB, do not specify in dub.json

Generating using build
Configuring dependent drawee, deps:"bindbc-sdl"
  Configuring dependent bindbc-sdl, deps:
Performing "release" build using ldc2 for .
Target '/home/vital/src/dtest/working-example-5/drawee/.dub/build/wasm-release-wasm--ldc_v1.24.0-F903DBE30DDE459672D4DB82B5AB44CF/libdrawee.a' doesn't exist, need rebuild.
drawee 0.0.1: building configuration "wasm"...
ldc2 --output-o --output-bc -c -mtriple=wasm32-unknown-unknown-wasm -lib -of.dub/build/wasm-release-wasm--ldc_v1.24.0-F903DBE30DDE459672D4DB82B5AB44CF/libdrawee.a -release -enable-inlining -Hkeep-all-bodies -O3 -w -betterC --oq -od=.dub/build/wasm-release-wasm--ldc_v1.24.0-F903DBE30DDE459672D4DB82B5AB44CF//obj -d-version=BindSDL_Static -d-version=BindSDL_TTF -d-version=BindSDL_Image -d-version=GL_41 -d-version=Have_drawee -d-version=Have_bcaa -d-version=Have_bettercmath -d-version=Have_chipmunkd -d-version=Have_dvector -d-version=Have_earcutd -d-version=Have_bindbc_sdl -Isource/ -I/home/vital/.dub/packages/bcaa-0.0.7/bcaa/source -I/home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/ -I/home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/ -I/home/vital/.dub/packages/dvector-0.0.5/dvector/source -I/home/vital/.dub/packages/earcutd-0.0.2/earcutd/source -I/home/vital/.dub/packages/bindbc-sdl-0.13.0/bindbc-sdl/source/ source/app.d source/boilerplate.d source/drawobjects.d source/enemyimp.d source/gamemath.d source/gl4.d source/globals.d source/heroimp.d source/msgnode.d source/obstacleimp.d source/primitives.d source/railimp.d source/tween.d /home/vital/.dub/packages/bcaa-0.0.7/bcaa/source/bcaa.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/box.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/cmath.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/easings.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/hexagrid2d.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/matrix.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/misc.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/package.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/transform.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/valuerange.d /home/vital/.dub/packages/bettercmath-0.3.1/bettercmath/source/bettercmath/vector.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/chipmunk.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/chipmunk_private.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/chipmunk_structs.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/chipmunk_types.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/chipmunk_unsafe.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpArbiter.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpBB.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpBody.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpConstraint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpDampedRotarySpring.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpDampedSpring.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpGearJoint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpGrooveJoint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpHastySpace.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpMarch.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpPinJoint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpPivotJoint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpPolyShape.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpPolyline.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpRatchetJoint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpRobust.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpRotaryLimitJoint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpShape.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpSimpleMotor.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpSlideJoint.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpSpace.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpSpatialIndex.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpTransform.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/cpVect.d /home/vital/.dub/packages/chipmunkd-1.0.1_7.0.1/chipmunkd/src/chipmunk/package.d /home/vital/.dub/packages/dvector-0.0.5/dvector/source/dvector.d /home/vital/.dub/packages/earcutd-0.0.2/earcutd/source/earcutd.d -L-allow-undefined -vcolumns
packs/phobos/std/range/package.d(920,58): Deprecation: storage class ref has no effect in type aliases
packs/druntime/src/core/sys/wasi/core.d(14,13): Error: version identifier WASI is reserved and cannot be set
FAIL .dub/build/wasm-release-wasm--ldc_v1.24.0-F903DBE30DDE459672D4DB82B5AB44CF/ drawee staticLibrary
ldc2 failed with exit code 1.

dub run
dub build --config=wasm --compiler=ldc2 --build=release --build-mode=allAtOnce --combined --arch=wasm32-unknown-unknown-wasm -v

Each ends with error.

July 09, 2021

On Friday, 9 July 2021 at 05:17:28 UTC, Виталий Фадеев wrote:

>

On Thursday, 8 July 2021 at 17:20:14 UTC, Ferhat Kurtulmuş wrote:

>

On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote:

>

Hi!

>

Each ends with error.

Dear Vitaly (Google translates it like that :)), I didn't touch that game for a while. I have just tried to compile and those are the steps to build and run it:

Using a Windows 10 x64. (Webassembly build needs crazy efforts, don't try it for now. If you are on a posix system please delete *.a folders from the root folder because they are for webassembly)

  1. Open the dub.json or dub.selections.json, and change "bcaa": "~>0.0.5" to "bcaa": "0.0.5" (Recently a contributor and I have made some breaking changes in bcaa).

  2. Have those lib and dll files in the root folder of the project:

chipmunk.lib // I manually compiled this one
libfreetype-6.dl
libjpeg-9.dll
libpng16-16.dll
libtiff-5.dll
libwebp-7.dll
SDL2_image.dll
SDL2_image.lib
SDL2_ttf.dll
SDL2_ttf.lib
SDL2.dll
SDL2.lib
zlib1.dll

basically, those are win 64-bit builds of SDL2, its friends, and their dependencies. If you provide an email, I can send them to you via wetransfer.

For posix builds, you will have to figure those out.