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.


Topics - Micboy

Pages: [1] 2
1
App Store / Question for Tim
« on: May 28, 2015, 05:39:44 pm »
Hiya Tim, not sure if you're receiving my mail.

Was wondering if there's still support available as I haven't had replies yet.

Also, is the app upload service still available? As it seems DFSDK is a dead service now  :'(

Thanks,
Michael

2
How Do I...? / Changing between Landscape and Portrait mode
« on: February 27, 2014, 11:25:22 am »
Hiya,

I tried to test changing the orientation of the device manually by using this simple code but it doesn't work on the iPod, only in the simulator.

Does the iPod not support this? i.e. Init Portrait Mode, press a button, switch to Landscape Mode, press a button, switch back, etc...

Code: [Select]
#include "DragonFireSDK.h"

int LogoImage;
int LogoView;

int Value;

int OnTouch(int id, int event, int x, int y)
{

  if (event==3)
  {
Value = (Value+1)%2;

if (Value==0) PortraitMode();
else LandscapeMode();

  }
  return Value;
}

void AppMain()
{
// Application initialization code goes here.  Create the items / objects / etc.
// that your app will need while it is running.
LogoImage=ImageAdd("Images/Logo.png"); // file location: Debug/Assets/Images/Logo.png
LogoView=ViewAdd(LogoImage,90,100);

Value = 0;
PortraitMode();

TouchAdd(0,0,480,480,OnTouch, 1);

}

void AppExit()
{
// Application exit code goes here.  Perform any clean up your app might
// need to do in the event of interruption by a phone call or the user
// pressing the Home button, or some other event that would cause your
// application to terminate.
}

void OnTimer()
{
    // Main loop code goes here.  OnTimer() is called 30 times per second.
}

Is there another option? e.g. using Autorotateinit

Thanks,

Mikey

3
Game Programming / Scrolling....again
« on: July 21, 2013, 01:05:46 pm »
Hi guys,

It's been a while since I last posted, but for you that's probably a good thing =P

I recently stalled when I couldnt identify the bug in the program.

So I'm using the scrolling code in http://dragonfiresdk.net/forum/index.php?topic=360.0 and I have introduced 2 scrolling surfaces in 2 different containers. One of then is a horizontal scrolling object and the other is a vertical scrolling object. However, the problems arises when the 2nd scrolling object doesnt flow - it moves as far as the finger does, even if I try to swipe it.

Am I missing something?

Thank you in advance!

Micboy

4
Game Programming / Anyone have pause icons?
« on: January 26, 2013, 02:14:03 pm »
Hello,

I was trying to find some pause icons on google but they don't have the pressed versions!

Would anyone be kind enough to send me their pause (released and pressed) versions?

I would be very grateful (My graphic skills are dreadful - I cant seem to draw the pressed verisons),

Thank you
Micboy

5
Hi everyone,

I read in a different post that in the iphone simulator, placing a container over a button will allow the button to be pressed, but when built on the iphone, this is not possible.

Using this concept, should I place a lock image in a container over the button? (I want the button to still be visible, just not able to be pressed)

Thank you in advance,
Micboy

6
Game Programming / Showing coutdown? using getms?
« on: January 23, 2013, 02:41:02 pm »
Hello,

So Im just wondering: TimerGetMs();
Returns the number of milliseconds elapsed since some point of time in the past, but from which point?

So if I were to design a countdown, should I call TimerGetMsExpired(); twice, then call printf("Milliseconds since last call: %d\n",ms); to print this value on screen. Or should I use textAdd()?
Should I then have an alert box which prevents player from continuing with game?

Thank you for the help!
Micboy

7
Game Programming / Saving in-game data
« on: January 19, 2013, 02:29:23 pm »
Is there an easier way compared to using 'File Open' etc e.g. writing code in appexit()?

Also, what would one write in appexit()? (generally)

Thank you for taking your time to read this post!

8
Build Center / I have a 1st Gen ipod touch...
« on: January 17, 2013, 01:42:42 pm »
Is it possible to build apps on a 1st gen ipod touch??? Thank you for your input!

9
Hi,

I have read: http://dragonfiresdk.net/forum/index.php?topic=360.0
but it seems rather complicated! Is there an easier method? Without elasticity and friction?

For example, could I do something like:
Code: [Select]
int OnDrag(int id,int event,int x,int y)
{
// Record initial coordinates when pressed down
if (event == 1)
{
nOldX = x;

}

// Record new coordinates when moving
if (event == 2)
{
               nNewX = x;
}
}

return id;
}

then set new position of container?
Thank you in advance,

Micboy

10
I seem to be unable to resolve this! Could someone help me please!
The error is:
error C2665: 'ButtonAdd' : none of the 2 overloads could convert all the argument types

The code is:
Code: [Select]
        //Already initialised cn1, SP_Button, and OnMenu(int id, int evt)
cn1 = ContainerAdd(0, 0, 0); //ContainerAdd(cn, x ,y)
MenuView[0] = ViewAdd(cn1,"Images/Menu1.png", 0,0);
SP_Button = ButtonAdd(cn1, "Images/Single_Player.png" ,60 ,260, OnMenu1, 1);

int ButtonAdd(int cn,char *filename, int x, int y, int (*callback)(int id), int id);

I'm trying to figure out whats wrong, but cant seem to identify the problem!
Thank you in advance,

Micboy


PS, the full error is:
error C2665: 'ButtonAdd' : none of the 2 overloads could convert all the argument types
1>          dfsdk\dragonfiresdk\lights\dragonfiresdk.h(244): could be 'int ButtonAdd(int,char *,int,int,int (__cdecl *)(int),int)'
1>          while trying to match the argument list '(int, const char [20], int, int, overloaded-function, int)'

11
Hi guys,

For my game, I need to print the score, which is constantly updated.

I have a function called PrintSteps:

Code: [Select]
string Steps;
int Step = 0;
bool StepsInit = false;
int MyFont = FontAdd("Helvetica", "Regular", 12, 0xFFFFFF);

void PrintSteps(int n)//n=number of steps
{
//add text to screen to show how many buttons have been pressed
Steps=n+1;
Steps="new!";
int MyText2;
if(StepsInit==false){
//int MyText1//(char *)Steps.c_str()
MyText2 = TextAdd(100, 50, (char *)Steps.c_str(), MyFont);
}
else TextSetText(MyText2,(char *)Steps.c_str());
StepsInit = true;
}

(in a dif function):
PrintSteps(Step)
   

Basically, how do I output a number onto the screen?

I tried:
Code: [Select]
int Steps;
MyText2 = TextAdd(100, 50, Steps, MyFont);

But that dosent seem to work?

Thank you in advance,

Micboy

12
Game Programming / Access violation in the code below?
« on: December 19, 2012, 01:28:09 pm »
Could someone please have a look at this code:

error returned is:
Unhandled exception at 0x00a1ac42 in MyFirstApp.exe: 0xC0000005: Access violation reading location 0x00000010.


Code: [Select]
#include "DragonFireSDK.h"
#include <time.h>
#include <Box2D/Box2D.h>

// For iPhone:
const int SCREEN_W = 480;
const int SCREEN_H = 320;

// Scale is 32 pixels = 1 meter:
const float SCALE = 1.0f / 32.0f;

const float SCALED_SCREEN_W = 480*SCALE;
const float SCALED_SCREEN_H = 320*SCALE;
const float SCALED_HALF_SCREEN_W = 240*SCALE;
const float SCALED_HALF_SCREEN_H = 160*SCALE;

// Animation frequency is 30 times / second:
const float DELTA = 1.0f / 30.0f;

// Bodies are 50 pixels per side.
// Body size is halved, since body vertices are relative to the center of the shape:
const float BODY_SIZE_WIDTH = (40.f * SCALE) / 2.0f;
const float BODY_SIZE_HEIGHT = (60.f * SCALE) / 2.0f;

int imagehandleS;

//int jumpTouch;
//int OnJumpTouch(int id, int event, int x, int y);
//bool touching;

int spriteX;
int spriteY; //to control sprite location using variables manually
int jumpheightY;
int jumpY;

int groundX;
int groundY;
int frame = 0;

// Keeps track of the "world's" Y coordinate.
int GlobalY;

int viewS;
int viewG;
int viewB;

int spriteH_pixels = 60;
int spriteW_pixels = 40;
int spriteH_metres = 60*SCALE;
int spriteW_metres = 40*SCALE;

int jumpTouch;
int OnJumpTouch(int id, int event, int x, int y);
    b2Fixture* footSensorFixture;
    b2PolygonShape footSensorBox;
    b2FixtureDef FootSensorFixtureDef;

bool blTouching;

class MyContactListener : public b2ContactListener
{
    void BeginContact(b2Contact* contact)
    {
        //check if fixture A was a ball
        void* bodyUserData = contact->GetFixtureA()->GetUserData();
        if ( (int)bodyUserData ==3 )
        {
blTouching = true;
        }   
        //check if fixture B was a ball
        bodyUserData = contact->GetFixtureB()->GetUserData();
        if ( (int)bodyUserData ==3 )
        {
blTouching = true;
        } 
    }
 
    void EndContact(b2Contact* contact)
    {
        //check if fixture A was a ball
        void* bodyUserData = contact->GetFixtureA()->GetUserData();
        if ( (int)bodyUserData==3 )
        {
blTouching = false;
        } 
        //check if fixture B was a ball
        bodyUserData = contact->GetFixtureB()->GetUserData();
        if ( (int)bodyUserData==3 )
        { 
blTouching = false;
        }
    }
};

MyContactListener myContactListenerInstance;


// Earth gravity = 9.81 m/s:
const float EARTH_GRAVITY = 9.81f;
// Box2D objects:
b2World* world;
b2Vec2 Gravity;
b2Body* body;




void AppMain()
{
// Application initialization code goes here.  Create the items / objects / etc.
// that your app will need while it is running.
LandscapeMode();
spriteX=220;
spriteY=180;

groundX=0;
groundY=240; //remember that ground in DFSDK with ‘box’ ground in box2d

imagehandleS = ImageAdd("Images/sprite.png");//allocate handle to image

viewS = ViewAdd("Images/sprite.png", spriteX, spriteY); //add a view to image to make it visible

spriteH_pixels=ViewGetHeight(viewS); //sprite height in pixels
spriteW_pixels=ViewGetWidth(viewS); //sprite height in pixels
spriteH_metres=spriteH_pixels*SCALE; //sprite height in metres
spriteW_metres=spriteW_pixels*SCALE;//sprite width in metres

Gravity.Set(0.0f, EARTH_GRAVITY);               // Set default gravity vector:
const bool AllowSleep = true;
world = new b2World(Gravity, AllowSleep);
world->SetContactListener(&myContactListenerInstance);


b2BodyDef groundBodyDef; //initialise ground body
groundBodyDef.position.Set(0.0f, 240*SCALE);

//set ground position in container at (0,240) initially
b2Body* groundBody = world->CreateBody(&groundBodyDef); //create a ground polygon
b2PolygonShape groundBox;

groundBox.SetAsBox(240*SCALE, 60*SCALE);
//half width=240; half height=60

groundBody->CreateFixture(&groundBox, 0.0f); //creating a shape fixture for the ground body

//Creating dynamic bodies
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody; //by default == static, make them dynamic
bodyDef.position.Set(spriteX*SCALE, spriteY*SCALE);
b2Body* body = world->CreateBody(&bodyDef);

//creating and attaching a polygon shape using a fixture definition
b2PolygonShape dynamicBox;
dynamicBox.SetAsBox(1.0f, 1.50f);
//sprite pixel width = 40
//sprite pixel height = 60

b2FixtureDef fixtureDef;
fixtureDef.shape = &dynamicBox;
fixtureDef.density = 1.0f; //set density
fixtureDef.friction = 0.3f; //set friction
body->CreateFixture(&fixtureDef);


jumpTouch = TouchAdd(0,0, 320, 480, OnJumpTouch, 0);
footSensorBox.SetAsBox(10 * SCALE, 30 * SCALE);
    FootSensorFixtureDef.isSensor = true;
    FootSensorFixtureDef.shape =&footSensorBox;
    footSensorFixture = body->CreateFixture(&FootSensorFixtureDef);
    footSensorFixture->SetUserData( (void*)3 );

}

int OnJumpTouch(int id, int event, int x, int y)
{
    if (event ==1)
    {
if (blTouching == true)
{
body->ApplyLinearImpulse(b2Vec2(0, -10), body->GetWorldCenter());
}
}
    return id;
}
void AppExit()
{
// Application exit code goes here.  Perform any clean up your app might
// need to do in the event of interruption by a phone call or the user
// pressing the Home button, or some other event that would cause your
// application to terminate.
}


void OnTimer()
{
    // Main loop code goes here.  OnTimer() is called 30 times per second.

// Update all of the bodies created:
    world->Step(DELTA, 10, 10);
        // To convert Box2D positions to DFSDK positions, subrtract BODY_SIZE
        // from each coordinate to get the top left of the shape:
        ViewSetxy(viewS, ((body->GetPosition().x - BODY_SIZE_WIDTH) / SCALE), ((body->GetPosition().y - BODY_SIZE_HEIGHT) / SCALE));
        // Box2D uses radians for angles, but DFSDK uses degrees.  Convert. Degrees = Radians * 180 / PI:

}


13
Game Programming / Problem with BOX2d code for Ground Body
« on: November 14, 2012, 02:38:46 pm »
Dear all,
For this line:groundBody->CreateFixture(&groundBox);
Apparently:
error C2664: 'b2Fixture *b2Body::CreateFixture(const b2FixtureDef *)' : cannot convert parameter 1 from 'b2PolygonShape *' to 'const b2FixtureDef *'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


Finally, i am getting quite a lot of warnings: conversion from 'const float' to 'int', possible loss of data. is this a major problem?

Thank you for your help

14
Game Programming / Making a world with unlimited size??!!
« on: November 14, 2012, 01:54:43 pm »
So, my sprite will always remain in the middle.
However, the world (background) will move down, similar to doodle jump.

If I do this, should I make a container with unlimited height?

15
Game Programming / How many downloads?!! Success stories??
« on: November 14, 2012, 01:43:57 pm »
Kinda interested...
Any one got any success stories they would like to share?
:D

Pages: [1] 2