Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. #include <nds.h>
  2. #include <stdio.h>
  3. #include <garlic_font.h>
  4.  
  5. typedef struct Teclat {
  6. bool visible; /*!< true if visible*/
  7.  
  8. int background_info; /*!< Background number to use, after init() this contains the background ID */
  9. int background_cursor;
  10. int background_input;
  11.  
  12. u16* mapBase_info; /*!< map base to be used by the keyboard*/
  13. u16* mapBase_cursor; /*!< map base to be used by the keyboard*/
  14. u16* mapBase_input; /*!< map base to be used by the keyboard*/
  15. }Teclat;
  16.  
  17. Teclat keyboard;
  18.  
  19. void _gt_initKB(){
  20. videoSetModeSub(MODE_5_2D);
  21. vramSetBankC(VRAM_C_SUB_BG_0x06200000);
  22.  
  23. keyboard.background_info = bgInitSub(0, BgType_Text8bpp,BgSize_T_256x256, 4, 0);
  24. keyboard.background_cursor = bgInitSub(1, BgType_Text8bpp,BgSize_T_256x256, 5, 0);
  25. keyboard.background_input = bgInitSub(2, BgType_Text8bpp,BgSize_T_256x256, 6, 0);
  26.  
  27. keyboard.mapBase_info = bgGetMapPtr(keyboard.background_info);
  28. keyboard.mapBase_cursor = bgGetMapPtr(keyboard.background_cursor);
  29. keyboard.mapBase_input = bgGetMapPtr(keyboard.background_input);
  30.  
  31. bgSetPriority(keyboard.background_info, 3);
  32. bgSetPriority(keyboard.background_cursor, 1);
  33. bgSetPriority(keyboard.background_input, 2);
  34.  
  35. bgSetScale(keyboard.background_input, 256, 128);
  36.  
  37. decompress(garlic_fontTiles, bgGetGfxPtr(keyboard.background_info), LZ77Vram);
  38. dmaCopy(garlic_fontPal, BG_PALETTE_SUB, garlic_fontPalLen);
  39.  
  40. keyboard.visible = false;
  41.  
  42. bgUpdate();
  43. }
  44.  
  45. void _gt_showKB(){
  46. swiWaitForVBlank();
  47.  
  48. keyboard.visible = true;
  49.  
  50. //keyboard.mapBase_cursor[205]={73, 110, 112, 117, 116, 32, 102, 111, 114, 32, 122, 48, 48, 32, 40, 80, 73, 68, 32, 48, 48, 48, 48, 48, 41, 58};
  51. keyboard.mapBase_cursor[205]=87;
  52. keyboard.mapBase_input[205]=87;
  53.  
  54. bgShow(keyboard.background_input);
  55.  
  56. bgUpdate();
  57. }
  58.  
  59. void _gt_hideKB(){
  60. keyboard.visible = false;
  61.  
  62. //bgHide(keyboard.background);
  63.  
  64. bgUpdate();
  65. }
  66.  
  67. void _gt_rsiKB(){
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement