Corregido bug en el FADE_RANDOM_SQUARE al acceder a elementos fuera del vector
This commit is contained in:
14
Makefile
14
Makefile
@@ -23,16 +23,18 @@ INCLUDES:= -I$(DIR_SOURCES)
|
||||
|
||||
# Variables según el sistema operativo
|
||||
ifeq ($(OS),Windows_NT)
|
||||
FixPath = $(subst /,\,$1)
|
||||
SOURCES := source/*.cpp source/common/*.cpp
|
||||
CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows
|
||||
LDFLAGS := -lmingw32 -lws2_32 -lSDL2main -lSDL2
|
||||
RM:= rmdir /Q /S
|
||||
MKD:=
|
||||
RM = del /Q
|
||||
MKD:= mkdir
|
||||
else
|
||||
FixPath = $1
|
||||
SOURCES := $(shell find $(DIR_SOURCES) -name '*.cpp')
|
||||
CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections
|
||||
LDFLAGS := -lSDL2
|
||||
RM:= rm -rdf
|
||||
RM = rm -f
|
||||
MKD:= mkdir -p
|
||||
endif
|
||||
|
||||
@@ -54,11 +56,11 @@ all: a1
|
||||
a1: $(TARGET_FILE)
|
||||
|
||||
$(TARGET_FILE): $(OBJECTS)
|
||||
mkdir -p $(@D)
|
||||
$(MKD) $(@D)
|
||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $(TARGET_FILE)
|
||||
|
||||
$(DIR_BUILD)%.o: $(DIR_SOURCES)%.cpp
|
||||
mkdir -p $(@D)
|
||||
$(MKD) $(@D)
|
||||
$(CXX) -c $< $(CXXFLAGS) $(INCLUDES) -o $@
|
||||
|
||||
-include $(DEPENDENCIES)
|
||||
@@ -72,7 +74,7 @@ $(DIR_BUILD)%.o: $(DIR_SOURCES)%.cpp
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
$(RM) $(DIR_BUILD)
|
||||
$(RM) $(call FixPath,$(DIR_BUILD))
|
||||
|
||||
###############################################################################
|
||||
# #
|
||||
|
||||
@@ -133,7 +133,8 @@ void Fade::update()
|
||||
const int index = std::min(counter / fadeRandomSquaresDelay, (numSquaresWidth * numSquaresHeight) - 1);
|
||||
for (int i = 0; i < fadeRandomSquaresMult; ++i)
|
||||
{
|
||||
SDL_RenderFillRect(renderer, &square[index * fadeRandomSquaresMult + i]);
|
||||
const int index2 = std::min(index * fadeRandomSquaresMult + i, (int)square.size() - 1);
|
||||
SDL_RenderFillRect(renderer, &square[index2]);
|
||||
}
|
||||
|
||||
// Volvemos a usar el renderizador de forma normal
|
||||
|
||||
Reference in New Issue
Block a user