Add callbacks, make library locations part of project now

This commit is contained in:
Vulpovile
2025-04-07 19:44:51 -07:00
parent d06251ce7f
commit d854ddfdd4
5 changed files with 25 additions and 9 deletions

View File

@@ -27,7 +27,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
WholeProgramOptimization="TRUE"
AdditionalIncludeDirectories="".\src\include""
AdditionalIncludeDirectories="C:\libraries\ode\include;C:\libraries\sdl\include;"C:\libraries\g3d-6_10\include";.\src\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;NO_SDL_MAIN;_ATL_STATIC_REGISTRY"
StringPooling="TRUE"
RuntimeLibrary="2"
@@ -47,6 +47,7 @@
OutputFile="./Blocks3D.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="C:\libraries\sdl\lib\x86;C:\libraries\ode\lib\releaselib;"C:\libraries\g3d-6_10\win32-7-lib""
ProgramDatabaseFile=".\Release/Blocks3D.pdb"
SubSystem="2"
StackReserveSize="16777216"
@@ -96,7 +97,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\src\include"
AdditionalIncludeDirectories="C:\libraries\ode\include;C:\libraries\sdl\include;&quot;C:\libraries\g3d-6_10\include&quot;;.\src\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_ATL_STATIC_REGISTRY;NO_SDL_MAIN"
MinimalRebuild="FALSE"
BasicRuntimeChecks="0"
@@ -115,11 +116,11 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib Urlmon.lib ole32.lib oleaut32.lib uuid.lib oded.lib"
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib Urlmon.lib ole32.lib oleaut32.lib uuid.lib ode.lib"
OutputFile="./Blocks3D-Debug.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=""
AdditionalLibraryDirectories="C:\libraries\sdl\lib\x86;C:\libraries\ode\lib\debuglib;&quot;C:\libraries\g3d-6_10\win32-7-lib&quot;"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/Blocks3D.pdb"
SubSystem="1"

View File

@@ -6,9 +6,9 @@
</dependentAssembly>
</dependency>
<!--This should generally not be specified, but XP's VS2005 won't update automatically-->
<dependency>
<!-- <dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.6195" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</dependency> -->
</assembly>

View File

@@ -12,6 +12,7 @@ namespace B3D{
virtual void drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown);
virtual bool mouseInButton(float, float, RenderDevice* rd);
virtual void onMouseClick();
virtual void setCallback(void (*callback)(DataModelInstance * theDatamodel, BaseButtonInstance * theCaller, WPARAM wParam, LPARAM lParam));
void setActionCode(int actionCode);
bool floatBottom;
bool floatRight;
@@ -21,5 +22,6 @@ namespace B3D{
protected:
int actionCode;
bool mouseInArea(float, float, float, float, float, float);
void (*callback)(DataModelInstance * theDatamodel, BaseButtonInstance * theCaller, WPARAM wParam, LPARAM lParam);
};
}

View File

@@ -4,6 +4,7 @@ using namespace B3D;
BaseButtonInstance::BaseButtonInstance(void) : Instance()
{
actionCode = 0;
callback = NULL;
}
void BaseButtonInstance::render(RenderDevice* rd)
@@ -29,12 +30,20 @@ bool BaseButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice*
void BaseButtonInstance::onMouseClick()
{
if(callback != NULL)
{
callback(this->getParentDataModel(), this, NULL, NULL);
}
// if(listener != NULL)
// {
// listener->onButton1MouseClick(this);
// }
}
void BaseButtonInstance::setCallback(void (*callback)(DataModelInstance * theDatamodel, BaseButtonInstance * theCaller, WPARAM wParam, LPARAM lParam))
{
this->callback = callback;
}
bool BaseButtonInstance::mouseInArea(float point1x, float point1y, float point2x, float point2y, float mousex, float mousey)
{

View File

@@ -22,6 +22,10 @@ using namespace B3D;
#define VS03_WORKAROUND
#endif
void menuCallback(DataModelInstance * theDataModel, BaseButtonInstance * theCaller, WPARAM wParam, LPARAM lParam) {
MessageBoxA(NULL, "Tomato", "Tomato", MB_OK);
}
ImageButtonInstance* GuiRootInstance::makeImageButton(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
{
//Oh come on
@@ -65,7 +69,7 @@ TextButtonInstance* makeToolbarTextButton(std::string title, std::string name, V
button->fontLocationRelativeTo = Vector2(10, 0);
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->setAllColorsSame();
//button->setButtonListener(menuListener);
button->setCallback(&menuCallback);
return button;
}
@@ -150,7 +154,7 @@ GuiRootInstance::GuiRootInstance() : Instance(), _message(""), _messageTime(0)
button->setParent(this);
button->name = "MENU";
//TODO Define Action
//button->setButtonListener(menuListener);
button->setCallback(&menuCallback);
ImageButtonInstance* instance = new ToggleImageButtonInstance(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Run.png")),
@@ -162,7 +166,7 @@ GuiRootInstance::GuiRootInstance() : Instance(), _message(""), _messageTime(0)
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Stop_dn.png"))
);
//TODO Define Action
//instance->setButtonListener(menuListener);
instance->setCallback(&menuCallback);
instance->name = "go";
instance->size = Vector2(65,65);
instance->position = Vector2(6.5, 25);