Author Topic: [Ndless] n2DLib  (Read 26743 times)

0 Members and 2 Guests are viewing this topic.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] n2DLib
« Reply #45 on: July 11, 2014, 12:18:07 pm »
No, it's just that for nSDL, there should be this before pixel data :
Code: [Select]
0x2a01, width, height, 0x0000,

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [Ndless] n2DLib
« Reply #46 on: July 11, 2014, 12:19:18 pm »
So 0x0000 as transparent color means no transparency?
Nope, it means that nSDL will load that, then you'll have to set the transparency in your program, for each sprite, nSDL will probably put it the way we do instead of that 0x0000 and then you'll have transparency.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [Ndless] n2DLib
« Reply #47 on: July 11, 2014, 02:03:47 pm »
So, ConvertImg should work now, it supports all three formats (nSDL, nGL and n2DLib) and two of them are of course untested.
It fully supports every file format Qt supports, if it's a file with transparency the transparency will be replaced by a unique new color, the lowest color that isn't already somewhere in the image. Link to the windows version: https://github.com/Vogtinator/ConvertImg/releases/tag/v0.9
For other OSs you need to compile it yourself: "qmake . && make && sudo make install"

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] n2DLib
« Reply #48 on: July 11, 2014, 02:15:24 pm »
Okay so I tried this with --format=n2dlib, and it doesn't set the correct transparency value. Actually, it doesn't set any value at all, it keeps being 0x0. nSDL format works fine though, thanks for this =]

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] n2DLib
« Reply #49 on: July 11, 2014, 02:20:00 pm »
Qt ? Is it still scriptable ?

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] n2DLib
« Reply #50 on: July 11, 2014, 02:21:22 pm »
Of course it's not, it's a proper executable, exactly how I like them ;D

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] n2DLib
« Reply #51 on: July 11, 2014, 02:22:32 pm »
What I'm asking is : can I use it in my makefile ? Scriptable = usable programmatically.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] n2DLib
« Reply #52 on: July 11, 2014, 02:25:58 pm »
Oh sorry. Actually it can't be used in another way.

Code: [Select]
ConvertImg --format=[n2dlib | ngl | nsdl] in [out]

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] n2DLib
« Reply #53 on: July 11, 2014, 02:26:54 pm »
Oh cool. I'll see how it works out in my setup. That script I made was actually designed with a specific purpose in mind. :P

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [Ndless] n2DLib
« Reply #54 on: July 11, 2014, 02:30:07 pm »
Quote
Okay so I tried this with --format=n2dlib, and it doesn't set the correct transparency value. Actually, it doesn't set any value at all, it keeps being 0x0. nSDL format works fine though, thanks for this =]
Well, 0x0 can be the correct value. I just tried it and for a small picture with just a black pixel in the center it works and picks the next available one.

Quote
What I'm asking is : can I use it in my makefile ? Scriptable = usable programmatically.
I'm using it in my Makefiles and it works without problems: ./ConvertImg --format=ngl blockselection.png blockselection.h

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] n2DLib
« Reply #55 on: July 11, 2014, 02:31:41 pm »
It's not available. I use 0x0000 in my image. Also, personally I would rather want the tool to use the top-left corner pixel as transparent color, because all of my images I ever used did that.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] n2DLib
« Reply #56 on: July 11, 2014, 02:32:18 pm »
Ah, but you make a .h for each sprite ? I >> all my sprites into a .c and let makeheaders work its magic, then link the .o with the tns.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [Ndless] n2DLib
« Reply #57 on: July 11, 2014, 02:36:59 pm »
Quote
It's not available. I use 0x0000 in my image.
Hm, could you send me your test picture then?
Quote
Also, personally I would rather want the tool to use the top-left corner pixel as transparent color, because all of my images I ever used did that.
Trust me, it's much easier to use proper transparency and not worry about it. PNG FTW!

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] n2DLib
« Reply #58 on: July 11, 2014, 02:38:45 pm »
I used the little image I did in 3.14 seconds to demonstrate n2DLib's drawSpriteRotated function. Attached ; it gave me this :
Code: [Select]
//Generated from example.bmp (output format: n2dlib)
static uint16_t example[] = {16,
16,
0x0,
0xf81f, 0x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d5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0x0,
0x0, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0x0,
0xf81f, 0x0, 0xd5d5, 0x0, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0x0, 0xd5d5, 0xd5d5, 0xd5d5, 0x0, 0xf81f,
0xf81f, 0x0, 0xd5d5, 0xd5d5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0x0, 0xf81f,
0xf81f, 0xf81f, 0x0, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0x0, 0xf81f, 0xf81f,
0xf81f, 0xf81f, 0xf81f, 0x0, 0x0, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0xd5d5, 0x0, 0x0, 0xf81f, 0xf81f, 0xf81f,
0xf81f, 0xf81f, 0xf81f, 0xf81f, 0xf81f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf81f, 0xf81f, 0xf81f, 0xf81f, 0xf81f,
};
As you can see, I usually use 0xf81f as transparent color.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] n2DLib
« Reply #59 on: July 11, 2014, 02:39:28 pm »
Well yes, but no PNG in n2dlib.