Homebrew 3DS graphical interface development

  • Thread starter Deleted User
  • Start date
  • Views 4,412
  • Replies 22
D

Deleted User

Guest
OP
I am currently working on some basic GUI library development and was wondering where I could see different ways to draw to the screen. Essentially, anything that has a GUI and is hosted publicly would do. Right now I have mostly looked at smealum's code.

Essentially, the theoretical project I want to work on is a library of tools for graphical interface design on the 3DS that is reusable. A lot of homebrew applications run on text output, and having touch-enabled and user-friendly interfaces could make some tools a lot more newbie-friendly.

Any thoughts or help is appreciated. :)
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
D

Deleted User

Guest
OP
You can either write directly to the framebuffer or use the gpu. To use the gpu you can use a library like citro3d, or sf2dlib. Using the GPU is the best method.
For the OSK on EDuke3D and ctrQuake, I wrote directly to the framebuffer which is easier for simple things.
Examples for citro3d: https://github.com/devkitPro/3ds-examples/tree/master/graphics/gpu
Examples for sf2dlib: https://github.com/xerpi/sf2dlib
There are also other libraries out there, check the wiki
Do you know how to rotate the camera in Citro3D? I'm having trouble with it, and can't seem to find a solution since there isn't much documentation/tutorials about it.
 
D

Deleted User

Guest
OP
You need to set the view matrix according to you transformations. Sometimes the model and view matrices are combined.
Hmm.. I tried that, and I can't seen to translate the camera in the right direction when I rotate it, then press up.
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
Hmm.. I tried that, and I can't seen to translate the camera in the right direction when I rotate it, then press up.
I've never used citro3d, but to achive what you are trying to do you have to use a "lookAt" matrix. If you just rotate and then translate, the operations are going to be done relative to the world origin(0,0) and your rotation won't be taken into account.
 

Slashcash

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
338
Trophies
0
XP
611
Country
Italy
In all honesty i wouldn't go through the framebuffer route. It would be time consuming and would require A LOT of boilerplate code. In my opinion writing some gui classes arouns sf2dlib is the route to go.
 
  • Like
Reactions: clank
D

Deleted User

Guest
OP
So many people with helpful info! My phone died earlier so I couldn't respond.

In all honesty i wouldn't go through the framebuffer route. It would be time consuming and would require A LOT of boilerplate code. In my opinion writing some gui classes arouns sf2dlib is the route to go.

From what I am looking at, it seems to me that is likely the case. If I do proceed, I will likely use some combination of tools to add to any missing functionality I may want. The biggest barrier for me, in all honesty, is that I am rusty with my plain C (and C++ to a smaller extent) as opposed to C++ w/ MFC, which I use alongside C# for my job. Once I get to the point I am familiar with my options, I will certainly keep everyone updated as to my progress if I feel it is leading somewhere useful.


This and smealum's 3ds_hb_menu is what I have been looking at so far.

You can either write directly to the framebuffer or use the gpu. To use the gpu you can use a library like citro3d, or sf2dlib. Using the GPU is the best method.
For the OSK on EDuke3D and ctrQuake, I wrote directly to the framebuffer which is easier for simple things.
Examples for citro3d: https://github.com/devkitPro/3ds-examples/tree/master/graphics/gpu
Examples for sf2dlib: https://github.com/xerpi/sf2dlib
There are also other libraries out there, check the wiki

Thanks for the links, I will certainly check out my options! Hopefully I can come up with something sooner rather than later.

(Side note: It drives me crazy that ctrulib has typedef u8 for C's uint8_t (or cstdlib std::uint8_t for C++). I am too stubborn :P)
 
Last edited by ,
  • Like
Reactions: Link_of_Hyrule

Slashcash

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
338
Trophies
0
XP
611
Country
Italy
From what I am looking at, it seems to me that is likely the case. If I do proceed, I will likely use some combination of tools to add to any missing functionality I may want. The biggest barrier for me, in all honesty, is that I am rusty with my plain C (and C++ to a smaller extent) as opposed to C++ w/ MFC, which I use alongside C# for my job. Once I get to the point I am familiar with my options, I will certainly keep everyone updated as to my progress if I feel it is leading somewhere useful.

This and smealum's 3ds_hb_menu is what I have been looking at so far.

Even though pure C seems a standard de facto for this community (and i really can't see why) there is no need to write a totally pure C here. The fact is that oop seems the natural route to follow for a versatile gui library but you would end up with nobody using it. XD
 
D

Deleted User

Guest
OP
Even though pure C seems a standard de facto for this community (and i really can't see why) there is no need to write a totally pure C here. The fact is that oop seems the natural route to follow for a versatile gui library but you would end up with nobody using it. XD

It is my understanding that the following factors are why:
  • Embedded systems development generally uses C over C++ due to C historically having more portable compiler code, leading to smaller applications.
  • C has been a historical favorite for small communities doing the type of development done here, so a lot of it is precedent.
  • C is compatible with C and C++, whereas you have to do more work to write C++ that goes the other way, so some libraries are better off using C.
 

Slashcash

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
338
Trophies
0
XP
611
Country
Italy
It is my understanding that the following factors are why:
  • Embedded systems development generally uses C over C++ due to C historically having more portable compiler code, leading to smaller applications.
  • C has been a historical favorite for small communities doing the type of development done here, so a lot of it is precedent.
  • C is compatible with C and C++, whereas you have to do more work to write C++ that goes the other way, so some libraries are better off using C.

Well i can some valid points here. Even though i wouldn't consider 3ds as an embedded system, it has some good computational power, a fair amount of ram and a full-fledged os. And we're not developing applications where small footprint is a factor considering the average size of our sd cards.

Anyway i don't want to start war. I was just curious about the reasons for certain trends XD
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
It is my understanding that the following factors are why:
  • Embedded systems development generally uses C over C++ due to C historically having more portable compiler code, leading to smaller applications.
  • C has been a historical favorite for small communities doing the type of development done here, so a lot of it is precedent.
  • C is compatible with C and C++, whereas you have to do more work to write C++ that goes the other way, so some libraries are better off using C.
I wouldn't call the 3ds an embedded system. Some developers prefer C over C++ for its simplicity, not only compatibility.
 
D

Deleted User

Guest
OP
I wouldn't call the 3ds an embedded system. Some developers prefer C over C++ for its simplicity, not only compatibility.

I feel that C++ generally has a pension to overcomplicate simple problems compared to C by many developers, so I can agree with that. I personally am more familiar with OOP as a C# developer, so I lean towards C++ for that reason.
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
I feel that C++ generally has a pension to overcomplicate simple problems compared to C by many developers, so I can agree with that. I personally am more familiar with OOP as a C# developer, so I lean towards C++ for that reason.

C++ doesn't over complicate things, I would say it's the other way around. In C++, there is a lot of things happening under the hood, which makes it easier and faster to write code. In C, what you write is what you get.

Here is Linus Torvald's rant on C++: http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918 (Strong Language Warning). I don't agree with all he says, I personally like C++ and am using it in my latest project, but he does make some good points.
 
  • Like
Reactions: Deleted User
D

Deleted User

Guest
OP
C++ doesn't over complicate things, I would say it's the other way around. In C++, there is a lot of things happening under the hood, which makes it easier and faster to write code. In C, what you write is what you get.

Here is Linus Torvald's rant on C++: http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918 (Strong Language Warning). I don't agree with all he says, I personally like C++ and am using it in my latest project, but he does make some good points.

I have seen that rant many times, and I actually feel the "overcomplication" I speak of isn't because the code is more complicated. It's like the famous Bjarne Stroustrup quote: "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."

Essentially, C++ has more safeguards than C, but it allows you to explicitly bypass those safeguards. When it allows you to do so, it provides no safeguards, and when things go wrong they tend to do so in spectacular fashion. This leads to weird bugs that are hard to pinpoint, whereas in C problems can be traced directly to the source more easily - C just does explicitly what you tell it to do. :)

All in all, it's mostly just preference and a matter of how pedantic you want to get about the topic.
 

SLiV3R

3DS Friend Code: 0473-9069-2206
Member
Joined
Jan 9, 2006
Messages
2,319
Trophies
2
Website
soundcloud.com
XP
1,847
Country
C++ doesn't over complicate things, I would say it's the other way around. In C++, there is a lot of things happening under the hood, which makes it easier and faster to write code. In C, what you write is what you get.

Here is Linus Torvald's rant on C++: http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918 (Strong Language Warning). I don't agree with all he says, I personally like C++ and am using it in my latest project, but he does make some good points.

Linus sounds so angry. He was more light in his biography :P
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: I am the cancer!!! lol