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

Pages: [1] 2
1
General / Flickering
« on: June 06, 2015, 04:43:37 am »
So I'm just getting back into SFML...This program is meant to display the message as I hold down the backspace button. But it's flickering badly, why is this?
Code: [Select]
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Window/Event.hpp>
int main()
{
sf::RenderWindow win(sf::VideoMode(500, 500), "Refresher", sf::Style::Default);
sf::Text wb;
sf::Font font;
font.loadFromFile("C:\\Windows\\Fonts\\Arial.ttf");
win.setVerticalSyncEnabled(true);
wb.setColor(sf::Color::Blue);
wb.setString("Welcome Back to SFML!");
wb.setCharacterSize(20);
wb.setStyle(sf::Text::Bold);
wb.setFont(font);
wb.setOrigin(wb.getLocalBounds().width / 2.0f, wb.getLocalBounds().height / 2.0f);
wb.setPosition(win.getSize().x / 2.0f, win.getSize().y / 2.0f);
while (win.isOpen())
{
sf::Event e;
win.clear();
while (win.pollEvent(e))
{
switch (e.type)
{
case sf::Event::Closed:
{
win.close();
}break;
case sf::Event::KeyPressed:
{
switch (e.key.code)
{
case sf::Keyboard::BackSpace:
{
win.draw(wb);
}break;
}
}break;
}
}
win.display();
}
return 0;
}

2
General / Coding a text box
« on: December 13, 2014, 08:34:09 am »
Hey everyone,
I'd love it if someone could help me develop a text box.
What i'm currently doing is using sf::isKeyPressed() and using sf::Clock. I append the key to a string every time a  key press is detected but not allow it to happen unless a certain amount of milliseconds has passed between the previous key press detection.
But things aren't working out as expected. Sometimes too many keys are pressed at once or sometimes none are detected at all. I need it to function like a normal keyboard.
I'm not doing this in my main class either i'm doing it in another class in the background while my normal event loop is running.

3
General / Static Linking
« on: December 07, 2014, 08:26:20 am »
I followed the full directions on the site after my normal procedure of linking the libraries.
I declared SFML_STATIC in preprocessors and then linked everything like sfml-graphics-s-d.lib[/url]
but It's giving me this:

I'm using a build of SFML from NightlyBuilds for Visual Studio 2013.
Everything works when I don't build it statically. This is my first static build.

4
General / Bullet positioning (updated)
« on: November 29, 2014, 09:25:45 am »
Let's say I have a character and I rotate it.
How do I determine where to exactly spawn the bullet?
update:(comments)

5
General / Simple Questions
« on: November 24, 2014, 08:50:56 am »
Hello, I thought that instead of making a new thread each time I'd just ask my simple questions on this thread and wait to see if someone checks it and answers it.
So for any future questions, I'll post it here.
Any ways,
What's the difference between getlocalbounds and getglobalbounds?
I really want to get a full understanding in the simplest terms possible.

6
General / SFML for VS2013?
« on: November 21, 2014, 06:09:15 am »
Could someone please help me find the library for VS2013's compiler please? Thanks I'd appreciate it.

7
General / Switching SFML source code from C::B to VS
« on: October 24, 2014, 06:13:51 am »
I've decided to stop using Code::Blocks and switch to Visual Studio.
So I've made a duplicate project in visual studio. I have all the file names in VS, etc.
So I just pasted all my code into the other IDE (in the proper places)
Then I linked/included everything, and put the dependencies in the right places. But I get this when I try to run it (as release).
Then shortly after I try to close it and I get come error saying it's crashed, then get an "Access denied" when it tries to close the .exe
But It works perfectly on Code::Blocks, could you guys help me figure out my problem?

Then this is what it shows when I try to compile as debug.

8
General / Debugging SFML projects
« on: October 11, 2014, 11:10:36 pm »
I need help, I keep trying to debug my project and it never works.
Everytime I use SFML I just always compile as release and if theres a big i just keep scanning through the code and opening the program up again.
But I got tired and decided to try debugging again, I linked
Code: [Select]
sfml-graphics-d
sfml-window-d
sfml-system-d
Normally I link the above, all without a D but I removed those and added ones with a D.
I added the dll files to the debug folder as-well.
But when I add a breakpoint nothing happens, the program never pauses or anything.
Please help, it still acts like a release even though i changed it to debug at the top.

9
General / Spawning some bullets
« on: September 09, 2014, 05:34:23 am »
So I have an idea on how I want to spawn bullets for this space-shooter I'm making. But the problem is, I have an option to rotate the shooter (setRotation + or -), and there's a specific bullet hole where the bullets are supposed to come out of.
I'm having trouble figuring out how to trace that bullet hole and set the bullet's position to that same spot even when the sprite rotates.
Can you guys please help me?

10
General discussions / SFML tutorial video
« on: August 29, 2014, 06:12:38 pm »
I made this vid, tell me what you think.


I thought id share it. Ik I shouldce gone over sf::Text though

11
General / isKeyPressed() vs event checking
« on: August 16, 2014, 10:04:31 pm »
Which do you guys think is better? Checking to see if the user has pressed a key in your event loop, or just calling isKeyPressed() in your main loop? Are there any performance benefits to either, besides being able to check if 2 keys are pressed at once?

12
General / I have a game in mind but...
« on: August 11, 2014, 07:37:45 pm »
I have a game I want to make, in mind.
But I have a few questions.
1. How does one make a game where the character would walk and the map would move as he walks?  (Basically like a top/bottom and side-scroller combined)
2. How does a sprite get affected if I make the sprite a certain size and intend it for full-screen, but then I decide to add a feature that allows the user to resize the window?

13
SFML projects / Westiny
« on: August 06, 2014, 09:47:25 pm »
Here's a game I codes in sfml 2.1, its called Westiny.
Idk if I will continue the development though,  I have a new idea in mind
http://www.ww3.xyz/Westiny/

14
General / How to make a tiled program less laggy
« on: July 30, 2014, 05:23:06 am »
So I'm fairly new to SFML, I have a new game in development which is almost complete.
It's sort of laggy though, it has a big tilemap and theres a character ontop of the tiles that move around.

It's sort of like this

int main()
{
       while(window.isopen())
       {
               while(pollevent)
                 {
                         CHECK_IF_HOLDING_KEY_AND_MOVE_CHAR_POSITION_IN_DIRECTION();
                 }
         DRAW_AND_DISPLAY_CHARACTER_AND_ALL_TILES();
         }
}
 

It's sort of skippy.       

15
Graphics / Displaying text in center of screen
« on: July 22, 2014, 08:22:21 am »
To try and display text in the center of the screen I do
text.setPosition(screen_width/2.0f,screen_height/2.0f);
 

But it displays the text somewhere close to the bottom left of the screen. Anyone know why? I looked on google,  I didn't understand much because mostly people were using getLocalBounds() and setOrigin(), what's the difference between that and setPosition();?

Pages: [1] 2
anything