Sign in to follow this  
raptorstrike

stupid error

Recommended Posts

ok i have done nothing wrong (i dont think) and i cant find the problem here maybe some one here will spot it (this is realy frusterating .cpp
#include "tile.h"
void tile::draw_tile(BITMAP* ,int x, int y, int identifire)
{
  masked_blit(BITMAP* , screen, 0, 0, int x, int y, 41, 41);//error on this line
};    


.h
#include "allegro.h"
#ifndef _TILE_H_
#define _TILE_H_

class tile
{
    void draw_tile(BITMAP *,int x, int y, int identifire);

    int identifire;
};
#endif


EDIT: by the way the error is 5 C:\Dev-Cpp\advanced wars\tile.cpp syntax error before `*' token

Share this post


Link to post
Share on other sites

#include "tile.h"
void tile::draw_tile(BITMAP * map ,int x, int y, int identifire)
{
masked_blit(map, screen, 0, 0, int x, int y, 41, 41);//error in this line
};




#include "allegro.h"
#ifndef _TILE_H_
#define _TILE_H_

class tile
{
void draw_tile(BITMAP * map,int x, int y, int identifire);

int identifire;
};
#endif



still error

Share this post


Link to post
Share on other sites
Quote:
Original post by raptorstrike

void tile::draw_tile(BITMAP * map ,int x, int y, int identifire)
{
masked_blit(BITMAP * map, screen, 0, 0, int x, int y, 41, 41);//error in this line
};



hmm... lack of caffeine today? let me high-light the problem in bold:


masked_blit(BITMAP * map, screen, 0, 0, int x, int y, 41, 41);//error in this line


should be something like:


void tile::draw_tile(BITMAP* map ,int x, int y, int identifire) {
masked_blit(map, screen, 0, 0, x, y, 41, 41);
};

Share this post


Link to post
Share on other sites
You don't quite understand variables. After you specify a type for your variable (i.e. int x) then you can use said variable (x) without specifying type again. That is why Microsoft birthed Hungarian Notation.

Here is what the function should look like.

.cpp

#include "tile.h"
void tile::draw_tile(BITMAP * map ,int x, int y, int identifire)
{
masked_blit( map, screen, 0, 0, x, y, 41, 41);// error gone?
};

Share this post


Link to post
Share on other sites
all i want to do is take an external BITMAP
and use the masked_blit function to render that map based on the external varible location int x and y BITMAP works fine here when i did this earlyer in my program
masked_blit((BITMAP *)datafile[building_red].dat, screen,0,0,64, 64, 41, 41);
NOTE: the oly reson for (BITMAP *) is because i forgot to cast it prior to the function

[edit]
by the way here is a function in the api which uses bitmap


AL_INLINE(void, draw_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y),
{
ASSERT(bmp);
ASSERT(sprite);

if (sprite->vtable->color_depth == 8) {
bmp->vtable->draw_256_sprite(bmp, sprite, x, y);
}
else {
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_sprite(bmp, sprite, x, y);
}
})

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this