Jump to content
  • Advertisement
Sign in to follow this  
raptorstrike

stupid error

This topic is 5130 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

#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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!