-
Notifications
You must be signed in to change notification settings - Fork 1
/
Fuel.cpp
53 lines (34 loc) · 1004 Bytes
/
Fuel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Fuel.cpp
// RiverRaid
//
// Created by Noor Bafageeh on 11/21/16.
// Copyright © 2016 Noor Bafageeh. All rights reserved.
//
#include "Fuel.h"
#include "string"
#include "RRApp.h"
#include "RRMap.h"
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std ;
Fuel::Fuel(RRApp * app, SDL_Window *window, SDL_Renderer *renderer): app(app), window(window), renderer(renderer){
SDL_GetWindowSize(window, &width, &height);
SDL_Surface *loadedImage = IMG_Load("img/oil3.bmp");
if(loadedImage==NULL ){
cout<<"Error loading enemy img "<< IMG_GetError();
}else{
fuel = SDL_CreateTextureFromSurface(renderer, loadedImage);
rect1.w = 65;
rect1.h = 65;
int randx = rand() % (width/2) + 200 ;
rect1.x = randx;
rect1.y = 0;
fuelEmpty = false;
isVisible =0;
}
}