Homebrew Development

Discussion in '3DS - Homebrew Development and Emulators' started by aliak11, Jan 16, 2014.

  1. Manurocker95

    Manurocker95 Game Developer & Pokémon Master

    Member
    8
    May 29, 2016
    Spain
    Madrid
    I recommend you to use PP2D. It is a modification of Citro2D so noob friendly. You can see my template here . You just need to create the texture with
    Code:
    pp2d_load_texture_png(TEXTURE_SPRITESHEET_ID,spritesheet);
    
    and draw it with something like:

    Code:
    //Top screen
    pp2d_begin_draw(GFX_TOP, GFX_LEFT);
    pp2d_draw_texture_part(TEXTURE_SPRITESHEET_ID, xPosition, yPosition, xOffset, yOffset, SpriteWidth, SpriteHeight);
    // Bottom screen
    pp2d_draw_on(GFX_BOTTOM, GFX_LEFT);
    pp2d_draw_texture_part(TEXTURE_SPRITESHEET_ID, xPosition, yPosition, xOffset, yOffset, SpriteWidth, SpriteHeight);
    pp2d_end_draw();
    

    For text:

    Code:
    pp2d_draw_text(xPosition, yPosition, sizeX, sizeY, rgbColor, "HELLO WORLD!!");
    
     
    cynosura likes this.
  2. cynosura

    cynosura GBAtemp Regular

    Member
    2
    Jun 7, 2015
    France
    Bed
    Thank you! I'll give a try this afternoon.
     
  3. Magicrafter13

    Magicrafter13 GBAtemp Regular

    Member
    2
    Feb 19, 2017
    United States
    I don't know if I quite understand your question, but I remember having problems understanding Citro2D at first as well. Maybe some of my projects could help? The 2 projects of mine that use Citro2D, are: BreakoutRedux, and Dungeon-Escape (on my GitHub).

    — Posts automatically merged - Please don't double post! —

    A year ago I would have agreed with this, but once you figure out what to do, Citro2D is incredibly easy. And PP2D is not kept up to date I definitely would not recommend it. I don't even think the creator has the repo up anymore...
     
    cynosura likes this.
  4. cynosura

    cynosura GBAtemp Regular

    Member
    2
    Jun 7, 2015
    France
    Bed
    Thank you, yeah I think pp2d is too old and from what i saw in your homebrews, using Citro2d directly seems easy.
     
    Magicrafter13 and Joel16 like this.
  5. Manurocker95

    Manurocker95 Game Developer & Pokémon Master

    Member
    8
    May 29, 2016
    Spain
    Madrid
    It worked flawlessly for me and there are a lot of mirrors of PP2D. I just recommended what I used some time ago
     
    Magicrafter13 and cynosura like this.
  6. gadzooks2

    gadzooks2 Member

    Newcomer
    1
    Apr 15, 2019
    United Kingdom
    Does anyone have a 'cheat sheet' of 3ds-specific c++ commands?
    And a c++ tutorial welp.
     
  7. Vovonator

    Vovonator Member

    Newcomer
    1
    Dec 5, 2018
    Brazil
    Not sure of what you mean by 'cheat sheet' of 3ds specific C++ commands, but I guess you want the documentation?
    Here: https://smealum.github.io/ctrulib/index.html

    About that C++ tutorial, there are a bunch of them online, it's a question of personal preference, but here is one: http://www.cplusplus.com/doc/tutorial/
     
  8. gadzooks2

    gadzooks2 Member

    Newcomer
    1
    Apr 15, 2019
    United Kingdom
  9. gadzooks2

    gadzooks2 Member

    Newcomer
    1
    Apr 15, 2019
    United Kingdom
    If I'm trying to add, say, fstream, to my c++ project, how would I do it?
     
  10. GalladeGuy

    GalladeGuy Cool and Epic

    Member
    11
    Oct 28, 2015
    United States
    The same way you would add it to a normal C++ project.
     
  11. gadzooks2

    gadzooks2 Member

    Newcomer
    1
    Apr 15, 2019
    United Kingdom
    Oh, ok. I thought I might have to move it somewhere for the compiler.
     
  12. RyuShinobi500

    RyuShinobi500 Coder

    Member
    2
    Oct 25, 2019
    United States
    I was wondering if there was a doc of citro2d/3d i am a absolute beginner at 3ds homebrew and any help would be much appreciated thankyou
     
  13. Turumarth

    Turumarth Newbie

    Newcomer
    1
    Nov 14, 2019
    Canada
    Hey I am an absolute beginner too; I made my first hello world on 3ds yesterday :D

    I found this for citro2d citro2d devkitpro org / index html

    Sorry I just joined the site so I can't post links yet!
    Let me know if you have any luck finding one for citro3d!
     
    RyuShinobi500 likes this.
  14. RyuShinobi500

    RyuShinobi500 Coder

    Member
    2
    Oct 25, 2019
    United States
    Okay great It is nice to know that I am not the only one who is a beginner :yay:
     
  15. RyuShinobi500

    RyuShinobi500 Coder

    Member
    2
    Oct 25, 2019
    United States
    I was wondering if anybody could give me some pointers on making a simple 2d game for 3ds homebrew all I need is the basic way you would make a sprite move with a button press I am trying to alter the devkitPro sample gpusprites and I understand it would be something like this

    if (kDown & KEY_LEFT)
    {
    set sprite position to 5 5
    }

    but it does not work any help would be so appriciated thanks
     
  16. catlover007

    catlover007 Developer

    pip Developer
    8
    Oct 23, 2015
    Germany
    sorry, but it seems to me, that you don't understand the code of the example. Maybe you should start by disecting it and try to understand the meaning of the individual code pieces. Then show me where in the code the position of the sprites is set and based upon what value?
     
  17. RyuShinobi500

    RyuShinobi500 Coder

    Member
    2
    Oct 25, 2019
    United States
    ...
     
    Last edited by RyuShinobi500, Nov 28, 2019 - Reason: To long
  18. RyuShinobi500

    RyuShinobi500 Coder

    Member
    2
    Oct 25, 2019
    United States
    ...
     
    Last edited by RyuShinobi500, Nov 28, 2019 - Reason: To Long
  19. ShroomKing

    ShroomKing Mr. Nice ( ͡° ͜ʖ ͡°)

    Member
    6
    Mar 3, 2017
    United States
    in bed
    You seem lost...
    It would be easier if you get comfortable with the language first, then play around with openGL or another graphics api. (On the PC, with proper documentation and a debugger)

    Anyway, i threw together a simple example for moving a sprite:

    Code:
    #include <citro2d.h>
    #include <3ds.h>
    
    #define SCREEN_WIDTH  400
    #define SCREEN_HEIGHT 240
    
    int main() {
        romfsInit();
        gfxInitDefault();
        C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
        C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
        C2D_Prepare();
        consoleInit(GFX_BOTTOM, NULL);
    
        C3D_RenderTarget* top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
        C2D_SpriteSheet spriteSheet = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
        C2D_Sprite sprites;
    
        C2D_SpriteFromSheet(&sprites, spriteSheet, 0);
        C2D_SpriteSetCenter(&sprites, 0.5, 0.5);
        C2D_SpriteSetPos(&sprites, SCREEN_WIDTH/2, SCREEN_HEIGHT/2);
    
        while (aptMainLoop()) {
            hidScanInput();
            u32 kDown = hidKeysDown();
            u32 kHeld = hidKeysHeld();
    
            if (kDown & KEY_START)
                break;
           
            if (kHeld & KEY_UP)
                C2D_SpriteMove(&sprites, 0, -1.75);
            if (kHeld & KEY_DOWN)
                C2D_SpriteMove(&sprites, 0, 1.75);
            if (kHeld & KEY_LEFT)
                C2D_SpriteMove(&sprites, -1.75, 0);
            if (kHeld & KEY_RIGHT)
                C2D_SpriteMove(&sprites, 1.75, 0);
    
            C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
            C2D_TargetClear(top, C2D_Color32f(0.0, 0.0, 0.0, 1.0));
            C2D_SceneBegin(top);
            C2D_DrawSprite(&sprites);
            C3D_FrameEnd(0);
        }
        C2D_SpriteSheetFree(spriteSheet);
        C2D_Fini();
        C3D_Fini();
        gfxExit();
        romfsExit();
        return 0;
    }
    
    Also, please use code blocks.
     
    RyuShinobi500 likes this.
  20. RyuShinobi500

    RyuShinobi500 Coder

    Member
    2
    Oct 25, 2019
    United States
    WOW THANK YOU SO MUCH!!!:yay: this is great I was going to get into opengl but the installation was vague and the guide I followed had me download about five different programs THANKS AGAIN THIS IS GREAT!!!:yay: I also have code blocks it is a great IDE
     
    ShroomKing likes this.
Quick Reply
Draft saved Draft deleted
Loading...