From 26c432be9004eb463867d0fe56bc398dc1f41d44 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 18 Sep 2012 23:00:13 +0000 Subject: [PATCH] gpu: sip an empty LolFx class that embeds the compiler. --- src/Makefile.am | 1 + src/core.h | 1 + src/gpu/lolfx.cpp | 51 +++++++++++++++++++++++++++++++++++++ src/gpu/lolfx.h | 35 +++++++++++++++++++++++++ src/lolcore.vcxproj | 2 ++ src/lolcore.vcxproj.filters | 6 +++++ 6 files changed, 96 insertions(+) create mode 100644 src/gpu/lolfx.cpp create mode 100644 src/gpu/lolfx.h diff --git a/src/Makefile.am b/src/Makefile.am index b52f58a9..f70547e4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -56,6 +56,7 @@ liblol_a_SOURCES = \ gpu/emptymaterial.lolfx \ gpu/testmaterial.lolfx \ \ + gpu/lolfx.cpp gpu/lolfx.h \ gpu/lolfx-compiler.cpp gpu/lolfx-compiler.h \ generated/lolfx-parser.cpp generated/lolfx-parser.h \ generated/lolfx-scanner.cpp \ diff --git a/src/core.h b/src/core.h index ec6caf17..eb08aae6 100644 --- a/src/core.h +++ b/src/core.h @@ -113,6 +113,7 @@ static inline int isnan(float f) #include "dict.h" #include "map.h" #include "layer.h" +#include "gpu/lolfx.h" #include "gpu/shader.h" #include "gpu/indexbuffer.h" #include "gpu/vertexbuffer.h" diff --git a/src/gpu/lolfx.cpp b/src/gpu/lolfx.cpp new file mode 100644 index 00000000..32a4a96f --- /dev/null +++ b/src/gpu/lolfx.cpp @@ -0,0 +1,51 @@ +// +// Lol Engine +// +// Copyright: (c) 2010-2012 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. +// + +// +// The LolFx class +// --------------- +// + +#if defined HAVE_CONFIG_H +# include "config.h" +#endif + +#if defined _XBOX +# define _USE_MATH_DEFINES /* for M_PI */ +# include +# undef near /* Fuck Microsoft */ +# undef far /* Fuck Microsoft again */ +#elif defined _WIN32 +# define _USE_MATH_DEFINES /* for M_PI */ +# define WIN32_LEAN_AND_MEAN +# include +# undef near /* Fuck Microsoft */ +# undef far /* Fuck Microsoft again */ +#endif + +#include "core.h" +#include "gpu/lolfx-compiler.h" + +namespace lol +{ + +LolFx::LolFx() +{ + ; +} + +bool LolFx::Compile(char const *command) +{ + LolFxCompiler lc(*this); + return lc.ParseString(command); +} + +} /* namespace lol */ + diff --git a/src/gpu/lolfx.h b/src/gpu/lolfx.h new file mode 100644 index 00000000..3da6cebc --- /dev/null +++ b/src/gpu/lolfx.h @@ -0,0 +1,35 @@ +// +// Lol Engine +// +// Copyright: (c) 2010-2012 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. +// + +// +// The LolFx class +// --------------- +// + +#if !defined __GPU_LOLFX_H__ +#define __GPU_LOLFX_H__ + +namespace lol +{ + +class LolFx +{ + friend class LolFxParser; + +public: + LolFx(); + + bool Compile(char const *command); +}; + +} /* namespace lol */ + +#endif /* __GPU_LOLFX_H__ */ + diff --git a/src/lolcore.vcxproj b/src/lolcore.vcxproj index dc9fd6e5..03321df5 100644 --- a/src/lolcore.vcxproj +++ b/src/lolcore.vcxproj @@ -252,6 +252,7 @@ + @@ -564,6 +565,7 @@ + diff --git a/src/lolcore.vcxproj.filters b/src/lolcore.vcxproj.filters index d02d5dec..e5160ce7 100644 --- a/src/lolcore.vcxproj.filters +++ b/src/lolcore.vcxproj.filters @@ -625,6 +625,9 @@ src\gpu + + src\gpu + @@ -1560,6 +1563,9 @@ src\gpu + + src\gpu + src\gpu