if (ButtonUp.fallingEdge()){
///// display character from rear
tft.drawBitmap1(player_x, player_y,paul_rearblack,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_rearblue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_rearbrown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_reargrey,16,16,GREY);
tft.drawBitmap1(player_x, player_y,paul_rearpink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_rearred,16,16,RED);
////// extra set to animate the players walk
tft.drawBitmap1(player_x, player_y,paul_rearw1black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_rearw1blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_rearw1brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_rearw1grey,16,16,GREY);
tft.drawBitmap1(player_x, player_y,paul_rearw1pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_rearw1red,16,16,RED);
player_direction = 1; /////stops and displays current player direction
player_y = player_y - 5;} /////moves player
// if(checkcolision())player_y--;} /////// checks collision with bitmap images in tilemap
// if(player_y <= 0){ /////stops player from going off screen
// player_y = 0;} stops player from going off screen
#define GrafxT3_TFTWIDTH 240
#define GrafxT3_TFTHEIGHT 320
int16_t width(void) { return _width; }
int16_t height(void) { return _height; }
int16_t _width, _height; // Display w/h as modified by current rotation
////from cpp
#define WIDTH GrafxT3_TFTWIDTH
#define HEIGHT GrafxT3_TFTHEIGHT
In post #21, at the top, kurt asked about the internal settings were to height(); and width() since I as changing everything that read ili9341_tftwidth or height in the code to height() and width(). Honestly I don't know. in the t3n library I have all these
Is all that correct?
void ILI9341_t3n::setRotation(uint8_t m)
{
rotation = m % 4; // can't be higher than 3
beginSPITransaction();
writecommand_cont(ILI9341_MADCTL);
switch (rotation) {
case 0:
writedata8_last(MADCTL_MX | MADCTL_BGR);
_width = ILI9341_TFTWIDTH;
_height = ILI9341_TFTHEIGHT;
break;
case 1:
writedata8_last(MADCTL_MV | MADCTL_BGR);
_width = ILI9341_TFTHEIGHT;
_height = ILI9341_TFTWIDTH;
break;
case 2:
writedata8_last(MADCTL_MY | MADCTL_BGR);
_width = ILI9341_TFTWIDTH;
_height = ILI9341_TFTHEIGHT;
break;
case 3:
writedata8_last(MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
_width = ILI9341_TFTHEIGHT;
_height = ILI9341_TFTWIDTH;
break;
}
endSPITransaction();
setClipRect();
setOrigin();
cursor_x = 0;
cursor_y = 0;
}
typedef struct
{
byte x;
byte y;
byte w;
byte h;
boolean exist;
} BrickStruct;
int camerax = 160 ;
int cameray = 120 ;
int xmax = 160;
////////////////////////////////////////////////
/////////////////camera controls////////////////
////////////////////////////////////////////////
if(player_x > 160 && camerax < 0 && camerax > -160) {player_x = 160;camerax--;}
//value 59 equals player position on right when camera will start to follow
//value 0 and -52 equals camers boundary positions
else if(player_x < 160 && camerax < 0 && camerax > -160){player_x = 160;camerax++;}
//value 15 equals player position on left when camera will start to follow
//value 0 and -52 equals camera boundary positions
else if(player_x > 160 && camerax <= 0 && camerax >= -160)camerax--;
else if(player_x < 160 && camerax <= 0 && camerax >= -160)camerax++;
if(player_y > 160 && cameray < 0 && cameray > -160){player_y = 160;cameray--;}
//value 28 equals player position on right when camera will start to folow
//value 0 and -40 equals camera boundary positions
else if(player_y < 120 && cameray < 0 && cameray > -120){player_y = 120;cameray++;}
//value 15 equals player position on left when camera will start to follow
//value 0 and -40 equals camera boundary positions
else if(player_y > 120 && cameray <= 0 && cameray >= -120)cameray--;
else if(player_y < 120 && cameray <= 0 && cameray >= -120)cameray++;
if(camerax > 0)camerax= 0;
else if(camerax < -160) camerax = -160;
//value 0 and -52 equals camera boundary positions
if(cameray > 0)cameray= 0;
else if(cameray < -120) cameray = -120;
//value 0 and -40 equals camera boundary positions
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
tft.drawTilemap(camerax, cameray, tilemap1, spritesheet1, BLACK);
tft.drawTilemap(camerax, cameray, tilemap2, spritesheet2, BROWN);
tft.drawTilemap(camerax, cameray, tilemap3, spritesheet3, LIGHTBROWN);