Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • aa2-olow/assignment_2020
  • n2-alanzi/assignment_2020
  • w3-everett/assignment_2020
  • m36-king/miles-k-ing-programming-assignment
  • l2-mendygral/assignment_2020
  • g2-locke/assignment_2020
  • m2-byers/assignment_2020
  • k29-ali/assignment_2020
  • j2-bartrop/assignment_2020
  • s2-maimascu/assignment_2020
  • o3-griffiths/assignment_2020
  • m3-albaker/assignment_2020
  • d2-ptak/assignment_2020
  • j4-cottle/assignment_2020
  • a2-almoftah/assignment_2020
  • br-gaster/assignment_2020
  • c2-riordan/assignment_2020
  • r2-meguetif/assignment_2020
  • m2-szlafke/assignment_2020
  • d22-holmes/assignment_2020
  • d84-smith/assignment_2020
  • hg2-alahmadi/assignment_2020
  • t2-hayat/assignment_2020
  • r2-alqadhi/assignment_2020
  • d2-rutkis/assignment_2020
  • t2-collyer/assignment_2020
  • y2-binyahya/assignment_2020
  • h2-ale/assignment_2020
  • h8-cox/assignment_2020
  • j3-caisey/assignment_2020
  • mct2-hodgson/assignment_2020
  • j3-clarkeprice/assignment_2020
  • aeh2-park/assignment_2020
  • c29-chapman/assignment_2020
  • j2-fawcett/assignment_2020
  • et2-stoker/assignment_2020
  • s46-james/assignment_2020
  • h2-alsaloumi/assignment_2020
  • a2-almarri/assignment_2020
  • mym2-bukshaish/assignment_2020
  • i2-papageorgio/assignment_2020
  • pg2-jacksonsan/assignment_2020
  • s2-lacatusu/assignment_2022
  • j38-chan/assignment-2023
  • a33-kumar/assignment_2020
  • nj2-thapa/assignment_2020
  • k4-karki/assignment-2024
47 results
Select Git revision
Show changes
Commits on Source (6)
CC = clang++
LD = clang++
CPPFLAGS = -std=c++17 -I./include -I/opt/homebrew/include/ -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE
CFLAGS = -I./include -I/opt/homebrew/include/ -D_THREAD_SAFE -I/opt/homebrew/include/SDL2
LDFLAGS = -L/opt/homebrew/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -lwebp -ltiff -ljpeg -lbz2 -lz -framework OpenGL
ROOTDIR = ./
CP = cp
ECHO = echo
BUILD_DIR = build
C_SOURCES = src/SDL_FontCache.c
CPP_SOURCES = src/app.cpp src/context.cpp
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
vpath %.cpp examples
vpath %.cpp assignment
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
$(ECHO) compiling $<
$(CC) -c $(CPPFLAGS) $< -o $@
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(ECHO) compiling $<
clang -c $(CFLAGS) $< -o $@
all: $(BUILD_DIR)/splat $(BUILD_DIR)/shapes $(BUILD_DIR)/sprite $(BUILD_DIR)/assignment
$(BUILD_DIR)/splat: $(OBJECTS) $(BUILD_DIR)/splat.o Makefile
$(ECHO) linking $<
$(CC) -L/opt/homebrew/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -lwebp -ltiff -ljpeg -lbz2 -lz -framework OpenGL -o $@ $(OBJECTS) build/splat.o
install_name_tool -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib ./osx/runtime/libSDL2-2.0.0.dylib $(BUILD_DIR)/splat
$(ECHO) success
$(BUILD_DIR)/shapes: $(OBJECTS) $(BUILD_DIR)/shapes.o Makefile
$(ECHO) linking $<
$(CC) -L/opt/homebrew/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -lwebp -ltiff -ljpeg -lbz2 -lz -framework OpenGL -o $@ $(OBJECTS) build/shapes.o
install_name_tool -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib ./osx/runtime/libSDL2-2.0.0.dylib $(BUILD_DIR)/shapes
$(ECHO) success
$(BUILD_DIR)/sprite: $(OBJECTS) $(BUILD_DIR)/sprite.o Makefile
$(ECHO) linking $<
$(CC) -L/opt/homebrew/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -lwebp -ltiff -ljpeg -lbz2 -lz -framework OpenGL -o $@ $(OBJECTS) build/sprite.o
install_name_tool -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib ./osx/runtime/libSDL2-2.0.0.dylib $(BUILD_DIR)/sprite
$(ECHO) success
$(BUILD_DIR)/assignment: $(OBJECTS) $(BUILD_DIR)/assignment.o Makefile
$(ECHO) linking $<
$(CC) -L/opt/homebrew/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -lwebp -ltiff -ljpeg -lbz2 -lz -framework OpenGL -o $@ $(OBJECTS) build/assignment.o
install_name_tool -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib ./osx/runtime/libSDL2-2.0.0.dylib $(BUILD_DIR)/assignment
$(ECHO) success
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)/assignment $(BUILD_DIR)/sprite $(BUILD_DIR)/shapes $(BUILD_DIR)/splat $(BUILD_DIR)/*.o
#######################################
# dependencies
#######################################
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
.PHONY: clean all
\ No newline at end of file
CC = clang++
LD = clang++
CPPFLAGS = -std=c++17 -I./include -I/usr/include/ -I/usr/include/SDL2 -D_THREAD_SAFE
CFLAGS = -I./include -I/usr/include/ -D_THREAD_SAFE -I/usr/include/SDL2
LDFLAGS = -L/usr/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -lwebp -ltiff -ljpeg -lbz2 -lz -framework OpenGL
ROOTDIR = ./
CP = cp
ECHO = echo
BUILD_DIR = build
C_SOURCES = src/SDL_FontCache.c
CPP_SOURCES = src/app.cpp src/context.cpp
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
vpath %.cpp examples
vpath %.cpp assignment
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
$(ECHO) compiling $<
$(CC) -c $(CPPFLAGS) $< -o $@
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(ECHO) compiling $<
clang -c $(CFLAGS) $< -o $@
all: $(BUILD_DIR)/splat $(BUILD_DIR)/shapes $(BUILD_DIR)/sprite $(BUILD_DIR)/assignment
$(BUILD_DIR)/splat: $(OBJECTS) $(BUILD_DIR)/splat.o Makefile
$(ECHO) linking $<
$(CC) -L/usr/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -ltiff -ljpeg -lbz2 -lz -o $@ $(OBJECTS) build/splat.o
$(ECHO) success
$(BUILD_DIR)/shapes: $(OBJECTS) $(BUILD_DIR)/shapes.o Makefile
$(ECHO) linking $<
$(CC) -L/usr/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -ltiff -ljpeg -lbz2 -lz -o $@ $(OBJECTS) build/shapes.o
$(ECHO) success
$(BUILD_DIR)/sprite: $(OBJECTS) $(BUILD_DIR)/sprite.o Makefile
$(ECHO) linking $<
$(CC) -L/usr/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -ltiff -ljpeg -lbz2 -lz -o $@ $(OBJECTS) build/sprite.o
$(ECHO) success
$(BUILD_DIR)/assignment: $(OBJECTS) $(BUILD_DIR)/assignment.o Makefile
$(ECHO) linking $<
$(CC) -L/usr/lib -lSDL2 -lSDL2_ttf -lSDL2_image -lfreetype -lpng -ltiff -ljpeg -lbz2 -lz -o $@ $(OBJECTS) build/assignment.o
$(ECHO) success
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)/assignment $(BUILD_DIR)/sprite $(BUILD_DIR)/shapes $(BUILD_DIR)/splat $(BUILD_DIR)/*.o
#######################################
# dependencies
#######################################
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
.PHONY: clean all
......@@ -127,18 +127,82 @@ To run an example or the assigment, simply run the command, e.g. **./shapes.exe*
in the same directory. (Note: it is important that you run the executables in the
**window_build** directory.)
## Linux
For Linux you need to first install the packages
```bash
sudo apt install libsdl2-dev
sudo apt install libsdl2-image-dev
sudo apt install libsdl2-ttf-dev
sudo apt install libfreetype6-dev
sudo apt install libtiff-dev
sudo apt install libbz2-dev
```
To make it slightly easier to build both the examples and the assigment itself a Makefile is provided:
- **Makefile_linux**
To build run the command:
```bash
make -f Makefile_linux
```
in the root directory. This will build the resulting
executables in the directory **build**. **build** will
contain the example executables:
```bash
./build/shapes
./build/splat
./build/sprite
```
and for the assigment:
```bash
./build/assignment
```
To run an example or the assigment, simply run the executable from the root directory, e.g. **./build/shapes**.
## OS X
> Note: ARM based Macs (M1 or M2)
>
> You will need to install a small amount of software. First install ```brew`` from:
>
> - [https://brew.sh/](https://brew.sh/)
>
> The you can use ```brew``` to install the missing packages:
>
> ```bash
> brew install sdl2
> brew install sdl2_image
> brew install sdl2_ttf
> brew install freetype
> ```
To make it slightly easier to build both the examples and the assigment itself a Makefile is provided:
- **Makefile**
> For ARM macs it will be Makefile_brew
To build and examples and assignment simple type
```bash
make
```
> For ARM macs it is:
>
> ```bash
> make -f Makefile_brew
> ```
in the root directory. This will build the resulting
executables in the directory **build**. **build** will
contain the example executables:
......
......@@ -124,6 +124,10 @@ namespace uwe {
context_.draw_image(image, src, dest);
}
void draw_image_with_rot(Image image, Rect src, Rect dest, double angle) {
context_.draw_image_with_rot(image, src, dest, angle);
}
void set_renderer_taret(Image image, bool clear) {
SDL_SetRenderTarget(context_.get_renderer(), image);
if (clear) {
......
......@@ -165,6 +165,12 @@ namespace uwe {
SDL_RenderCopy(renderer_, image, &src, &dest);
}
void draw_image_with_rot(Image image, Rect src, Rect dest, double angle) {
SDL_RenderCopyEx(renderer_, image, &src, &dest, angle,
NULL,
SDL_FLIP_NONE);
}
Font create_font(std::string path, int point_size, Colour colour) {
auto font = FC_CreateFont();
FC_LoadFont(
......