浏览代码

ios: get texture loading to work, somehow.

legacy
Sam Hocevar sam 13 年前
父节点
当前提交
302e45e851
共有 3 个文件被更改,包括 8 次插入6 次删除
  1. +0
    -2
      src/Makefile.am
  2. +8
    -3
      src/image.cpp
  3. +0
    -1
      src/image.mm

+ 0
- 2
src/Makefile.am 查看文件

@@ -20,5 +20,3 @@ liblol_a_SOURCES = \
debugquad.cpp debugquad.h
liblol_a_CPPFLAGS = @LOL_CFLAGS@

EXTRA_DIST = image.mm


+ 8
- 3
src/image.cpp 查看文件

@@ -16,7 +16,7 @@
#include <cstdio>

#if defined __APPLE__ && defined __MACH__
#
# import <UIKit/UIKit.h>
#elif defined USE_SDL
# include <SDL.h>
# include <SDL_image.h>
@@ -68,8 +68,13 @@ Image::Image(char const *path)
: data(new ImageData())
{
#if defined __APPLE__ && defined __MACH__
NSString *path = [[NSBundle mainBundle] pathForResource:@"ascii" ofType:@"png"];
NSData *pngdata = [[NSData alloc] initWithContentsOfFile:path];
NSString *fullpath = [NSString stringWithUTF8String:path];
NSArray *chunks = [fullpath componentsSeparatedByString: @"/"];
NSString *filename = [chunks objectAtIndex: [chunks count] - 1];
chunks = [filename componentsSeparatedByString: @"."];
NSString *prefix = [chunks objectAtIndex: 0];
NSString *mypath = [[NSBundle mainBundle] pathForResource:prefix ofType:@"png"];
NSData *pngdata = [[NSData alloc] initWithContentsOfFile:mypath];
UIImage *image = [[UIImage alloc] initWithData:pngdata];
if (!image)
{


+ 0
- 1
src/image.mm 查看文件

@@ -1 +0,0 @@
#include "image.cpp"

正在加载...
取消
保存