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 - Sohil Shrestha7

Pages: [1]
1
Window / window.dlib.obj missing
« on: May 18, 2013, 05:14:59 am »
1>LINK : fatal error LNK1104: cannot open file 'sfml-window-dlib.obj'
Help

2
Audio / Soundbuffer Error
« on: May 17, 2013, 08:18:29 pm »
An internal openAL call failed in soundbuffer.cpp.AL_INVALID_VALUE,anumeric arument is out of range..
MY program seems to work but it shows this error message in console..
Anything wrong with my coding>?
Please Help!!!

3
General / any function
« on: May 17, 2013, 03:20:07 pm »
any function to store keypressed.
as in character = sf::keyboard:: any specific key pressed

4
Graphics / Re: Blinking Window
« on: May 17, 2013, 02:17:35 pm »
@eXpl0it3r

i have created a simple menu... and i was trying to integrate the coded attached part of the program...
but this code seems to keep the screenn blinking. as if the two functions are being constantly called..
newbie...:(

5
Graphics / Re: Blinking Window
« on: May 17, 2013, 01:49:29 pm »
can anyone help me out here...!!!
i am newbie at this stuff..
i am sorry if i violated any of the forum rules..
i have to submit the project by tomorrow...
help me plz...!!!
the Window keeps blinking...
buffer issues or i dont know..:(

6
Graphics / Blinking Window
« on: May 17, 2013, 01:11:52 pm »
using SFML in visual studio 2012 ....
this code gives blinking window.
can anyone tell me how to fix it .. or fix it ..

#include<iostream>
#include<SFML\Graphics.hpp>
using namespace std;
sf::RenderWindow window (sf::VideoMode(800,600),"GAME");

char original[5]=" cat";
char repeated[27]={' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
int i=0;
int lengthcheck();
int repeatcheck(char a);
float positioncheck(char c);
int lengthcheck()
{
int length=1;
while(original[i]!='\0')
{

length+=1;
i=i+1;
}
return length;
}


float positioncheck(char c)
{
float temp=0;
for(int i=0;i<4;i++)
{
if (original[i]==c)
{
temp=(float)i;
return temp;
}
}
return 0;
}
void storerepeat(char a)
{
repeated[i]=a;
i=i+1;
}
int repeatcheck(char a)
{
for(int j=0;j<27;j++)
{
if(a== repeated[j])

return 1;
}
storerepeat(a);
return 0;
}
void gamef()
{
window.setKeyRepeatEnabled(false);
sf::Text charact;
char character=' ';
int returned=-1;
bool start=true;
sf::Event event;
while (start== true)
{
while(window.pollEvent(event))
{
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::C )
{

character='c';
returned=repeatcheck('c');

}

if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::A )
{
character='a';
returned=repeatcheck('a');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::B )
{
character='b';
returned=repeatcheck('b');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::D )
{
character='d';
returned=repeatcheck('d');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::E )
{
character='e';
returned=repeatcheck('e');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::F )
{
character='f';
returned=repeatcheck('f');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::G )
{
character='g';
returned=repeatcheck('g');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::H )
{
character='h';
returned=repeatcheck('h');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::I )
{      
character='i';
returned=repeatcheck('i');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::J )
{
character='j';
returned=repeatcheck('j');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::K )
{
character='k';
returned=repeatcheck('k');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::L )
{
character='l';
returned=repeatcheck('l');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::M )
{
character='m';
returned=repeatcheck('m');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::N)
{
character='n';
returned=repeatcheck('n');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::O )
{
character='o';
returned=repeatcheck('o');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::P )
{
character='p';
returned=repeatcheck('p');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::Q )
{
character='q';
returned=repeatcheck('q');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::R )
{
character='r';
returned=repeatcheck('r');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::S)
{
character='s';
returned=repeatcheck('s');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::T )
{
character='t';
returned=repeatcheck('t');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::U )
{
character='u';
returned=repeatcheck('u');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::V )
{
character='v';
returned=repeatcheck('v');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::W )
{
character='w';
returned=repeatcheck('w');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::X )
{
character='x';
returned=repeatcheck('x');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::Y )
{
character='y';
returned=repeatcheck('y');
}
if(event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::Z )
{
character='z';
returned=repeatcheck('z');
}

}
if (returned==1)
{
cout<<"repeated";
}
else if(returned==0)
{
float position=positioncheck(character);
cout<<position;
if(position!=0)
{
float posi=0;
posi=position*100;
charact.setString(character);
charact.setPosition(sf::Vector2f(posi,350));
window.draw(charact);
}      
}
returned=-1;
window.display();
}

window.close();
}


int main()
{
sf::RectangleShape underscore;
underscore.setPosition(100,400);
underscore.setSize(sf::Vector2f(50,5));
underscore.setFillColor(sf::Color::Blue);
float x=0;

int length=lengthcheck();
cout<<length;
for(int i=0;i<length;i++)
{

window.draw(underscore);
underscore.setPosition(100+x,400);
x=x+70;
}
gamef();


return 0;
}


THANKS IN ADVANCE

Pages: [1]