Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - bladelock

Pages: [1]
1
Window / sfml-window-d.dll is missing from my computer
« on: December 15, 2011, 10:26:21 pm »
Hello, I'm currently using SFML to detect user input, it gives a system error that goes something like this

Code: [Select]
The program can't start because sfml-window-d.dll is missing from your computer. Try reinstalling the program to fix this problem.

Currently, I have a folder named "SFML" that contains the include and library files that I need. Here is the setup of my computer

Additional Include Directories:

Code: [Select]
$(OGRE_HOME)\include;$(OGRE_HOME)\include\OIS;$(OGRE_HOME)\include\OGRE;$(OGRE_HOME)\Samples\Common\include;$(OGRE_HOME)\boost_1_44;./SFML

Additional Library Directories:

Code: [Select]
$(OGRE_HOME)\lib\$(Configuration);$(OGRE_HOME)\boost_1_44\lib;./SFML/lib;

Additional Dependencies

Code: [Select]
OgreMain.lib;OIS.lib;sfml-main.lib;sfml-system-s-d.lib;sfml-window-d.lib;%(AdditionalDependencies)

Some of the files inside SFML (not all)
:
System.hpp
Window.hpp
lib (folder)


the files inside SFML\lib
:
sfml-main.lib
sfml-system-s-d.dll
sfml-system-s-d.lib
sfml-window-d.dll
sfml-window-d.lib



And finally (if you need it) my code (my ogre code is based on the ogre3d tutorial, and the cpp file in focus now is my tutorialapplication.cpp file (it's where most of the code i insert takes place. it's also where i put the sfml code)

Code: [Select]


/*
-----------------------------------------------------------------------------
Filename:    TutorialApplication.cpp
-----------------------------------------------------------------------------

This source file is part of the
   ___                 __    __ _ _    _
  /___\__ _ _ __ ___  / / /\ \ (_) | _(_)
 //  // _` | '__/ _ \ \ \/  \/ / | |/ / |
/ \_// (_| | | |  __/  \  /\  /| |   <| |
\___/ \__, |_|  \___|   \/  \/ |_|_|\_\_|
      |___/                              
      Tutorial Framework
      http://www.ogre3d.org/tikiwiki/
-----------------------------------------------------------------------------
*/
#include "TutorialApplication.h"

//add SFML
#include<SFML\System.hpp>
#include<SFML\Window.hpp>
#include<SFML\Graphics.hpp>
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
 
TutorialApplication::TutorialApplication(void)
{
}
 
TutorialApplication::~TutorialApplication(void)
{
}
 
//-------------------------------------------------------------------------------------
void TutorialApplication::createScene(void)
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(0,0,0));
mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);

Ogre::Entity* entNinja = mSceneMgr->createEntity("Ninja","ninja.mesh");
entNinja->setCastShadows(true);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);

//the plane
Ogre::Plane plane(Ogre::Vector3::UNIT_Y,0);

Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        plane, 1500, 1500, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);

Ogre::Entity* entGround = mSceneMgr->createEntity("GroundEntity","ground");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);

//materials for the floor
entGround->setMaterialName("Examples/Rockwall");
entGround->setCastShadows(false);

//lights
Ogre::Light* pointLight = mSceneMgr->createLight("pointLight");
pointLight->setType(Ogre::Light::LT_POINT);
pointLight->setPosition(Ogre::Vector3(0,150,250));
pointLight->setDiffuseColour(1.0,0.0,0.0);
pointLight->setSpecularColour(1.0,0.0,0.0);

//directional light
Ogre::Light* directionalLight = mSceneMgr->createLight("directionalLight");
directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
directionalLight->setDiffuseColour(.25,0.25,0.0);
directionalLight->setSpecularColour(.25,0.25,0.0);
directionalLight->setDirection(Ogre::Vector3(0,-1,1));

//spotlight

 Ogre::Light* spotLight = mSceneMgr->createLight("spotLight");
    spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
    spotLight->setDiffuseColour(0, 0, 1.0);
    spotLight->setSpecularColour(0, 0, 1.0);
 
    spotLight->setDirection(-1, -1, 0);
    spotLight->setPosition(Ogre::Vector3(300, 300, 0));
 
spotLight->setSpotlightRange(Ogre::Degree(35),Ogre::Degree(50));

//SFML STUFF
sf::Event Event;

while(App.IsOpened())
{
while (App.GetEvent(Event))
{  
    if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::U))
mSceneMgr->getRootSceneNode()->translate(Ogre::Vector3(10,0,0));  
}
}


}

void TutorialApplication::createCamera(void)
{
mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Ogre::Vector3(0,10,500));
mCamera->lookAt(Ogre::Vector3(0,0,0));
mCamera->setNearClipDistance(5);
mCameraMan = new OgreBites::SdkCameraMan(mCamera);

}
void TutorialApplication::createViewports(void)
{
Ogre::Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
mCamera->setAspectRatio(Ogre::Real(vp->getActualWidth())/Ogre::Real(vp->getActualHeight()));
}








 
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif
 
#ifdef __cplusplus
extern "C" {
#endif
 
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
    int main(int argc, char *argv[])
#endif
    {
        // Create application object
        TutorialApplication app;
 
        try
        {
            app.go();
        } catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR| MB_TASKMODAL);
#else
            std::cerr << "An exception has occured: " << e.getFullDescription().c_str() << std::endl;
#endif
        }
 
        return 0;
    }
 
#ifdef __cplusplus
}
#endif


So where did I go wrong? where should I put the dll file anyway? Cheers



PS:

My Project is set under "Release" when being built and run, there are no other errors that are pointed out by visual studio other than the missing dll

2
General discussions / Is there an SFML Mario tutorial?
« on: September 29, 2011, 04:47:02 pm »
Hello, I was just wondering if there was an SFML Mario Clone tutorial with some source code.

I tried google for mario sfml game tutorials, but I havn't really found anything relevant.

I think that reading some Mario clone source code will help me understand some key aspects of the game, such as the jump sequence (Which, i'm still working on), and a nice and smooth running sequence.

I guess this is how I learned programming when I was an absolute beginner. I just need some code in action to give me some push.

Cheers.

3
General / Adding 2 Events in an SFML Application?
« on: September 26, 2011, 11:42:58 am »
Okay, i learned how to initialize an Event through this code
Code: [Select]
while (Running)
{
    sf::Event Event;
    while (App.GetEvent(Event))
    {
        // Process event
    }

    App.Display();
}


I then became zealous and created 2 events
Code: [Select]
while (Running)
{
    sf::Event Event;
    sf::Event Second;
    while (App.GetEvent(Event))
    {
        // Process event
    }

    while(App.GetEvent(Second))
    {
        //Process other events
     }

    App.Display();
}


Then when I run my SFML program, it releases this...

"Run-Time Check Failure #3 - The variable 'Second' is being used without being initialized."

I don't get it. How do I initialize my Event named Second?

Cheers.

4
Graphics / How to simulate Mario Jump? (moving the sprite in mid-air)
« on: September 26, 2011, 11:18:47 am »
Greetings

Okay, i made this chunk of code that makes the sprite "jump". I havn't really learned anything about manipulating the FPS of a program, so it might explain how i formulated my jump sequence.


I managed to make the sprite "jump" when I press the "Up" button; however, I'm not sure how to make the sprite move horizontally while in mid-air like how mario manages to move horizontally before touching the ground.

Here is part of my code.

Code: [Select]
while(Window.IsOpened())
{

while(Window.GetEvent(Event))
{

if((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Up))
{
for(int c = 0; c < 240; c++)
{
Sprite.Move(0, -1.0);
Window.Clear();
Window.Draw(Sprite);
Window.Display();
}

for(int c = 240; c > 0; c--)
{
Sprite.Move(0, 1.0);
Window.Clear();
Window.Draw(Sprite);
Window.Display();
}

}



}
while(Window.GetEvent(Event))
{
if(Event.Type == Event.Closed)
{
Window.Close();
}
else if((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Left))
{

Sprite.Move(-10.0, 0);
Window.Clear();
Window.Draw(Sprite);
Window.Display();

}
else if((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Right))
{

Sprite.Move(10.0,0);
Window.Clear();
Window.Draw(Sprite);
Window.Display();

}



}



}




Cheers.

5
Graphics / How to move a sprite without leaving multiple copies?
« on: September 12, 2011, 02:47:13 pm »
Well,  i was trying to make my sprite move to the left, however, Not only does it move to the left, it leaves a copy of the sprite at its former place.

How do i just let it move to the left WITHOUT leaving a copy of the sprite at its former place?

Here is my code:

Code: [Select]
#define SFML_STATIC

#include<iostream>
#include<SFML\System.hpp>
#include<SFML\Graphics.hpp>
using namespace std;
using namespace sf;

int main()
{

Image Image;


if (!Image.LoadFromFile("ToadR.png"))
return 1;

VideoMode Vmode(800,600,32);
RenderWindow Window(Vmode, "I am Awesome.");

Sprite Sprite;
Sprite.SetImage(Image);
float x = 400.0;
float y = 300.0;
Sprite.SetPosition(x, y);
Event Event;



while(Window.IsOpened())
{
Window.Draw(Sprite);
Window.Display();


while(Window.GetEvent(Event))
{
if(Event.Type == Event.Closed)
{
Window.Close();
}
else if((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Left))
{

Sprite.Move(-10.0, 0);




}

}




}
return 0;
}




I'm stumped. I hope I could get help. Thanks!

6
Graphics / error LNK2019
« on: September 04, 2011, 12:56:56 pm »
Hello, I was trying to type a code just to add a sprite. however, before i can even put in the sprite in image i get this darn error message
Code: [Select]


1>------ Build started: Project: loadsprite, Configuration: Debug Win32 ------
1>  main.cpp
1>sfml-graphics-s-d.lib(Image.obj) : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::SetActive(bool)const " (?SetActive@Window@sf@@QBE_N_N@Z) referenced in function "public: bool __thiscall sf::Image::CopyScreen(class sf::RenderWindow &,class sf::Rect<int> const &)" (?CopyScreen@Image@sf@@QAE_NAAVRenderWindow@2@ABV?$Rect@H@2@@Z)
1>sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: void __thiscall sf::Context::SetActive(bool)" (?SetActive@Context@sf@@QAEX_N@Z) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
1>sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: static class sf::Context & __cdecl sf::Context::GetGlobal(void)" (?GetGlobal@Context@sf@@SAAAV12@XZ) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
1>sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl sf::Context::IsContextActive(void)" (?IsContextActive@Context@sf@@SA_NXZ) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
1>******\Debug\loadsprite.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



here is my code so far...

Code: [Select]
#include<iostream>
#include<SFML\System.hpp>
#include<SFML\Graphics.hpp>
using namespace std;
using namespace sf;

int main()
{

sf::Image Image;
if (!Image.LoadFromFile("MarioStanding.png"))
return 1;
return 0;



I linked towards
sfml-graphics-s-d.lib
sfml-main.lib
sfml-system-s-d.lib


what's wrong with my code? How can I fix it?

Cheers

Pages: [1]