samedi 16 novembre 2013

C++ pthread Error on Eclipse.

So here it is the path to configure the library that I was missing for my code to compile. Basic but if you don't know can be annoying.

right cklick on the project in the

project explorer -> properties -> c/c++ build

ONCE  you are in the  C/C++ Build settings. you proceed like this:

c/c++ build -> Settings -> linker -> libraries -> add -> pthread ->

once you add the library  you click OK and Rebuild

ok -> rebuild

That should do the trick for: pthread_create and the such.

mercredi 13 mars 2013

new Iphone Game

       So to put up a code with an example of what I'm trying to achieve today is my new game..  whozapp with initially is going to make a game based on images that you have to guess.   

  Here is the code for the "viewcontroller.h"   

@interface ViewController : UIViewController{
    NSString *Answerstring;

//declaring the properties.

@property (weak, nonatomic) IBOutlet UITextField *AnswerText;

@property (weak, nonatomic) IBOutlet UIButton *AnswerButton;

@property (weak, nonatomic) IBOutlet UILabel *Answerlabel;

// need to declare the IBaction for the control we are passing the event.
- (IBAction)AnswerButtonClicked:(id)sender;

//declaring properties for the sports Category


and the  code for the viewcontroller.m :

 (IBAction)AnswerButtonClicked:(id)sender {
    [AnswerText resignFirstResponder];

    Answerstring = AnswerText.text;
    //userTwoString = user2.text;
    if([Answerstring isEqual:@"George Bush"] ||  [Answerstring isEqual:@"George W. Bush"] ||
       [Answerstring isEqual:@"Bush"]        || [Answerstring isEqual:@"George"] ){
        Answerlabel.text = @"You are correct, continue!";
        Answerlabel.textColor = [UIColor whiteColor ];
        //Answerlabel.backgroundColor = [UIColor blueColor];
        Answerlabel.text = @"Sorry Incorrect, hint:former President of USA ";
        Answerlabel.textColor = [UIColor whiteColor ];
        Answerlabel.backgroundColor = [UIColor magentaColor];

is we see here is just validating the data with a plain, vulgar text on the condition but we are going to put this on a enum so we can have a cleaner elegant code.