Post not yet marked as solved
Post marked as unsolved with 1 replies, 428 views
Good morning,
I am very beginners student of openFrameworks. I'm following a tutorial trying to create a new class with openFrameworks but I cannot compile it in the right way. This because the tutorial I found in on Visual Studio and i'm working on a Mac with Xcode.
This problem is blocking me and I cannot go on with the course.
Can someone help me translate the code to create a new class from Visual Studio to Xcode? The language is the same, but the programme in this case is slightly different.
On Visual Studio the files are Class.H and Class.Cpp
THIS IS CLASS.H VISUAL STUDIO
#pragma once
#include "ofMain.h"
class ball {
public:
ball();
void setup (ofVec2f initialPos, ofVec2f initialVel, float rad);
void update ();
void draw();
ofVec2f pos;
ofVec2f vel;
ofVec2f radius;
};
CLASS.CPP VISUAL STUDIO
#include "ball.h"
ball :: ball();{
}
void ball :: setup(ofVec2f initialPos, ofVec2f initialVel, float rad); {
ofVec2f initialPos;
ofVec2f initialVel;
float rad;
}
//--------------------------------------------------------------
void ball::update()
{
pos += vel;
if ((pos.x > ofGetWidth ()) || (pos.x < 0)){
vel.x *= -1;
}
if ((pos.y > ofGetWidth ()) || (pos.y < 0)){
vel.y *= -1;
}
//--------------------------------------------------------------
void ball::draw(){
ofDrawCircle (pos.x, pos.y, radius);
}
On Xcode it is slightly different and I don't know how to translate it.
Here is the setting for the two XCode pages CLASS.H and CLASS.M
CLASS.H
//
// Default Classes.h
// default classes
//
// Created by Valerie Tameu on 23/08/23.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface Default_Classes : NSObject
@end
NS_ASSUME_NONNULL_END
and CLASS.m
//
// Default Classes.m
// default classes
//
// Created by Valerie Tameu on 23/08/23.
//
#import "Default Classes.h"
@implementation Default_Classes
@end
Somebody can help me to traslate the code of Visual Studio here in XCode?
Thank you for the help!