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.


Messages - bladelock

Pages: [1] 2
1
Window / sfml-window-d.dll is missing from my computer
« on: December 19, 2011, 08:49:26 am »
Quote from: "Tex Killer"
Try using
Code: [Select]
system("cd");
to know where your program is running from. In order to see the result you should compile the project as a console application.


I see, but how do I use the code in my .cpp file? Can you give me a sample code of it being used in action?


Also, by the way, I was able to find the problem. The "current directory" of the exe was in
Code: [Select]
<OgreSDKFolder>\bin\release

I believe that the current directory was modified by this code given during the setup of the OGRE sdk in the wiki, which goes like

Code: [Select]

setx OGRE_HOME %CD%
pause


Which i believe sets the current directory of an ogre project into the OGRE SDK instead of the Project's own directory for the use of OGRE.

at the very least, that solved the dll problem.

Now I'm getting
Code: [Select]
Unhandled exception at 0x7740f7cc in <nameofproject>.exe: 0xc0000005: Acess violation reading location 0x6e695720.

which i believe is caused by sfml because when I turned my sfml code in to comment code (using /* and */), the same error still occured, which makes me deduce that there's a problem somewhere in my ogre code, which I may have to solve myself at this point.

Thank you guys for helping!

2
Window / sfml-window-d.dll is missing from my computer
« on: December 19, 2011, 04:55:14 am »
Yes, still the same problem.

3
Window / sfml-window-d.dll is missing from my computer
« on: December 19, 2011, 04:42:01 am »
rebuilt the sdk into "Release", still nothing.

It still claims that the sfml-window.dll file is still missing from my computer.

It's in the location of my exe (it's in the Release folder since I set my project to Release)



why is it missing? what disables Visual Studio from detecting the dll file? I mean, it's in my exe's folder...

4
Window / sfml-window-d.dll is missing from my computer
« on: December 18, 2011, 03:28:26 pm »
okay, I'll try fix this tomorrow by rebuilding the downloadable sfml solution from the website, maybe that will help.

I'll give you guys a heads-up if anything happens

5
Window / sfml-window-d.dll is missing from my computer
« on: December 18, 2011, 03:11:33 am »
I dragged all the necessary dlls, and executed the exe from the release folder (using the explorer).

Now it says the .exe "has stopped working."

What causes this crash?

Thanks

6
Window / sfml-window-d.dll is missing from my computer
« on: December 17, 2011, 01:09:59 pm »
okay, so I modified my settings to use sfml-window.lib instead of sfml-window-d.lib

I placed sfml-window.dll in my Release folder because my project is set to "Release" instead of "Debug".

How could I fix this? Also the Ogre code only runs in Release atm (which is a different story)

7
Window / sfml-window-d.dll is missing from my computer
« on: December 17, 2011, 07:13:56 am »
I placed the dll file in the Release folder (Projects/*project name*/Release) folder already. It still claims that the dll file is missing from my computer.

How do I fix this?

8
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

9
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.

10
Graphics / How to simulate Mario Jump? (moving the sprite in mid-air)
« on: September 28, 2011, 01:58:09 pm »
Quote from: "Nexus"
As the error message says, IsKeyDown() is not static, so you need an object to call it.

You can access the sf::Input object of a window with sf::RenderWindow's method GetInput(). Call the IsKeyDown() method on this object, using the . operator.


I googled your suggestion, I found this link.
http://www.youtube.com/watch?v=G1_OstExZAk

I learned that since I would have to call it w/ an object. I called IsKeyDown using Window.GetInput()

Resulting to something like

if(Window.GetInput().IsKeydDown(sf::Key::Up))

Thank you!


Now, to the main question, with this method, how can I then simulate the Jump, allowing the player to move a bit while in mid-air?

11
Graphics / How to simulate Mario Jump? (moving the sprite in mid-air)
« on: September 28, 2011, 12:22:07 pm »
Quote from: "Laurent"
This enum is in the namespace sf::Key.

Code: [Select]
if(Input::IsKeyDown(sf::Key::Up))


Sir Laurent, I have tried adding the if condition you suggested; however, I end up getting this

Code: [Select]
main.cpp(39): error C2352: 'sf::Input::IsKeyDown' : illegal call of non-static member function


What have I done?

12
Graphics / How to simulate Mario Jump? (moving the sprite in mid-air)
« on: September 28, 2011, 11:59:04 am »
Quote from: "sbroadfoot90"
There are two different methods for detecting keyboard input. When the first time the key is pressed, an KeyPressed event gets sent to the event stack. Similarly when the key is released, a KeyReleased event gets sent to the event stack.

However, if you want to track whether a certain key is being pressed at the moment, it's a bit tricky to keep track of these events. Instead the way to test if a key is being pressed right now, you can use the function sf::Input::IsKeyDown(key). So to test if the user is pressing two keys, say up and left, you can go

Code: [Select]
if(IsKeyDown(up) && IsKeyDown(left))

I wouldn't try the OO approach until you understand sfml a bit better.

What is your syntax error saying? Obviously I'm only writing in pseudocode, so don't copy and paste what I've been typing directly into your code.


It tried the Input::IsKeyDown() function, this is what I got



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

if(Input::IsKeyDown(Up))
{
Sprite.Move(0, -10.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();

}



}



}


Then it says...
Code: [Select]
main.cpp(38): error C2065: 'Up' : undeclared identifier

I checked the SFML Website, and I included <SFML\Window\Input.hpp>

And I added "Up" since it said here that the keycode for the up arrow is "Up"
http://www.sfml-dev.org/documentation/1.6/namespacesf_1_1Key.php#ad32ed01d3448273340bd25af5cdd9c81

How should I fix this?



EDIT: Now i've tried replaceing "Up" with
Code: [Select]
Key::Up
now it gives
Code: [Select]
main.cpp(38): error C2352: 'sf::Input::IsKeyDown' : illegal call of non-static member function

How do I do this?

Thanks for the help so far also.

13
Graphics / How to simulate Mario Jump? (moving the sprite in mid-air)
« on: September 27, 2011, 01:34:12 pm »
Quote from: "sbroadfoot90"
I explain the structure of the game loop here

http://www.sfml-dev.org/forum/viewtopic.php?p=39048

Unfortunately in your code, while it will still run, in each game loop, you allow for one jump. One game loop is essentially one frame, so the jump should span over many game loops. You want something like this

Code: [Select]
while(Window.GetEvent(Event)) {
   if( user pressed up ) {
      MarioJumping = true;
   }
}

if (MarioJumping) {
   put some logic in here including things like

   if (left key is being pressed) {
      move mario left a bit
   }

   if (mario hit the ground) {
      MarioJumping = false;
   }
}


Eventually you'll want to move everything into a class so the above code will turn into something like

Code: [Select]
while(Window.GetEvent(Event)) {
   if( user pressed up ) {
      Mario.Jump();
   }
}

Mario.Update();

Window.Clear();
Mario.Draw(Window);
Window.Display();


with the class looking something like this

Code: [Select]
class Mario {
public:
   void Jump();
   void Draw(sf::RenderWindow &Window);
   void Update();
private:
   sf::Sprite Sprite;
   bool IsJumping;
};

void Mario::Jump() {
   IsJumping = true;
}

void Mario::Update() {
   if(IsJumping) {
      same jumping logic as above
   }
   
   some more updating logic
}


trying it out at the moment.

This is hard!!! I'm already getting screwed by some syntax error  



What if I try to make SFML detect whether the user is pressing two keys at once, how will the code look like?

Thanks

14
Graphics / How to simulate Mario Jump? (moving the sprite in mid-air)
« on: September 27, 2011, 11:24:19 am »

15
General / Adding 2 Events in an SFML Application?
« on: September 27, 2011, 11:12:11 am »
i think this solves this particular issue, but it seems like i might have to take on a different approach for this issue

http://www.sfml-dev.org/forum/viewtopic.php?p=39133#39133


thanks for the help!

Pages: [1] 2