Skip to content

Commit

Permalink
Fixed build by removing IE specific stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jackburton79 committed Jul 10, 2023
1 parent 208db52 commit 3431131
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 108 deletions.
31 changes: 7 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
CC = g++
RM = rm -rf

BGEMU = BGEmu
GAMELIB = libgame.a
GAMELIB = libjgame.a
LIBS = -lz `sdl2-config --libs`
CXXFLAGS = -Wall -Werror -g -O0 `sdl2-config --cflags`
SUBDIR = \
animations \
archives \
game \
audio \
graphics \
gui \
resources \
shell \
streams \
support
support \
timers

OUTDIR = ./bin
DIR_OBJ = ./obj
Expand All @@ -25,14 +21,9 @@ OBJS = $(addprefix $(DIR_OBJ)/, $(SRCS:cpp=o)) # obj/xxx.o obj/folder/xxx .o
INC_DIRS = -I./ $(addprefix -I, $(SUBDIR))

#PHONY := all
all: $(BGEMU)
all: $(GAMELIB)

tests: PathFindTest RandTest

PHONY := $(BGEMU) $(GAMELIB)
$(BGEMU): bgemu.cpp $(GAMELIB)
mkdir -p $(OUTDIR)
$(CC) -o $(OUTDIR)/$@ bgemu.cpp $(DIR_OBJ)/$(GAMELIB) $(LIBS) $(INC_DIRS) $(CXXFLAGS) $(LDFLAGS)
PHONY := $(GAMELIB)

$(GAMELIB): $(OBJS)
ar rcu $(DIR_OBJ)/$(GAMELIB) $(OBJS)
Expand All @@ -42,14 +33,6 @@ $(DIR_OBJ)/%.o: %.cpp $(INCS)
mkdir -p $(@D)
$(CC) -o $@ $(CXXFLAGS) -c $< $(INC_DIRS)

PathFindTest: $(GAMELIB) tests/PathFindTest.cpp
mkdir -p $(OUTDIR)
$(CC) -o $(OUTDIR)/$@ tests/PathFindTest.cpp $(LIBS) $(DIR_OBJ)/$(GAMELIB) $(INC_DIRS) $(CXXFLAGS) $(LDFLAGS)

RandTest: $(GAMELIB) tests/RandTest.cpp
mkdir -p $(OUTDIR)
$(CC) -o $(OUTDIR)/$@ tests/RandTest.cpp $(LIBS) $(DIR_OBJ)/$(GAMELIB) $(INC_DIRS) $(CXXFLAGS) $(LDFLAGS)

PHONY += clean
clean:
rm -rf $(OUTDIR)/* $(DIR_OBJ)/*
Expand All @@ -64,4 +47,4 @@ echoes:
@echo "LIB DIR: $(LIB_DIRS)"
@echo "SUBDIR: $(SUBDIR)"

.PHONY = $(PHONY)
.PHONY = $(PHONY)
4 changes: 3 additions & 1 deletion graphics/Polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include "RectUtils.h"

#include <assert.h>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
#include <stdlib.h>


Polygon::Polygon()
:
Expand Down
78 changes: 0 additions & 78 deletions graphics/RectUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "Bitmap.h"
#include "GraphicsDefs.h"
#include "IETypes.h"


static inline GFX::rect
Expand All @@ -16,18 +15,6 @@ offset_rect(const GFX::rect &rect, sint16 x, sint16 y)
}


static inline IE::rect
offset_rect(const IE::rect &rect, sint16 x, sint16 y)
{
IE::rect newRect = rect;
newRect.x_min += x;
newRect.y_min += y;
newRect.x_max += x;
newRect.y_max += y;
return newRect;
}


static inline GFX::rect
offset_rect_to(const GFX::rect &rect, sint16 x, sint16 y)
{
Expand All @@ -38,16 +25,6 @@ offset_rect_to(const GFX::rect &rect, sint16 x, sint16 y)
}


static inline IE::point
offset_point(const IE::point &point, sint16 x, sint16 y)
{
IE::point newPoint = point;
newPoint.x += x;
newPoint.y += y;
return newPoint;
}


static inline GFX::point
offset_point(const GFX::point &point, sint16 x, sint16 y)
{
Expand All @@ -68,16 +45,6 @@ rects_intersect(const GFX::rect &rectA, const GFX::rect &rectB)
}


static inline bool
rect_contains(const GFX::rect& rect, const IE::point& point)
{
if (point.x >= rect.x && point.x <= rect.x + rect.w
&& point.y >= rect.y && point.y <= rect.y + rect.h)
return true;
return false;
}


static inline bool
rect_contains(const GFX::rect& rect, const int16 x, const int16 y)
{
Expand All @@ -88,26 +55,6 @@ rect_contains(const GFX::rect& rect, const int16 x, const int16 y)
}


static inline bool
rect_contains(const IE::rect& rect, const IE::point& point)
{
if (point.x >= rect.x_min && point.x <= rect.x_max
&& point.y >= rect.y_min && point.y <= rect.y_max)
return true;
return false;
}


static inline bool
polygon_contains(const IE::polygon& poly, const IE::point& point)
{
if (point.x >= poly.left && point.x <= poly.right
&& point.y >= poly.top && point.y <= poly.bottom)
return true;
return false;
}


static inline GFX::rect
center_rect_in_rect(const GFX::rect& toCenter, const GFX::rect& windowRect)
{
Expand All @@ -120,29 +67,4 @@ center_rect_in_rect(const GFX::rect& toCenter, const GFX::rect& windowRect)
}


static inline GFX::rect
rect_to_gfx_rect(const IE::rect& rect)
{
GFX::rect gfxRect(
rect.x_min,
rect.y_min,
rect.Width(),
rect.Height()
);
return gfxRect;
}


static inline IE::rect
gfx_rect_to_rect(const GFX::rect& rect)
{
IE::rect IERect = {
rect.x,
rect.y,
(int16)(rect.x + rect.w),
(int16)(rect.y + rect.h)
};
return IERect;
}

#endif // __RECTUTILS_H
6 changes: 1 addition & 5 deletions timers/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "Timer.h"

#include "Log.h"
#include "ResManager.h"

#include <iostream>
#include <sstream>
#include <sys/time.h>

Expand Down Expand Up @@ -236,10 +236,6 @@ GameTimer::Expired() const
void
GameTimer::Add(const char* name, uint32 expirationTime)
{
std::string expiration = IDTable::GameTimeAt(expirationTime);
std::cout << "Added timer '" << name << "' which expires in ";
std::cout << expiration << "(" << std::dec << expirationTime;
std::cout << ")" << std::endl;
timer_map::iterator i = sTimers.find(name);
if (i != sTimers.end())
i->second->SetExpiration(expirationTime);
Expand Down

0 comments on commit 3431131

Please sign in to comment.