Giter Club home page Giter Club logo

Comments (47)

Dgame avatar Dgame commented on May 25, 2024

Did you tried to remove Style.HighDPI and pass only Style.OpenGL | Style.Shown to the Window?
Would be nice if you could show me your code. Do you change the window size somehow?

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Seems related to this SDL issue: http://forums.libsdl.org/viewtopic.php?t=9576&sid=090b706304f1829218c9c0f6887cce86

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Thanks, I am completely new to Dgame and was following the tutorials so I didn't know about that. Style.OpenGL works fine, but Style.Shown and Style.HighDPI crash the process. Is that a bug?

$ dub
Target derelict-util 2.0.0 is up to date. Use --force to rebuild.
Target derelict-sdl2 1.9.5 is up to date. Use --force to rebuild.
Target derelict-gl3 1.0.12 is up to date. Use --force to rebuild.
Target dgame 0.5.3 is up to date. Use --force to rebuild.
Building dungeon ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
Running ./dungeon
SDL version: 2.0.3
Error executing command run:
Program exited with code -11

Here is the code
https://gist.github.com/JackStouffer/77f0843449a211e76614

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Also, changing the window call in that code to

Window wnd = Window(640, 480, "Dgame Test", Window.Style.OpenGL, GLSettings(0, 0, 2));

crashes the process as well

from dgame.

Dgame avatar Dgame commented on May 25, 2024

It shouldn't crash at all, but in your last example it crashes because OpenGL 0.0.2 does not exists. OpenGL 2.1 is needed at least, but I schould cover this, thanks. ;)
Did you tried Style.OpenGL | Style.Shown?

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

The last argument to GLSettings is also part of the version? In the tutorial it says that it's for anti-aliasing http://dgame-dev.de/?page=tutorial&tut=gl_settings If that is not for anti-aliasing how do you add it in?

Also, yes Style.OpenGL works fine, I was using Style.Default when I had the rendering error. Putting in Style.OpenGL | Style.Shown in works as well, but passing in Style.HighDPI or Style.Shown by themselves crashes the process.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

I'm sorry you're right. I was in a hurry and I've overlooked it, I thought for a momemt you put the patch level to OpenGL, not the Anti-Alias Level. :)

Also, yes Style.OpenGL works fine, I was using Style.Default when I had the rendering error. Putting in Style.OpenGL | Style.Shown in works as well, but passing in Style.HighDPI or Style.Shown by themselves crashes the process.

Yes because Style.OpenGL is always needed. Only in special cases if you exactly know what you are doing you can ignore it. Otherwise you must combine them with a bit or (Style.Shown | Style.OpenGL). I'll add a note for that in the coming version 0.6. :)

Besides that it I've got the feeling, that you discoverd the SDL bug which I mentioned before. I'll try to find a solution, but because I have no Mac I would like to notify you then, so that you can test that. Would that be ok?

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Sure, you can notify me.

Is the anti-aliasing bug a part of the same issue?

from dgame.

Dgame avatar Dgame commented on May 25, 2024

No I'm sure it has something to do with the absence of Style.Shown. I will investigate that.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

I am passing in Style.Shown like so:

Window wnd = Window(640, 480, "Dgame Test", Window.Style.OpenGL | Window.Style.Shown, GLSettings(0, 0, 2));

from dgame.

Dgame avatar Dgame commented on May 25, 2024

And that makes the application crash?

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Yeah. Also, the terminal output is the same as the error output above.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

And without GLSettings(0, 0, 2) it works?

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Yup.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Seems to be an OSX issue. What is your Mac version?

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

10.10.3

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Thanks a lot, I'll examine it tonight. Sorry for your trouble.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

It's cool man, you're working for free :)

from dgame.

Dgame avatar Dgame commented on May 25, 2024

BTW: Do you have some other OS where you can test if it works? Then we could narrow it down to OSX.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

I can boot up a linux VM. I will get back to you when I have D and SDL installed in it.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Ok, after trying to install OpenGL 3 on linux unsuccessfully for three hours, I am giving up. I am going to try to test this on windows instead.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Don't rush yourself. I am on Windows 8.1 Pro, 64 bit and it works like a charm.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

I figured that I should create a separate issue for this, but I might as well mention it now. For some reason, the sprite in a player class does not render while sprites defined and drawn in the main loop render fine. Here is the code which demonstrates this: https://gist.github.com/JackStouffer/77f0843449a211e76614

I have tried many different images to make sure that there wasn't something wrong with the png, but each image just renders a blank white square.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

That's not a bug, it's your fault, but maybe I should mention it somehow in the docs. ;)
You must hold the Texture because the Sprite does not own it, it stores only a pointer to it.
Dgame tries to avoid classes and Heap Allocations as much as possible, therefore many parts of Dgame (as Textures) are structs.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Ah, ok. I was able to fix it from your comment, thanks.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

@JackStouffer Did you tried Windows or Linux and can say me that it works?

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Oh sorry, I thought your comment implied that me testing it on Windows would be redundant because you have already tested it. I will test it on my windows machine by the end of the day.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Each machine is different. :) Would be nice to know if it works on linux,, but since no other issues were reported I'm sure it works.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Ok, I tried linux agian, this time on a different machine, but now I am getting this error:

$ dub
Target derelict-util 2.0.0 is up to date. Use --force to rebuild.
Target derelict-sdl2 1.9.5 is up to date. Use --force to rebuild.
Target derelict-gl3 1.0.13 is up to date. Use --force to rebuild.
Target dgame 0.5.3 is up to date. Use --force to rebuild.
Target dungeon ~master is up to date. Use --force to rebuild.
Running ./dungeon 
SDL version: 2.0.2
core.exception.AssertError@../.dub/packages/dgame-0.5.3/source/Dgame/Internal/Error.d(12): Error: Failed to init the required jpg and png support: PNG images are not supported

----------------
./dungeon(nothrow @nogc void Dgame.Internal.Error.assert_fmt!(const(char)*).assert_fmt(bool, immutable(char)[], const(char)*)+0x7b) [0x4e619b]
./dungeon(void Dgame.Window.Internal.Init._initSDL()+0x15b) [0x4edaf7]
./dungeon(ref Dgame.Window.Window.Window Dgame.Window.Window.Window.__ctor!().__ctor(const(Dgame.Math.Rect.Rect), immutable(char)[], uint, Dgame.Window.GLSettings.GLSettings)+0x3a) [0x4e9c36]
./dungeon(ref Dgame.Window.Window.Window Dgame.Window.Window.Window.__ctor(uint, uint, immutable(char)[], uint, Dgame.Window.GLSettings.GLSettings)+0x7c) [0x4e89f8]
./dungeon(_Dmain+0x7b) [0x4e10a3]
./dungeon(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv+0x1f) [0x5109bf]
./dungeon(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x510912]
./dungeon(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x30) [0x510978]
./dungeon(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x510912]
./dungeon(_d_run_main+0x1dc) [0x51088c]
./dungeon(main+0x25) [0x4e1935]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fa105536ec5]
Error executing command run:
Program exited with code 1

I have all of the latest sdl libraries installed as well as libpng.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

AFAIK the default SDL version on linux has no PNG support (which is required for Dgame) and you have to build the SDL by yourself. But you can test it in C++ if you want: https://www.libsdl.org/projects/SDL_image/docs/SDL_image_frame.html

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

I can now confirm that anti-aliasing works on linux. Specifically, this was tested with mesa OpenGL 3.0 on Ubuntu 14.04 LTS.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

With Dgame 0.5 or 0.6 or both?

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

0.5

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Thank you very much. If you find the time, it would be very helpful if you would test also Dgame 0.6 beta.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Is it possible to download the 0.6 beta with dub?

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Yes:
"dgame": "~>0.6.0-beta.1"

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Unfortunately that causes dub to throw an error:

$ dub upgrade
Upgrading project in /Users/Jack/Dropbox/code/dlang/dungeon_game
Error executing command upgrade:
Root package dungeon contains reference to invalid package dgame

Here is the dub.json

{
    "name": "dungeon",
    "sourcePaths":["."],
    "dependencies": {
        "dgame": "~>0.6.0-beta.1"
    },
    "targetType":"executable"
}

from dgame.

Dgame avatar Dgame commented on May 25, 2024

That's odd, maybe you schould clear all Dgame specific dub stuff first.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

I deleted the stored Dgame library in ~/.dub/ and deleted dub.selections.json file, but I am still getting the same error.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Seems to be a dub issue since it works for me. Maybe you use an outdated version? I use 0.9.23

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

I have the latest version as well

$ dub --version
DUB version 0.9.23, built on Apr  6 2015

If I place "dgame": ">=0.5.0" back in everything works fine.

I am going to test this on linux and see what happens.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

dub upgrade on linux works. I am going to create an issue on the dub project for this.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Thanks a lot. And the anti-alias/High-DPI works with the 0.6? You have to enable HighDPI now by yourself.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

Well, I couldn't get the linux VM I have on my Mac with the high DPI screen to work, so the linux machine I have been testing on is on a normal 1080p screen. And I can't get dub to download the newest beta on my Mac, so I can't test it.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

Alright, then thank you very much for your effort. I will close this as this is a known bug for Mac OS.

from dgame.

JackStouffer avatar JackStouffer commented on May 25, 2024

I wouldn't close this as we don't know for sure if the anti-aliasing is working for Mac yet.

from dgame.

Dgame avatar Dgame commented on May 25, 2024

But Anti-Alias is not the main concern here, that was High-DPI. If Anti-Alias is not working we will see a new issue

from dgame.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.