Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,171
  • Replies Replies 6,048
  • Likes Likes 54
Um, so is anyone doing drawing (not 3d modelled stuff, just lines & circles etc) in 3d? Do we have good stereoscopic functions for that? I found nop's repository but the readme says the stereoscopic stuff is broken.

When I screwed around with arm9 code a while back I manually drew two rectangles at different x coordinates for an okish looking 3d rectangle. You could probably make a function that takes an x value and draws the rectanges at an offset if you need something quickly
 
In fact there is no "correct" bin file, everything depends on how you interpret the data in your homebrew.
For example, my img-to-bin converter isn't exactly compatible with smea's hbmenu's gfxDrawSprite().
(see discussion here: https://twitter.com/MasterofJP/status/537293707725537280)
If you have an idea on how i could fix that, though, it'd be great.
Same thing for the strange darkness of your bmp.
 
In fact there is no "correct" bin file, everything depends on how you interpret the data in your homebrew.
For example, my img-to-bin converter isn't exactly compatible with smea's hbmenu's gfxDrawSprite().
(see discussion here: https://twitter.com/MasterofJP/status/537293707725537280)
If you have an idea on how i could fix that, though, it'd be great.
Same thing for the strange darkness of your bmp.
No gfxDraw support? That's not good. Thanks anyway!

Ah another thing, do you know how to draw a bigger text?
 
what do you mean by bigger text? Afaik there is no native text display. You have to embed your alphabet into an image and use it letter by letter
I'm planning to do a tool / lib to help things like that though
 
In fact there is no "correct" bin file, everything depends on how you interpret the data in your homebrew.
For example, my img-to-bin converter isn't exactly compatible with smea's hbmenu's gfxDrawSprite().
(see discussion here: https://twitter.com/MasterofJP/status/537293707725537280)
If you have an idea on how i could fix that, though, it'd be great.
Same thing for the strange darkness of your bmp.

From what I can tell, smea's method copies the image data directly into the chosen framebuffer, problem is the framebuffer goes (B,G,R) and the image data goes (R,G,B) so you get the Red and Blue channels swapped.
I wrote myself a crappy python script to swap the R and B in each triplet of bytes around in the bin file first, and that fixed things for me.
 
Um, so is anyone doing drawing (not 3d modelled stuff, just lines & circles etc) in 3d? Do we have good stereoscopic functions for that? I found nop's repository but the readme says the stereoscopic stuff is broken.

I'd written a little drawing "library" for drawling lines, rects and circles, not very fast but with full ARGB-Support; I'll provide it when I'm home (around 8pm CET).
Maybe it may help you. It should be easy to adapt it for other uses, but do not expect to create a new 60fps Sonic the Hedgehog - blast processing was sold out, as it was just an experiment :)
 
  • Like
Reactions: hippy dave
3dsxtool gives me 'unaligned relocation!' when compiling... but no more info. What does this means? anyone know? Thanks! :hateit:
 
anjpgCy.png
 
Sounds perfect, thanks!


https://github.com/pmedia/3ds-tool - here you are.

I'd planned to provide an rapid prototyping C++-Based OOP-Wrapper oriented on stable code with many features which are replaceable but then noticed how pointless it is or may be. At least I didn't noticed much sense, as it may be better to include such framework into ctrulib.

Anyway, as promised, it contains the rendercode for drawing lines, circles and rectangles.

Have a look: Code Header

Code should be easily transformed to ordinary C, as it didn't make much use of additional c++ features. Notice how my setpixel()-Routine even wraps the pixel order, as it reverse the vertical axis.

Video::drawCircle(Display dp, u16 tx, u16 ty, u16 r, u32 c)
dp is the constant value detemining which display shall be used (enum Display: DISPLAY_TOP, DISPLAY_TOP_LEFT, DISPLAY_TOP_RIGHT, DISPLAY_BOTTOM)
tx,ty is the center of the circle to be drawn
r is the radius of the circle, c the ARGB-Color (Means: White is 0xFFFFFFFF, Black is 0xFF000000, Red is 0xFFFF0000, Blue is 0xFF0000FF, Half Transparent Green would be 0x8000FF00)
drawCircleFilled and drawCircleBordered have the very much same parameters; ci is inner color, co outer color. Outline of the circle is always 1px, there is no anti aliasing.

drawLine(Display dp, u16 x1, u16 y1, u16 x2, u16 y2, u32 c)
draws a line on display dp from x1,y1 to x2,y2 in the ARGB-Color c

drawRect(Display dp, u16 x1, u16 y1, u16 x2, u16 y2, u32 c)
draws an (not filled) rectangle on display dp from x1,y1 to x2,y2 with border argb color c

drawRectFilled(Display dp, u16 x1, u16 y1, u16 x2, u16 y2, u32 c)
draws an (filled) rectangle on display dp from x1,y1 to x2,y2 with border argb color c

drawRectBordered(Display dp, u16 x1, u16 y1, u16 x2, u16 y2, u32 ci, u32 co)
draws an filled rectangle (color ci) with a 1px border in color co.

Any other methods of the class should be self-explaining like that, too. blendpixel can be used to draw gradientbased primitives as it calculates the blending between two colors.
Feel free to take the code out of there as it gives you the ability to draw basic primitives.

Code is based on algorithms described in wikipedia as documented in the code.


For the future, it may be better to have ports of libraries like Cairo as they are usually highly optimized. Have fun!
 

Site & Scene News

Popular threads in this forum