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

Pages: 1 ... 11 12 [13] 14
181
Graphics / Re: Sprite can move diagonally [C++]
« on: May 29, 2015, 07:08:38 pm »
This has nothing to do with precision

The precision is very important too. (I'm not disparaging the update rate, is important too).

When you play , Sport Games , Shooters Games , Car games ... the precision is VERY important.
In RPG not so much but in harcore games without precision finish them will be IMPOSSIBLE.

SFML have several key events options/triggers , it's up to the programmers use what she/he consider.


182
Graphics / Re: Sprite can move diagonally [C++]
« on: May 29, 2015, 06:18:59 pm »

This was to show you that "Key is currently down" would appear more than "Key pressed event" does.


Yes, all will depend on the precision that the programmers wants.

183
Graphics / Re: Sprite can move diagonally [C++]
« on: May 29, 2015, 05:36:33 pm »

//within the game loop, where renderWindow = your render window.
sf::Event evt;
while(renderWindow.pollEvents(evt)){
        if((evt.type == sf::Event::KeyPressed) && (evt.key.code == sf::Keyboard::W)){
                std::cout << "Key pressed event" << std::endl;
                //the CLI window should only say "Key Pressed Event" when the event is triggered, not while the key is down.
        }
}

if(sf::Keyboard::isKeyPressed(sf::Keyboard::W)){
        std::cout << "Key is currently down" << std::endl;
        //the CLI window should only say "Key is currently down" while the key is currently being pressed.
}

I already test your code and when i press the "W" key the console print "Key is currently down" each frame while the key is down. (i only press W one and left it pressed)

Test code:


#include <iostream>
#include <sstream>
#include <SFML/Graphics.hpp>

int main()
{

   RenderWindow window( VideoMode( 600 , 600 ) , "mywindow" ) ;


    while( window.isOpen() )
    {
        Event e ;

       while( window.pollEvent( e ) )
       {

            switch( e.type )
            {
                case Event::Closed :
                     window.close() ;
            }
            if((e.type == sf::Event::KeyPressed) && (e.key.code == sf::Keyboard::W)){
                std::cout << "Key pressed event" << std::endl;
                //the CLI window should only say "Key Pressed Event" when the event is triggered, not while the      key is down.
            }

       }

        window.clear() ;
        window.display() ;

    }

        return 0;
}

 

See the attachment.

184
Graphics / Re: Sprite can move diagonally [C++]
« on: May 29, 2015, 04:31:01 pm »

For example, at 60FPS, the sprite will move 60 pixels in 1 second. With the event handling method, it depends on the system configuration (time prior to start key repeating, or the key repeating event in general).

Yes, but you can use to the mathematics for the fast moving.

You want to move 5 pixels per frame. you do this:

float move = 5/60. Simply

And when the keys are released the sprite won't move. becuase the "move code" will be inside the "cases"

185
Graphics / Re: Loop a sprite's movement?
« on: May 29, 2015, 04:12:54 pm »
You can use for better coordinates :

Ex:

// outside the game loop :
int max_left = 0
int max_right = 600 /* (supposing that youw window have 600 width ... you can change the size in the
resize // event */

float move = 1 ;  

// inside the game loop :

floatRect spr_pos = targ.getPosition()

if ( spr_pos.x >= max_right )
{  
    move = -1
}
else if (  spr_pos.x <= max_left )
{
   move = 1
}
targ.move( move , 0 )
 

186
Graphics / Re: Sprite can move diagonally [C++]
« on: May 29, 2015, 03:53:02 pm »
you can use too :

// outside the loop

const int _left = 0 ;// (a)
const int _right = 3 ;// (d)  
const int _up = 22 ;// (w)
const int _down = 18 ;// (s)
// inside the game loop
if( event.type == Event::KeyPressed )
{
        switch( event.key.code )
       {
               case _right :
                    //code  
                   break ;
               case _left :
                    //code  
                   break ;
               case _up :
                    //code  
                   break ;
               case _down :
                    //code  
                   break ;
       }

}
 

with this you will evade the diagonal movement .

187
SFML projects / Re: One Chance
« on: May 28, 2015, 06:45:25 pm »
I was playing the game..so difficult..i was in the easy "phase"...  :-\ :-\

But great sound and great AI.

188
General / Re: Multiple objects from same class?
« on: May 28, 2015, 06:33:34 pm »
You can use virtual functions , or overloaded functions too, inclusive you can embed a script language such lua , python , ruby for the AI.. etc..

If the part of class/templates of c++ you don't know so well , buy a book (more recommendable) or google for tutorials.

http://www.cplusplus.com/files/tutorial.pdf
http://www.cprogramming.com/tutorial/c++-tutorial.html
http://www.cprogramming.com/tutorial/c++-tutorial.html


189
General / Re: SFML won't build on Code::Blocks
« on: May 28, 2015, 05:44:44 pm »
Quote
I am running 64 bit Windows 7  and using Code::Blocks 13.12 with the default TDM-GCC 4.7.1 compiler and SFML 2.3 (64 bit SLJL).
Almost all Windows apps are compiled in 32 bits. The compiler you're using is also in 32 bits. So you'll need to download the 32 bits version of SFML.


Yes , you need the 32 bit version of sfml.

I have win8 x64 using your same code::blocks version with sfml 2.2 (x32) with dynamic dll.

190
General / Re: Application crashes on another computer
« on: May 27, 2015, 08:19:24 pm »
Yes, he had to download more dlls, and yes, he has 64 bit, I have 32. Is that a source of the problem?
Must I build another dlls for x64 system?

32bits is compatible with 64.

remember that you need to pack the minGW .dll with executable ( for the version alongside with codeblocks are more o less  10 dll )

Mi pc is x64 but i use x32 compiler my path for the dlls of minGW is: C:\Program Files (x86)\CodeBlocks\MinGW\bin 

191
SFML projects / Re: Game on Kickstarter 28 May!
« on: May 27, 2015, 04:22:10 pm »
Hahaha! Great and funny cutscene, well done game, need some shaders for lights effects, you can use too LTBL2

192
SFML projects / Re: Kronos - Action, RPG, Roguelike
« on: May 27, 2015, 04:16:30 pm »
Great work, smoot animations, puzzles , well-designed assets.

Waiting for the release.  ;D

193
What did you use to build the C++ benchmark? Tried Clang?

No ,i haven't tried.
Is better than GCC ? .

I use the GCC alongside code::blocks ( its the 4.7.1 i think ) , i also use the SFML 2.2 ( SJLJ ) version if my memory don't fail.

But in both case the rendering work is done by the c++ , lua only store the pointers and then pass it to the main loop for the rendering/drawing.

In my engine the "hard" and "dirty" part is done by c++,  lua give c++ the pointers and c++ give the events from the pollevent to lua, and then lua handle it.

194
General / Re: Application crashes on another computer
« on: May 26, 2015, 09:14:57 pm »
Hello, I have some problems with compiled application...
I have built sfml 2.3 with mingw make, because applications were crashing...
Anyway, now it works on my computer, but when I send to my friend application with these 5 built dlls, he has error: 0x000007b

I dont know what to do  :-\
Is something wrong with version of compiler and dlls?
Our OS is win7
(Sorry for my english)

Check is the program say "something.dll" is missing , and then pack the .dll with the program.
Is the version x64 and your friend's computer x32 ?

Try it in another PC.

(I speak spanish (if you too) , you can contact me for PM ).


195
The problem is, without code your benchmark doesn't really express anything (we don't know exactly what you did and how you did it). Furthermore, it can't be repeated by others. In short, it's no proof.

But you don't need to publish all files now, you can also wait until your engine is finished, when it's easier to put the benchmark together :)

Great, i have implemented RAII in the past..but i have a obsessed to know ALL , how it's work, why?, why it was created? I learn some assembly for understand better the low-levels concepts. But more deeper you get in C++ more you have too learn and it's difficult to see all the source files of c++, things that i do because i like programming. But i have social live too..   ::)


Pages: 1 ... 11 12 [13] 14