Homebrew Homebrew Development

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,869
Trophies
2
XP
29,052
Country
United Kingdom
Hey guys, looking for the latest version of those drawing libs from Relys, I seem to have an old version. Newer link I found in the thread was dead. Any help, cheers!

Edit: nm, yoinked them from the 3DS Binary Converter git.
 

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,869
Trophies
2
XP
29,052
Country
United Kingdom
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.
 

PieFace

Well-Known Member
Newcomer
Joined
Aug 4, 2014
Messages
59
Trophies
0
XP
157
Country
United States
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
 

xem

Well-Known Member
Member
Joined
Nov 22, 2014
Messages
142
Trophies
0
Age
36
Location
Valbonne
XP
333
Country
France
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.
 

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
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?
 

xem

Well-Known Member
Member
Joined
Nov 22, 2014
Messages
142
Trophies
0
Age
36
Location
Valbonne
XP
333
Country
France
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
 

Frozen_Fish

Well-Known Member
Member
Joined
May 31, 2007
Messages
156
Trophies
0
XP
273
Country
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.
 

-pm-

Active Member
Newcomer
Joined
Feb 19, 2014
Messages
30
Trophies
0
XP
1,136
Country
Germany
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

seagal112

Well-Known Member
Newcomer
Joined
Apr 22, 2014
Messages
63
Trophies
0
Age
43
XP
418
Country
3dsxtool gives me 'unaligned relocation!' when compiling... but no more info. What does this means? anyone know? Thanks! :hateit:
 

minexew

ayy lmao
Member
Joined
Mar 16, 2013
Messages
228
Trophies
0
XP
284
Country
anjpgCy.png
 

-pm-

Active Member
Newcomer
Joined
Feb 19, 2014
Messages
30
Trophies
0
XP
1,136
Country
Germany
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

General chit-chat
Help Users
    SylverReZ @ SylverReZ: @Psionic Roshambo, Thats pretty cool.