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 - Ardeshir81

Pages: [1]
1
Window / Re: How to simulate keyboard/mouse press with SFML?
« on: March 07, 2014, 07:44:23 pm »
Thanks everyone !

2
Window / Re: How to simulate keyboard/mouse press with SFML?
« on: March 07, 2014, 07:36:49 pm »
Thanks Everyone!

SO , I'm doing the wrong thing !
I will read on proper package production and hope I get it fixed soon .

BTW can SFML do that ? I mean press a key ?
Or is it impossible and needs hardware (keyboard in this case) to do it ?
Thanks !

3
Window / How to simulate keyboard/mouse press with SFML?
« on: March 07, 2014, 06:12:33 pm »
HI Everyone !
Is it possible to simulate a key press with SFML ?
I mean can SFML press a key for me ?

The reason I want this is that I'm writing a program which waits for some time (entered by user) and then runs a kernel command . (Linux Ubuntu 13)
But sometimes when the command is "sudo apt-get install ..." it requires a password and a confirmation which is done by pressing 'y' ;
Do you think I'm doing the right thing ?
Is there a better solution to do this or I should keep looking for key press simulation ?


+ :
I tried searching using forum's search BUT I faced this message :

Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

Who is this administrator ?

4
Window / Re: Can't save and load ContextSettings and WindowHandle
« on: October 22, 2013, 01:49:19 am »
Thanks Ixrec !

I saved the window's properties one by one (size , position , title + settings) and it worked .

By the way , about that reference .

First I tried to send the object itself , but my "SaveCurrentState ()" caused a problem .
It opened a .hpp file : noncopyable.hpp
I searched in Google and I found  out a reference sign will solve the problem , so I used it .

I still don't know why .
The reason I asked it is that I'm looking for a simpler description of what the problem was and how it was solved .
Can you help me again ? Thanks !

5
Window / Can't save and load ContextSettings and WindowHandle
« on: October 22, 2013, 12:51:21 am »
HI !
I'm beginner and trying to write a simple app which creates a basic window based on properties the user enters .
Now I want to try to save the current state and load it later , thus I'm using a struct :
struct SLInfo
{
    sf::ContextSettings winMainSettings ; //winMain.getSettings ()
    sf::WindowHandle winMainSystemHandle ; //winMain.getSystemHandle ()
}

and a function to save :
int SaveCurrentState (sf::RenderWindow & winMain)
{
    SLInfo Info ;
    ofstream SaveFile ("some_file" , ios::binary) ;
    Info.winMainSettings = winMain.getSettings () ;
    Info.winMainSystemHandle = winMain.getSystemHandle () ;
    SaveFile.write (reinterpret_cast <char *> (& Info) , sizeof (Info)) ;
    return 1 ;
}
(is that refrence sign (&) before winMain correct?)
(Most of the code is omitted so that it looks simple and easier for you to check it)


and a function to load :
SLInfo LoadFile (string FileName)
{
    ifstream LoadLoc (FileName.c_str () , ios::binary) ;
    SLInfo Loader ;
    LoadLoc.read (reinterpret_cast <char *> (& Loader) , sizeof (Loader)) ;
    return Loader ;
}

Then in another function I open the window like this :
SLInfo winMainInfo ;
    string FileName ;
    cout << "\nEnter file name :\n" ;
    cin >> FileName ;
    winMainInfo = LoadFile (FileName.c_str ()) ;
    sf::RenderWindow winMain (winMainInfo.winMainSystemHandle , winMainInfo.winMainSettings) ;
(+ while window.isOpen () and event handlings , I omitted those parts too)

But when I run it (using Code::Blocks 12.11) I see these messages in console :
Failed to set pixel format for device context -- cannot creat OpenGL context
Failed to activate the window's context
Failed to activate the window's context
 
And I see no window at all .
Thanks in advanced for helping.
And if there is any additional info on my code needs to be provided let me know .
Thanks .

6
Graphics / I can't draw a sprite in RenderWindow
« on: October 19, 2013, 12:00:21 pm »
HI !
I am new to SFML .
I wanted to make a window and show a picture inside it .
I create the window correctly and the picture is loaded correctly , BUT I still can't display the sprite .
What I did is I created a RenderWindow and I tried to loadFromFile a sprite , BUT I saw an error indicating its not possible , so I loadeFromFileED a texture and setTextureED the sprite .
BUT I still can't observe the picture .
This is my code :
#include <SFML/graphics.hpp>
#include <iostream>

using std :: cout ;

int main ()
{
    sf::RenderWindow winMain (sf::VideoMode(800,600),"Test") ;
    sf::Texture winTexture ;
    if (!winTexture.loadFromFile("Untitled.jpg"))
    {
        cout << "ERROR opening Untitled.jpg" ;
    }
    sf::Sprite winSprite ;
    winSprite.setTexture(winTexture) ;
    winMain.display() ;
    while (winMain.isOpen())
    {
        sf::Event winEvent ;
        while (winMain.pollEvent(winEvent))
        {
            winMain.draw(winSprite) ;
            winTexture.update (winMain) ;
            switch (winEvent.type)
            {
            case sf::Event::Closed :
                winMain.close() ;
                break ;
            }
        }
    }
}
 
Thnaks !

7
System / cout operator << doesn't work for getElapsedTime ()
« on: October 02, 2013, 08:56:06 pm »
HI !
I'm new to sfml .
I was just testing time functions and I tried to use this :
cout << clock.getElapsedTime () ;
then i saw this error : "no match for operator << ..."

I tried this :
cout << (sf::Int64) clock.getElapsedTime () ;
BUT I got invalid cast error .

I'm wondering if there is any way to output elapsed time directly without converting it to sf::Time .
Thanks !

8
Thanks eXpl0it3r and Laurent !
You can't imagine how happy I am !
It's fixed , Thanks !

9
Laurent thanks BUT it didn't fix it , the same error appears .
and eXpl0it3r doesn't codeblocks use MinGW ?
I have a folder called MinGW in my CodeBlocks folder , so I didn't download TDM .
By the way I am downloading it and I will tell you about that .
Thanks !

10
HI!
I'm beginnger !
I have read the tutorial on setting up sfml (2.1) with CodeBlocks and I pasted the sample code (The one which draws a green circle with caption "IT WORKS") and CodeBlocks messaged : 0 errors , 0 warnings .
But when I ran the program I get this error :
"The program can't start because sfml-graphics-2.dll is missing from our computer."
So I copied all the .dll s in bin folder (from sfml) to debug folder of my project , in the same folder that the executable is created .

Then that error gone and a new one appears :
"The procedure entry point_gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll ."

I am using CodeBlocks 12.11 gcc 4.7.1 windows 32 bit .
THank YOU !

Pages: [1]