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

Pages: 1 [2]
16
General / Re: Image Class Question
« on: January 07, 2013, 05:29:29 am »
I have not had any luck attempting to return a reference. I may be doing it wrong as my book does not explain references in this context, and it is a concept I have not completely grasped. Is there any good reference to this material?

17
General / Re: Image Class Question
« on: January 07, 2013, 05:05:37 am »
When I started using SFML I had no idea there was a working SFML 2.0, so I started with 1.6. I just found out while doing research that 2.0 was available, I just have not made the switch. I plan on making the switch to SFML 2.0 soon! By the way, thank you for your help!

18
General / Image Class Question
« on: January 07, 2013, 04:30:42 am »
class Graphics
{

    public:

        Graphics();

        ~Graphics();


        sf::Sprite GetSprite(){return spriteBJtable;}
        sf::Image GetImage(){return BJtable;}


                void loadBJtable(std::string file)
                {
                        BJtable.LoadFromFile(file);
                }

                void sprite_loadBJtable(sf::Image& pic)
                {
                        spriteBJtable.SetImage(pic);
                        spriteBJtable.Resize(800,600);
                }


    private:

        sf::Image BJtable;
        sf::Sprite spriteBJtable;

};


 

I have been trying to work out a class that will handle my graphics. The issue that the image and sprite are staying private despite my return. After search around, I have run into similar code and tried some other methods; however, I have been met with a wall here. I apologize if this is a dumb question, but I have just started learning classes, and the book does not show any other methods other than get and set. Any help would be greatly appreciated.   

19
Graphics / Re: Turn Based Game
« on: January 03, 2013, 10:24:19 am »
I have actually been using the boolean method to to show sprites at the correct time. Based on what you are saying, I think I need to take a new approach. My problem is this...

Code: [Select]
Initialize variables....

game loop {

(deal)
{
deal ()...
app.draw // the deal
}

(PlayerOne)
{
different actions...
app.draw //the actions
app.display
}
 

(PlayerTwo
{
different actions...
app.draw
app.display
}

if (n > 30) //n being the number of cards dealt out.
{
shuffle();
{
 } //end loop and go back to top

One of the actions Player One can make is splitting two cards of the same value. In order to split the cards, I need to move one of the app.draw's from the deal. The issue is that I cannot find a way to manipulate the card because it has already been drawn, and the loop will not get back til the next deal.

Thank you for the response by the way. I am in the process of switching back and forth from programming to digging into the book. I have much to learn about OOP.

I am currently using 1.6, but I will try out 2.0. I did not realize there was a release until after I was diving into 1.6.

Anyway, if you have any tips as to how I can approach this problem, that would be great! ;)

20
Graphics / Turn Based Game
« on: January 03, 2013, 08:05:27 am »
I am relatively new to c++ and SFML. For the purpose of practice, I figured I would try to complete a blackjack program. The approach I have taken is simply (deal, check-for-blackjacks-player one turn- player two turn, etc..) I have a basic game working; however, when attempting to add an option to split, I have come across a problem. I cannot change the position of the original dealt cards because I do not run the App.Draw for it until the game-loop resets.

Is there a way to delete a single sprite without redrawing? Or a way to hide it behind the background? Or something to get rid of it without needing to make the game one giant loop? any help would be... helpful ;) 

Pages: 1 [2]