UI - Resolved last build issues

+ Tool has name!
+ Finished renaming files
+ Fixed common sync code that still had some SDL shit left
This commit is contained in:
Emmanuel BENOîT 2017-11-24 10:08:41 +01:00
parent 81a60d7832
commit 0fcfeb1fee
11 changed files with 73 additions and 58 deletions

4
.gitignore vendored
View file

@ -1,5 +1,5 @@
demo
parsercheck
tourista
tourista-builder
*.o
fd-*.h
imgui.ini

View file

@ -1,8 +1,8 @@
#!/bin/bash
if make -j 8; then
if [ -x /usr/bin/optirun ]; then
optirun ./demo
optirun ./tourista
else
./demo
./tourista
fi
fi

View file

@ -7,8 +7,10 @@ CPPFLAGS += -I. -I$(OUTDIR) \
-I3rdparty/icon-font-headers \
-I3rdparty/ebcl/include \
-DREAL_BUILD -DGLM_ENABLE_EXPERIMENTAL
LIBS += $(shell sdl2-config --libs) -lGL -lGLEW -ldl \
$(LIBEBCL) -latomic
BUILDER_LIBS = $(LIBEBCL) -latomic
TOOL_LIBS = $(shell sdl2-config --libs) -lGL -lGLEW -ldl $(BUILDER_LIBS)
FILEDUMPS =
@ -32,8 +34,8 @@ COMMON = \
c-syncoverrides.cc \
# END COMMON
DEMO = \
main.cc \
TOOL = \
m-tool.cc \
ui.cc \
ui-actions.cc \
ui-app.cc \
@ -51,45 +53,45 @@ DEMO = \
ui-sync.cc \
ui-texture.cc \
ui-utilities.cc \
# END DEMO
# END TOOL
PARSERCHECK = \
parsercheck.cc \
# END PARSERCHECK
BUILDER = \
m-builder.cc \
# END BUILDER
IMGUI_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(IMGUI))))
COMMON_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(COMMON))))
DEMO_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(DEMO))))
PARSERCHECK_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(PARSERCHECK))))
TOOL_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(TOOL))))
BUILDER_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(BUILDER))))
LIBEBCL = $(OUTDIR)/ebcl/libebcorelib.a
PCH=externals.hh.gch
COMMON_DEPS = $(COMMON_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d)
DEMO_DEPS = $(DEMO_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d)
PARSERCHECK_DEPS = $(PARSERCHECK_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d)
DEMO_DEPS = $(TOOL_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d)
BUILDER_DEPS = $(BUILDER_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d)
COMMON_REQ = $(COMMON_OBJS) $(IMGUI_OBJS)
COMMON_REQ = $(COMMON_OBJS)
DEMO_BUILD = $(DEMO_OBJS) $(COMMON_REQ)
PARSERCHECK_BUILD = $(PARSERCHECK_OBJS) $(COMMON_REQ)
DEMO_BUILD = $(TOOL_OBJS) $(COMMON_REQ) $(IMGUI_OBJS)
BUILDER_BUILD = $(BUILDER_OBJS) $(COMMON_REQ)
ALL_OBJS = $(DEMO_OBJS) $(PARSERCHECK_OBJS) $(COMMON_REQ)
ALL_DEPS = $(COMMON_DEPS) $(DEMO_DEPS) $(PARSERCHECK_DEPS)
ALL_OBJS = $(TOOL_OBJS) $(BUILDER_OBJS) $(COMMON_REQ)
ALL_DEPS = $(COMMON_DEPS) $(DEMO_DEPS) $(BUILDER_DEPS)
all: demo parsercheck
all: tourista tourista-builder
demo: $(LIBEBCL) $(DEMO_BUILD)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o demo \
$(DEMO_BUILD) $(LIBS)
tourista: $(LIBEBCL) $(DEMO_BUILD)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o tourista \
$(DEMO_BUILD) $(TOOL_LIBS)
parsercheck: $(LIBEBCL) $(PARSERCHECK_BUILD)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o parsercheck \
$(PARSERCHECK_BUILD) $(LIBS)
tourista-builder: $(LIBEBCL) $(BUILDER_BUILD)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o tourista-builder \
$(BUILDER_BUILD) $(BUILDER_LIBS)
clean:
rm -f $(ALL_OBJS) $(FILEDUMPS) demo parsercheck $(PCH) $(OUTDIR)/font-awesome.inl
rm -f $(ALL_OBJS) $(FILEDUMPS) tourista tourista-builder $(PCH) $(OUTDIR)/font-awesome.inl
depclean: clean
rm -f $(ALL_DEPS)
@ -117,7 +119,7 @@ $(IMGUI_OBJS): $(OUTDIR)/%.o: 3rdparty/imgui/%.cpp | outdir
#-------------------------------------------------------------------------------
-include $(DEMO_DEPS)
$(DEMO_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS)
$(TOOL_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -M -MF $(@:%.o=%.d) -MT $@ $<
@ -130,8 +132,8 @@ $(COMMON_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS)
#-------------------------------------------------------------------------------
-include $(PARSERCHECK_DEPS)
$(PARSERCHECK_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS)
-include $(BUILDER_DEPS)
$(BUILDER_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -M -MF $(@:%.o=%.d) -MT $@ $<

View file

@ -512,19 +512,7 @@ void T_SyncManager::setTime(
{
time_.setTime( time );
updateValues( );
}
void T_SyncManager::updateTime( ) noexcept
{
if ( playing_ ) {
const float time( SDL_GetTicks( ) * 1e-3 );
if ( playingPrevious_ ) {
timeDelta( time - lastFrame_ );
playing_ = !finished( );
}
lastFrame_ = time;
}
playingPrevious_ = playing_;
playing_ = playing_ && !finished( );
}
/*----------------------------------------------------------------------------*/

View file

@ -387,8 +387,6 @@ struct T_SyncManager
T_SyncTime time_; // Duration/time information
bool playing_{ false }; // Is it playing?
bool playingPrevious_{ false }; // Was it playing before?
float lastFrame_{ 0 }; // Time of last frame
T_SyncValues values_; // Value storage
T_SyncCurves curves_; // Curves storage

View file

View file

@ -31,7 +31,7 @@ T_UIApp::T_UIApp( )
SDL_DisplayMode current;
SDL_GetCurrentDisplayMode( 0 , &current );
window_ = SDL_CreateWindow( "DEMO",
window_ = SDL_CreateWindow( "Tourista",
SDL_WINDOWPOS_CENTERED , SDL_WINDOWPOS_CENTERED ,
1280 , 720 ,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE );

View file

@ -4,9 +4,11 @@
#include "c-opcomp.hh"
#include "c-sync.hh"
#include "ui.hh"
#include "ui-demo.hh"
#include "ui-opemu.hh"
#include "ui-rendertarget.hh"
#include "ui-sync.hh"
#include <ebcl/Files.hh>
#include <ebcl/SRDText.hh>
@ -30,12 +32,13 @@ void T_Demo::render( )
}
}
auto& sync( Common::Sync( ) );
sync.updateTime( );
UI::Sync( ).updateTime( );
if ( context && !context->aborted ) {
try {
context->run( ops::T_OpContext::R_RENDER , sync.time( ) , width , height );
context->run( ops::T_OpContext::R_RENDER ,
Common::Sync( ).time( ) ,
width , height );
} catch ( ops::X_OpFailure const& fail ) {
printf( "FAILED TO RUN FRAME!\n\t%s\n" , fail.what( ) );
context->aborted = true;

View file

@ -175,6 +175,21 @@ void T_UISync::makeOverridesWindow( )
/*----------------------------------------------------------------------------*/
void T_UISync::updateTime( ) noexcept
{
auto& s{ Common::Sync( ) };
if ( s.playing( ) ) {
const float time( SDL_GetTicks( ) * 1e-3f );
if ( playingPrevious_ ) {
s.timeDelta( time - lastFrame_ );
}
lastFrame_ = time;
}
playingPrevious_ = s.playing( );
}
/*----------------------------------------------------------------------------*/
void T_UISync::delegateMouse(
T_String const& id ,
P_MouseCtrl delegate ) noexcept

View file

@ -6,21 +6,26 @@
class T_UISync : public A_MouseCtrl
{
public:
using F_Override = std::function<
void( A_SyncOverride& , uint32_t& , T_StringBuilder& ) >;
T_UISync( );
~T_UISync( );
//----------------------------------------------------------------------
bool& overridesWindowEnabled( ) noexcept
{ return ovWindow_; }
void makeOverridesWindow( );
using F_Override = std::function<
void( A_SyncOverride& , uint32_t& , T_StringBuilder& ) >;
F_Override uiFor( A_SyncOverride& target ) const noexcept;
//----------------------------------------------------------------------
void updateTime( ) noexcept;
//----------------------------------------------------------------------
void delegateMouse( T_String const& id ,
P_MouseCtrl delegate ) noexcept;
void clearMouseDelegate( ) noexcept;
@ -40,8 +45,12 @@ class T_UISync : public A_MouseCtrl
T_MouseButtons buttons ) noexcept override;
private:
bool ovWindow_{ false };
T_String mouseDelegateName_{ };
bool ovWindow_{ false }; // Overrides window open
T_KeyValueTable< T_String , F_Override > sovuis_; // Override UI table
T_String mouseDelegateName_{ }; // Name and pointer for mouse delegation
T_OwnPtr< A_MouseCtrl > mouseDelegate_{ };
T_KeyValueTable< T_String , F_Override > sovuis_;
bool playingPrevious_{ false }; // Was it playing before?
float lastFrame_{ 0 }; // Time of last frame
};