1: /*
     2:  *  Guitar-ZyX(tm)::MasterControlProgram - portable guitar F/X controller
     3:  *  Copyright (C) 2009  Douglas McClendon
     4:  *
     5:  *  This program is free software: you can redistribute it and/or modify
     6:  *  it under the terms of the GNU General Public License as published by
     7:  *  the Free Software Foundation, version 3 of the License.
     8:  *
     9:  *  This program is distributed in the hope that it will be useful,
    10:  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    11:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12:  *  GNU General Public License for more details.
    13:  *
    14:  *  You should have received a copy of the GNU General Public License
    15:  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    16: */
    17: /*
    18: #############################################################################
    19: #############################################################################
    20: # 
    21: # gzmcpc::graphics: visual output rendering
    22: #
    23: #############################################################################
    24: ##
    25: ## Copyright 2008-2009 Douglas McClendon <dmc AT filteredperception DOT org>
    26: ##
    27: #############################################################################
    28: #############################################################################
    29: #
    30: */
    31: 
    32: #ifndef _NDS_CLIENT_GRAPHICS_H 
    33: #define _NDS_CLIENT_GRAPHICS_H 
    34: 
    35: 
    36: 
    37: 
    38: #define MODEL_XMIN 0 
    39: #define MODEL_XMAX (v16)(4 << 8) 
    40: #define MODEL_YMIN 0 
    41: #define MODEL_YMAX (v16)(3 << 8) 
    42: #define MODEL_ZMIN floattov16(-1.0f) 
    43: #define MODEL_ZMAX floattov16(1.0f) 
    44: 
    45: 
    46: #define COMB_WIDTH 17 
    47: #define COMB_HEIGHT 15 
    48: #define COMB_XBORDER 0 
    49: #define COMB_YBORDER 0 
    50: 
    51: 
    52: 
    53: 
    54: #define DEFAULT_TOP_RENDER_RATE 24 
    55: 
    56: #define DEFAULT_BOTTOM_RENDER_RATE 30 
    57: 
    58: #define MAX_TEXT_OUTPUT_LINE_SIZE 33 
    59: 
    60: 
    61: #define TS_MODE_ROW 7 
    62: #define TS_STATUS_ROW 9 
    63: #define TS_NETWORK_STATUS_ROW 11 
    64: #define TS_AESTHETIC_ROW 13 
    65: #define TS_DEBUG_ROW 14 
    66: #define TS_FX_MODE_ROW 15 
    67: #define TS_TOUCH_VAL_ROW 17 
    68: #define TS_ERROR_ROW 18 
    69: #define TS_TOUCH_VALXP_ROW 19 
    70: #define TS_TOUCH_VALYP_ROW 21 
    71: 
    72: 
    73: #define DEFAULT_CURSOR_INTESITY 0.5f 
    74: #define DEFAULT_FONT_INTENSITY 27 
    75: 
    76: #define FONT_INTENSITY_MAX 30 
    77: #define FONT_INTENSITY_MIN 7 
    78: 
    79: 
    80: #define CURSOR_RADIUS (v16)((MODEL_XMAX - MODEL_XMIN) / 16) 
    81: 
    82: #define M_PIl 3.1415926535897932384626433832795029L 
    83: 
    84: 
    85: #ifndef REG_BLDCNT 
    86: #define REG_BLDCNT BLEND_CR 
    87: #endif 
    88: 
    89: #ifndef REG_BLDCNT_SUB 
    90: #define REG_BLDCNT_SUB SUB_BLEND_CR 
    91: #endif 
    92: 
    93: #ifndef REG_BLDY 
    94: #define REG_BLDY BLEND_Y 
    95: #endif 
    96: 
    97: #ifndef REG_BLDY_SUB 
    98: #define REG_BLDY_SUB SUB_BLEND_Y 
    99: #endif 
   100: 
   101: 
   102: 
   103: 
   104: 
   105: 
   106: 
   107: 
   108: #include <nds/arm9/videoGL.h> 
   109: 
   110: 
   111: #include "time.h" 
   112: 
   113: 
   114: 
   115: 
   116: 
   117: typedef enum {
   118:   TLT_AESTHETIC,
   119:   TLT_MODE,
   120:   TLT_STATUS,
   121:   TLT_TOUCH_VAL,
   122:   TLT_TOUCH_VALXP,
   123:   TLT_TOUCH_VALYP,
   124:   TLT_FX_MODE,
   125:   TLT_ERROR,
   126:   TLT_NETWORK_STATUS,
   127:   TLT_DEBUG,
   128:   TLT_NODEBUG,
   129:   TLT_NUM_TEXT_OUTPUT_LINE_TYPES,
   130: } text_output_line_type;
   131: 
   132: 
   133: 
   134: 
   135: 
   136: void gzmcpc_init_3d(void);
   137: 
   138: 
   139: void gzmcpc_display_main_splash_text(void);
   140: 
   141: void textout(text_output_line_type linetype, const char *fmt, ...);
   142: 
   143: void render_textout(void);
   144: 
   145: void gzmcpc_render_touchwhammy_vars(void);
   146: 
   147: void gzmcpc_increment_animations(void);
   148: 
   149: 
   150: void init_modelview_matrix(void);
   151: 
   152: void draw_hex(v16 centerx, v16 centery, v16 z, 
   153: 	      v16 radius, float rotation,
   154: 	      uint8 centerr, uint8 centerg, uint8 centerb, uint8 centera,
   155: 	      uint8 outterr, uint8 outterg, uint8 outterb, uint8 outtera,
   156: 	      uint8 rimr, uint8 rimg, uint8 rimb, uint8 rima,
   157: 	      u16 intensity);
   158: 
   159: void draw_simple_hex_grid(int width,
   160: 			  int height,
   161: 			  u16 intensity);
   162: 
   163: 
   164: void gzmcpc_flush_frame(void);
   165: 
   166: 
   167: 
   168: extern char text_output_line[TLT_NUM_TEXT_OUTPUT_LINE_TYPES][MAX_TEXT_OUTPUT_LINE_SIZE];
   169: 
   170: extern float cursor_rotation;
   171: 
   172: extern float cursor_intensity;
   173: 
   174: extern v16 touch_pos_x;
   175: extern v16 touch_pos_y;
   176: 
   177: extern int cursor_rotating;
   178: 
   179: extern unsigned char font_intensity;
   180: 
   181: extern PrintConsole top_screen;
   182: extern PrintConsole bottom_screen;
   183: extern PrintConsole top_screen_x;
   184: extern PrintConsole bottom_screen_x;
   185: 
   186: extern Keyboard keyboard;
   187: 
   188: extern float sqrt_three;
   189: 
   190: extern unsigned char top_render_rate;
   191: extern unsigned char bottom_render_rate;
   192: extern time_val next_top_render;
   193: extern time_val next_bottom_render;
   194: 
   195: extern int bg0, bg1, bg2, bg3;
   196: extern int bgs0, bgs1, bgs2, bgs3;
   197: 
   198: #endif // _NDS_CLIENT_GRAPHICS_H 
   199: