Thanks! I really appreciate the replies, and definitely understand it a bit more. Thanks. :)
Type: Posts; User: Justin H
Thanks! I really appreciate the replies, and definitely understand it a bit more. Thanks. :)
Tutorial: Using Resources
The above tutorial has some very nice explanations and I feel pretty good with the content it taught me; however, one thing I'm not too clear on is:
1) What are these...
Ah, can't believe I missed that. Thanks for the quick & helpful reply. :)
I've noticed when reading through some winAPI tutorials. May I ask why there's two * instead of just one?
Ah, thank you. I guess I just got a little confused on what I was wanting to do there.
Your example is actually what I wanted to do. Thanks.
I searched the internet for a method of doing this, and came across this neat little trick:
typedef void func(void);
func* f = (func*)0xdeadbeef;
f();
And I'm a little stuck here on...
function declaration
void gui::addMenuButton(int x, int y, string name, int parent = -1){
prototype
void addMenuButton(int x, int y, string name, int parent = -1);
Aha, never mind. I understand now. Can't believe I didn't figure that one out. >.<
It's:
gui.didClickButton(&sf::Mouse::getPosition());
Thanks. ^.^
Working method:
sf::Vector2i *position = &sf::Mouse::getPosition();
gui.didClickButton(position);
Now, that works just fine. But, why can't I just do:
I'm keeping a account of the # of buttons created in my program. And from several places that # is used to pull data from a vector, etc.
Is it more efficient to to increment an integer with the #...
Ah, makes complete sense.
Thanks. :)
Aha, thanks. This is a nice little feature. ;)
However, does this act just like a pointer? It's just not technically labeled as one?..
Yes, g is the object. It can be named whatever, so long as you refer to that same object name throughout the code.
e.g:
int main()
{
TicTacToe wowthisisanobject;
...
The first code you provided worked fine without any errors.
However, may I ask why you moved the address symbol (&)? (from the return statement to the function type information)
Thanks.
How would I return it normally is my main question. :confused:
void notepad::retrieveButtons(){
return &buttons;
}
vector<sf::Text> notepad::retrieveButtons(){
}
As you can see, I'm trying to let the computer know that the notepad class has a function retrieveButtons, and that the function will return a...
Thank you! Simple mistakes on my part. ^.^
Revised and working code:
#include <SFML/Graphics.hpp>
#include <iostream>
#include <string>
I feel as if I have correctly setup my pointer and addresses within te arguments, but that's more than likely where I'm going wrong.
Quick question: Do you need the text object to be a pointer in...
// vectors: overloading operators example
#include <iostream>
using namespace std;
class CVector {
public:
int x,y;
CVector () {};
CVector (int,int);
Ah, I guess that slipped away from me and I never really caught that.
Thanks for the reply. ;)
Thank you for the provided concept!
Worked perfectly.
After reviewing the below code for the past hour, I cannot seem to figure out this problem.
This is a basic WIP for a tic-tac-toe game (I'm new to C and thought this would be a decent little...
Woops...
printf("3 %c", (isEven(4)) ? 'Y' : 'N');
I'm using that to test the function:
int isEven(int x){
return !(x%2);
}
I have the very basic function below:
int isEven(int x){
return ((x%2) == 0) ? 1 : 0;
}
I was recommended to use something related to booleans to further improve this function,...
Yeah, I wasn't aware of all the string functions C had available. I'll definitely be looking into them. :)