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

Pages: [1] 2 3
1
General / scale and resolution question
« on: December 15, 2015, 06:16:44 am »
So, I have made a button class where my "button" has dimensions and if the mouse is clicked within those dimensions then it activates it, but each button has its own sprite and when I change the resolution I think it will break because I need all the sprites to stay the same size relative to the resolution of the window and I need some way to change the dimensions for each button so they stay with the dimensions of the sprites texture when the window resolution is changed,  I'm very confused
if you need any snippets of my code please just ask, but I dont even know what I should post because im just plum stuck.

2
SFML projects / Re: It Always Ends In Nuclear War
« on: November 09, 2015, 05:02:04 am »
DUDE!, looks cool man. I have a question for you, how are you loading your maps? I'm curious because I'm working on an RTS that needs a good efficient way to load some maps, and google doesn't help, but you seam to have it down.

3
Graphics / Re: [Solved]Namespace to load in textures
« on: September 14, 2015, 05:17:56 am »
I found this out by going to a Twitch.Tv livetsream and asking some one, I forgot to reference it with &

4
Graphics / [Solved]Namespace to load in textures
« on: September 14, 2015, 01:47:54 am »
Hi, I'm trying to make a namespace that can load in textures, I have made it load in sf::music, but I can't make it load in textures because it gives me an error saying no suitable conversion from sf::texture to const sf::texture exists here is my code:
//other namespace stuff
namespace Resource {
 static void loadTextureFromFile(sf::Texture& Texture, std::string FileName){
        if (!Texture.loadFromFile(FileName)){
            std::cout << "ERROR could not load " << FileName << std::endl;
        }
        else{
            std::cout << "Loaded" << FileName << std::endl;
        }
    }
//other namespace stuff
}
sf::RectangleShape MShape;
    Resource::loadTextureFromFile(MenuBackGround, "Background.jpg");
    MShape.setTexture(MenuBackGround);//error line
 
 
thanks in advance!!!

5
Audio / Re: Trouble with a load music function
« on: September 13, 2015, 02:13:51 am »
ok, thx again, and I'm assuming by method you mean function?
1 more thing, I planned on doing this with sf Textures, and sf sounds, would it work more or less the same way?

6
Audio / Re: Trouble with a load music function
« on: September 13, 2015, 02:08:18 am »
ok, thx and where would I put the code to make the namespace? just in the main()? the reason I ask is because I want a really clean main function.

7
Audio / Re: Trouble with a load music function
« on: September 13, 2015, 02:00:56 am »
1, thank you for the quick reply, what do you mean make a namespace? I have never heard of doing such a thing, and I wouldn't know how to implement it. and also how would i reference sf music? with a pointer&?

8
Audio / Trouble with a load music function
« on: September 13, 2015, 01:39:45 am »
I'm having some trouble in my class of loading music.
I'm trying to make a function so I can load in Music simply by calling a function and tossing in some perameters, here is what I have so far:
Load.h
#pragma onc
#include <string>
class Load
{
public:
        void LoadMusic(sf::Music MusicLoaded, std::string FileName);
};
 
Load.cpp
#include <SFML/Audio.hpp>
#include "Load.h"
#include <string>
#include <iostream>
void LoadMusic(sf::Music MusicLoaded, std::string FileName){
        if (!MusicLoaded.openFromFile(FileName)){
                std::cout << "ERROR could not load " << FileName << std::endl;
        }
        else{
                std::cout << "Loaded" << FileName << std::endl;
        }
}
 
main()
//unimportant junk
sf::Music MenuMusic;
Load LoadOBJ;
        LoadOBJ.LoadMusic(MenuMusic, "Resources/MenuMusic");
//unimportant junk
 
I tried to show as little code as possible, also this is only my second time ever working with classes.
errors:
 \include\sfml\audio\inputsoundfile.hpp(203): error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'
sfml-2.3.1\include\sfml\system\noncopyable.hpp(67) : see declaration of 'sf::NonCopyable::NonCopyable'
sfml-2.3.1\include\sfml\system\noncopyable.hpp(42) : see declaration of 'sf::NonCopyable'
1>          This diagnostic occurred in the compiler generated function 'sf::InputSoundFile::InputSoundFile(const sf::InputSoundFile &)'
sfml-2.3.1\include\sfml\system\mutex.hpp(89): error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'
sfml-2.3.1\include\sfml\system\noncopyable.hpp(67) : see declaration of 'sf::NonCopyable::NonCopyable'
sfml-2.3.1\include\sfml\system\noncopyable.hpp(42) : see declaration of 'sf::NonCopyable'
1>          This diagnostic occurred in the compiler generated function 'sf::Mutex::Mutex(const sf::Mutex &)'

(I removed My Computer Name, and the name of the project from the error's as it is unimportant)
Thx in advance Y'all!!!

9
General / Re: sf::clock getting reset
« on: September 07, 2015, 11:42:33 pm »
I feel really dumb right now, nothing I do works, and I can't think of anything to make it work, you example doesn't work, it gives me a whole list of errors, and when I tried to fix them I got even more errors, I will explain my problem in a lot of depth, I want to move my character(done), and then after 2 seconds of him being in his new location to go back to the original location(750, 200), but the thing is he can be in two possible locations,(750, 200 move 10, 0)or(750, 200 move -10, 0) so basically left or right, what currently happens with my code is he does not ever move, if I take out the reset, and if I put in the reset it just moves wherever without going back to original location

10
General / Re: sf::clock getting reset
« on: September 07, 2015, 11:23:07 pm »
Nexus, I'm trying to understand what he is saying, but I understand code better than English my native language, and I'm not trying to be rude, It just sort of happens, I'm very thankful that he is even taking the time to help me, and I don't want copy and paste code, because if I do, then I'm not able to repeat the process later because I don't know what I'm doing, and also plagiarizing other's code




11
General / Re: sf::clock getting reset
« on: September 07, 2015, 11:02:18 pm »
that is really confusing how you said it, could you add a bit of code so I know what you are saying?

12
General / Re: sf::clock getting reset
« on: September 07, 2015, 10:54:57 pm »
I'm moving my character, and then I call this function to set him back at his place after a certain amount of time has passed.

13
General / Re: sf::clock getting reset
« on: September 07, 2015, 10:40:30 pm »
that didn't help

14
General / Re: display variables
« on: September 07, 2015, 09:52:03 pm »
You are resetting the timer every time ResetPosition() is called. So if it is called more than once every second the value that restart() returns will always be less than a second.
Also. You are not modifying "elapsed" so it will never change its value.
I made a new topic over this

15
General / sf::clock getting reset
« on: September 07, 2015, 09:49:09 pm »
how else could I do this without having to restart everytime the function is called?, I'm trying to reset the players position after a certain amount of time
sf::Clock Timer;
sf::Time elapsed;
sf::Time elapsed = Timer.getElapsedTime();
void ResetPosition(){
    Timer.restart();
    if (elapsed.asSeconds() >= 1){
        Player.setPosition(750, 200);
    }
 

Pages: [1] 2 3
anything