First the class:
Code: Select all
class Image {
public:
pvr_ptr_t img;
int w;
int h;
};
Code: Select all
Image* LoadImage(const char* file, int width, int height)
{
//Create instance
Image* ImageName = new Image;
ImageName.img = pvr_mem_malloc(width*height*2);
ImageName.w = width;
ImageName.h = height;
png_to_texture(file, ImageName.img, PNG_FULL_ALPHA);
return ImageName;
}
Code: Select all
Image* p_Room = LoadImage("/rd/room.png",256,256);
What seems to be teh problem???Deleting intermediate files and output files for project 'ChainSawR5 - Win32 Debug'.
--------------------Configuration: ChainSawR5 - Win32 Debug--------------------
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
C:\DevKitDC\bin\createim c:\CHAINSAWRALLY5\DC_TESTS\ChainSawR5\romdisk.img c:\CHAINSAWRALLY5\DC_TESTS\ChainSawR5\romdisk
0 rom 41f08830 [0xffffffff, 0xffffffff] 37777777777, sz 0, at 0x0
1 . [0x1000 , 0x2b44c13e] 0040755, sz 0, at 0x20
1 .. [0x1000 , 0x279a008f] 0040755, sz 0, at 0x40 [link to 0x20 ]
1 room.png [0x19d3 , 0x251059d5] 0100644, sz 14721, at 0x60
C:\DevKitDC\bin\createo c:\CHAINSAWRALLY5\DC_TESTS\ChainSawR5\romdisk.img romdisk c:\CHAINSAWRALLY5\DC_TESTS\ChainSawR5\romdisk.o
C:\DevKitDC\bin\g++ -o ChainSawR5.elf romdisk.o startup.o ChainSawR5.cpp -I C:\DevKitDC\include -I C:\DevKitDC\kernel\arch\dreamcast\include -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-call
s -nostartfiles -nostdlib -Wl -Ttext=0x8c010000 -L C:\DevKitDC\lib -L C:\DevKitDC\sh-sega-dreamcast\lib -lparallax -lpng -lz -lm -ltremor -lkallisti -lgcc -ltsunami -lk++ -lpcx -Ttext=0x8c010000
In file included from ChainSawR5.cpp:19:
Input.cpp:12:1: warning: no newline at end of file
In file included from ChainSawR5.cpp:20:
Image.cpp: In function `Image* LoadImage(const char*, int, int)':
Image.cpp:14: request for member `img' in `ImageName', which is of
non-aggregate type `Image*'
Image.cpp:15: request for member `w' in `ImageName', which is of non-aggregate
type `Image*'
Image.cpp:16: request for member `h' in `ImageName', which is of non-aggregate
type `Image*'
Image.cpp:17: request for member `img' in `ImageName', which is of
non-aggregate type `Image*'
NMAKE : fatal error U1077: 'C:\DevKitDC\bin\g++.exe' : return code '0x1'
Stop.
Error executing NMAKE.
ChainSawR5.exe - 1 error(s), 1 warning(s)