-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtowerField.c
More file actions
27 lines (25 loc) · 769 Bytes
/
towerField.c
File metadata and controls
27 lines (25 loc) · 769 Bytes
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
#include "towerField.h"
#include "menu.h"
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <stdio.h>
#include <stdlib.h>
FieldInterface* createFieldInterface(char* mapName){
FieldInterface *field = malloc(sizeof (FieldInterface));
field->background = IMG_Load(mapName);
field->originalBackground = IMG_Load(mapName);
if(field->background == NULL || field->originalBackground == NULL){
printf("failed to load the background map\n");
printf("IMG_Load: %s\n", IMG_GetError());
exit(-1);
}
field->hasChanged = 0;
return field;
}
void clickOnScreen(Interface *interfaces, int x,int y){
FieldInterface *field = interfaces->field;
Menu *menu = interfaces->menu;
if(menu->currentItem != NULL){
field->hasChanged = placeTower(interfaces, x, y);
}
}