Bläddra i källkod

It works on Windows.

Eiyeron Fulmincendii 9 år sedan
förälder
incheckning
2b557f8b07

+ 7 - 1
.gitmodules

@@ -1,9 +1,15 @@
 [submodule "external/tinystl"]
 	path = external/tinystl
-	url = git://github.com/mendsley/tinystl.git
+	url = https://github.com/mendsley/tinystl.git
 [submodule "external/lodepng"]
 	path = external/lodepng
 	url = https://github.com/lvandeve/lodepng.git
 [submodule "external/luwra"]
 	path = external/luwra
 	url = https://github.com/vapourismo/luwra.git
+[submodule "external/imgui"]
+	path = external/imgui
+	url = https://github.com/ocornut/imgui.git
+[submodule "external/imgui-backends"]
+	path = external/imgui-backends
+	url = https://github.com/Mischa-Alff/imgui-backends.git

+ 1 - 1
Makefile

@@ -1,4 +1,4 @@
-NAME = WalrusRPG
+NAME = Pacman-Lua
 
 DEBUG = FALSE
 

+ 1 - 1
platform/sfml/Graphics.cpp

@@ -18,7 +18,7 @@ void Graphics::init()
     Logger::log("Graphics init");
     // window.create(sf::VideoMode::getDesktopMode(), "WalrusRPG",
     // sf::Style::Fullscreen);
-    window.create(sf::VideoMode(640, 480), "WalrusRPG");
+    window.create(sf::VideoMode(640, 480), "Pacman-Lua by Florian \"Eiyeron\" Dormont.");
     window.setFramerateLimit(60);
     view = sf::View(window.getDefaultView());
     buffer.create(320, 240);

+ 1 - 1
platform/windows/Graphics.cpp

@@ -18,7 +18,7 @@ void Graphics::init()
     Logger::log("Graphics init");
     // window.create(sf::VideoMode::getDesktopMode(), "WalrusRPG",
     // sf::Style::Fullscreen);
-    window.create(sf::VideoMode(640, 480), "WalrusRPG");
+    window.create(sf::VideoMode(640, 480), "Pacman-Lua by Florian \"Eiyeron\" Dormont.");
     window.setFramerateLimit(60);
     view = sf::View(window.getDefaultView());
     buffer.create(320, 240);

+ 5 - 0
platform/windows/Logger.cpp

@@ -22,6 +22,11 @@ namespace
 // NOTE : I really wish there would be a better way to handle these stupid va_lists. So
 // much redundant code...
 
+void Logger::init()
+{
+    
+}
+
 void Logger::log(const char *fmt, ...)
 {
     print_premessage("  [LOG]");

+ 41 - 0
platform/windows/Status.cpp

@@ -0,0 +1,41 @@
+#include "Status.h"
+#include "Logger.h"
+#include "Quirks.h"
+#include "sfwindow.h"
+#include <SFML/Window/Event.hpp>
+#include "platform.h"
+
+using namespace WalrusRPG;
+
+namespace
+{
+    static bool askedToQuit;
+}
+
+void Status::init()
+{
+    Logger::log("Status init");
+    askedToQuit = false;
+}
+
+void Status::deinit()
+{
+    Logger::log("Status deinit");
+}
+
+void Status::update()
+{
+    sf::Event event;
+    while (window.pollEvent(event))
+    {
+        if (event.type == sf::Event::Closed)
+            askedToQuit = true;
+    }
+    if (Quirks::get_key(sf::Keyboard::Escape))
+        askedToQuit = true;
+}
+
+bool Status::mustQuit()
+{
+    return askedToQuit;
+}

+ 4 - 4
platform/windows/rules.mk

@@ -1,8 +1,8 @@
-sfml_LOCAL_PATH := $(call whereami)
+windows_LOCAL_PATH := $(call whereami)
 
-SRCS_C += $(wildcard $(sfml_LOCAL_PATH)/platform/*.c)
-SRCS_CPP += $(wildcard $(sfml_LOCAL_PATH)/*.cpp)
-INCLUDE += $(sfml_LOCAL_PATH)/public
+SRCS_C += $(wildcard $(windows_LOCAL_PATH)/platform/*.c)
+SRCS_CPP += $(wildcard $(windows_LOCAL_PATH)/*.cpp)
+INCLUDE += $(windows_LOCAL_PATH)/public
 
 LDFLAGS += -L/usr/lib -lstdc++ -lsfml-graphics -lsfml-window -lsfml-system -lopengl32 -lwinmm -lgdi32 -lm
 

+ 2 - 2
rules.mk

@@ -33,8 +33,8 @@ $(OUT)/%.o: %.cpp | $(BUILT_SRCS)
 $(ELF): $(OBJS)
 	@mkdir -p $(dir $@)
 	@echo "CCLD: $@"
-	@+$(CC) $(LDFLAGS) $^ $(LIBS) -o $(ELF)
-	# @+$(CC) $^ -o $(ELF) $(LDFLAGS)
+	#@+$(CC) $(LDFLAGS) $^ $(LIBS) -o $(ELF)
+	 @+$(CC) $^ $(LIBS) -o $(ELF) $(LDFLAGS)
 
 clean:
 	@echo "RM: $(OUT)"

+ 1 - 1
src/pacman/GameState.cpp

@@ -121,7 +121,7 @@ GameState::GameState() : level(1), map(28, 31, map_data, nullptr, map_texture),
 	gameState.set("get_tile", cfun_getTile);
 
 	luwra::setGlobal(L, "gamestate", gameState);
-	p1 = new AIPlayer(4,4, *this, "data/p2.lua", "p2");
+	p1 = new AIPlayer(4,4, *this, "data/p1.lua", "p1");
 	p2 = new AIPlayer(200,228, *this, "data/p2.lua", "p2");
 	blinky = new Ghost(68, 84, *this, "data/blinky.lua", "blinky");
 	inky = new Ghost(140, 84, *this, "data/inky.lua", "inky");

+ 1 - 1
src/pacman/Ghost.cpp

@@ -56,7 +56,7 @@ void Ghost::update(unsigned dt)
 
 void Ghost::render(unsigned dt, Camera& cam, Pixel col)
 {
-    if(dead_timer) {
+    if(dead_timer > 0) {
         col = dead_timer % 2 ? col : DarkGray;
     } else if(weak){
         if(weak_timer > 60 || (weak_timer % 10 < 5) )