Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 13 posts ] 
Amy
  Fri Jan 21, 2011 11:28 pm
User avatar
Administrator
I realised we don't have a thread like this so I am starting one.

Post here any tiny problems that you're still working out that you don't feel warrant a whole thread. Got a syntax error somewhere and can't locate it? Etc.

_________________
Image | Game of the Year 2012. Please vote: viewtopic.php?f=2&t=77338


Top Top
 Profile  
 

udivision
  Sat Jan 22, 2011 12:22 am
User avatar
Member
Does FileTest.exist?() always return false when the file specified is located in the Game.rgssad?


Top Top
 Profile  
 

Amy
  Thu Mar 24, 2011 4:49 pm
User avatar
Administrator
So uh...

Imagine I have, in C++,


class Game
{
public:
Player *player;
};


*player is a pointer to a Player.


I want to reference Player in a function,


void Game::keyHandler(int key)
{
player->Sprite->Rotate(4); // expression must have a pointer to class type
*player->Sprite->Rotate(4); // expression must have a pointer to class type
player.Sprite->Rotate(4); // expression must have a class type
Game::player->Sprite->Rotate(4); // expression must have a pointer to class type
}



What should I be doing?

_________________
Image | Game of the Year 2012. Please vote: viewtopic.php?f=2&t=77338


Top Top
 Profile  
 

DeM0nFiRe
  Thu Mar 24, 2011 5:38 pm
Member
You should be using just player->function() or player->member

My guess is that Sprite is not a pointer and that is why it's complaining on that line. If you post your Player class I should be able to show you where.

_________________
_          )         &          ^    ( ^%       +     +  *   + ^ $      )    %
+ * % %$( ( % ( *
) ಠ_ಠ ^ % (
) # $ ) ) #
^ $ & % $ ( # @*
# ) * % ) $


Top Top
 Profile  
 

Amy
  Thu Mar 24, 2011 5:47 pm
User avatar
Administrator
In player I have:

class Player : Character
{
public:
sf::Sprite *Sprite;
};


sf::Sprite has a function Rotate(int angle);.

_________________
Image | Game of the Year 2012. Please vote: viewtopic.php?f=2&t=77338


Top Top
 Profile  
 

DeM0nFiRe
  Thu Mar 24, 2011 9:45 pm
Member
Hmm, that's odd. At first glance, it looks like the first thing you did should work. I will try some stuff, but codepad.org is down right now. For reference, something like codepad.org is a good place to go so that you can isolate some simple code to represent one thing that you suspect may be causing an issue.

As a side note, I recommend you do not name something the same as the class. Naming it sprite or m_sprite or something like that is better. The namespace means that you can do it, however, namespaces aren't meant for you to intentionally name things the same. Instead, it is so that when you are using multiple libraries, they may have the same name since a lot of different libraries will use the same name for different things. (for example std::vector is a dynamic array, but in other libraries, a vector may represent a math vector)

_________________
_          )         &          ^    ( ^%       +     +  *   + ^ $      )    %
+ * % %$( ( % ( *
) ಠ_ಠ ^ % (
) # $ ) ) #
^ $ & % $ ( # @*
# ) * % ) $


Top Top
 Profile  
 

DeM0nFiRe
  Fri Mar 25, 2011 12:27 am
Member
Ok, so with the information you've given us, I did this on codepad:

http://codepad.org/uSIt6Bga

So that code works as expected, so that tells me that the code you posted here isn't quite equivalent to what you actually have. Perhaps if you post the full classes, we can find what's going on.

_________________
_          )         &          ^    ( ^%       +     +  *   + ^ $      )    %
+ * % %$( ( % ( *
) ಠ_ಠ ^ % (
) # $ ) ) #
^ $ & % $ ( # @*
# ) * % ) $


Top Top
 Profile  
 

Zeriab
  Sun Mar 27, 2011 10:41 am
Hugging Lion
User avatar
Sponsor
udivision wrote:
Does FileTest.exist?() always return false when the file specified is located in the Game.rgssad?

FileTest.exist? checks for existence in the normal file system. If the file you check for also happens to be present in the file system it will return true.
For resources located in the .rgssad you can try to load them using Bitmap.new or load_data and catch the exceptions raised when they are not present. Not pretty, but it seems the best you can do short of decrypting the .rgssad.

*hugs*

_________________
Image
Image
Image
Image
Image


Top Top
 Profile  
 

Amy
  Wed Apr 13, 2011 4:10 pm
User avatar
Administrator
Anyone know where I've gone wrong here? "Not a valid mysql resource" on the second line.

$result = mysql_query("SELECT * FROM `error_logs`");
while ($row = mysql_fetch_array($result))
{
}

_________________
Image | Game of the Year 2012. Please vote: viewtopic.php?f=2&t=77338


Top Top
 Profile  
 

Drago del Fato
  Wed Apr 13, 2011 10:49 pm
Dark Slayer
User avatar
Member

Location: Somewhere with a heater on...
Well first it could be that you didn't enter table name correctly, check if it really is error_logs and not error_log or err_log or something.

Second thing which might be a problem are the `` between table name but usually that shouldn't be the case. Try removing those, so in the end you'll have:

Expand to see the code.


I always simply use SELECT * FROM table_name without ``, the only time I use them is when creating the table, and it works for me. :)

EDIT:
Also the second row has a bit of problem, you see that it will always call mysql_fetch_array (even when there is actually no table data to read?)

I would do it this way.

Expand to see the code.

_________________
Visit my little scripts corner here. :)


Top Top
 Profile  
 

Brewmeister
  Wed Apr 13, 2011 11:11 pm
Paste above Main
User avatar

Location: 42.682152 N 82.970488 W
Only thing that looks odd is the single quotes on error_logs

_________________
"Of course that's just my opinion. I could be wrong!"


Image


Top Top
 Profile  
 

Amy
  Wed Apr 04, 2012 12:34 pm
User avatar
Administrator
Content Hidden


Sorry, irrelevant now, I have found a better library to use.

_________________
Image | Game of the Year 2012. Please vote: viewtopic.php?f=2&t=77338


Top Top
 Profile  
 

kaBOOM
  Tue Aug 14, 2012 11:29 am
0_0
User avatar
Member
Wyatt wrote:
So uh...

What should I be doing?


is Sprite a sf::Sprite?
Also what version are you using? because in 2.0 rotate() is with lower case letter.
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Sprite.php

_________________
Image


Top Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 


Who is online

Users browsing this forum: No users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Hosted By: