20 lines
468 B
C++
20 lines
468 B
C++
#include"block.h"
|
|
|
|
Block::Block(int x, int y, int w, int h,SDL_Renderer** render){
|
|
//set the rectangle dimensions
|
|
rect = {x,y,w,h};
|
|
|
|
//Set the renderer pointer
|
|
renderer = render;
|
|
}
|
|
|
|
void Block::print(int cameraX){
|
|
//New SDL_Rect to make the objects follow the camera
|
|
SDL_Rect cameraFix = rect;
|
|
cameraFix.x -= cameraX;
|
|
|
|
//Set render color and render the rectangle
|
|
SDL_SetRenderDrawColor(*renderer,0,0xFF,0,0xFF);
|
|
SDL_RenderFillRect(*renderer,&cameraFix);
|
|
};
|