Commit 7b60f269 authored by fallenstardust's avatar fallenstardust

首页完善多种分辨率适配

移除不使用的方法
parent d7c70e6c
...@@ -83,100 +83,7 @@ void ImageManager::RemoveTexture(int code) { ...@@ -83,100 +83,7 @@ void ImageManager::RemoveTexture(int code) {
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
tMap.erase(tit); tMap.erase(tit);
} }
}/*
// function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified
void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa;
u32 dy, dx;
irr::video::SColor pxl;
// Cache rectsngle boundaries.
double sw = src->getDimension().Width * 1.0;
double sh = src->getDimension().Height * 1.0;
// Walk each destination image pixel.
// Note: loop y around x for better cache locality.
irr::core::dimension2d<u32> dim = dest->getDimension();
for(dy = 0; dy < dim.Height; dy++)
for(dx = 0; dx < dim.Width; dx++) {
// Calculate floating-point source rectangle bounds.
minsx = dx * sw / dim.Width;
maxsx = minsx + sw / dim.Width;
minsy = dy * sh / dim.Height;
maxsy = minsy + sh / dim.Height;
// Total area, and integral of r, g, b values over that area,
// initialized to zero, to be summed up in next loops.
area = 0;
ra = 0;
ga = 0;
ba = 0;
aa = 0;
// Loop over the integral pixel positions described by those bounds.
for(sy = floor(minsy); sy < maxsy; sy++)
for(sx = floor(minsx); sx < maxsx; sx++) {
// Calculate width, height, then area of dest pixel
// that's covered by this source pixel.
pw = 1;
if(minsx > sx)
pw += sx - minsx;
if(maxsx < (sx + 1))
pw += maxsx - sx - 1;
ph = 1;
if(minsy > sy)
ph += sy - minsy;
if(maxsy < (sy + 1))
ph += maxsy - sy - 1;
pa = pw * ph;
// Get source pixel and add it to totals, weighted
// by covered area and alpha.
pxl = src->getPixel((u32)sx, (u32)sy);
area += pa;
ra += pa * pxl.getRed();
ga += pa * pxl.getGreen();
ba += pa * pxl.getBlue();
aa += pa * pxl.getAlpha();
}
// Set the destination image pixel to the average color.
if(area > 0) {
pxl.setRed(ra / area + 0.5);
pxl.setGreen(ga / area + 0.5);
pxl.setBlue(ba / area + 0.5);
pxl.setAlpha(aa / area + 0.5);
} else {
pxl.setRed(0);
pxl.setGreen(0);
pxl.setBlue(0);
pxl.setAlpha(0);
}
dest->setPixel(dx, dy, pxl);
}
} }
irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s32 height) {
//if(mainGame->gameConf.use_image_scale) {
irr::video::ITexture* texture;
irr::video::IImage* srcimg = driver->createImageFromFile(file);
if(srcimg == NULL)
return NULL;
if(srcimg->getDimension() == irr::core::dimension2d<u32>(width, height)) {
texture = driver->addTexture(file, srcimg);
} else {
video::IImage *destimg = driver->createImage(srcimg->getColorFormat(), irr::core::dimension2d<u32>(width, height));
imageScaleNNAA(srcimg, destimg);
texture = driver->addTexture(file, destimg);
destimg->drop();
}
srcimg->drop();
return texture;
//} else {
// return driver->getTexture(file);
//}
}*/
irr::video::ITexture* ImageManager::GetTexture(int code) { irr::video::ITexture* ImageManager::GetTexture(int code) {
if(code == 0) if(code == 0)
return tUnknown; return tUnknown;
...@@ -236,27 +143,6 @@ irr::video::ITexture* ImageManager::GetTexture(int code) { ...@@ -236,27 +143,6 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
} }
irr::video::ITexture* ImageManager::GetTextureThumb(int code) { irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
return tUnknown; return tUnknown;
/*
if(code == 0)
return tUnknown;
auto tit = tThumb.find(code);
if(tit == tThumb.end()) {
char file[256];
sprintf(file, "%s/%d.jpg", irr::android::getCardImagePath(mainGame->appMain).c_str(), code);
irr::video::ITexture* img = driver->getTexture(file);
if(img == NULL) {
tThumb[code] = NULL;
return tUnknown;
} else {
tThumb[code] = img;
return img;
}
}
if(tit->second)
return tit->second;
else
return tUnknown;
*/
} }
irr::video::ITexture* ImageManager::GetTextureField(int code) { irr::video::ITexture* ImageManager::GetTextureField(int code) {
if(code == 0) if(code == 0)
...@@ -266,21 +152,17 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) { ...@@ -266,21 +152,17 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
char file[256]; char file[256];
sprintf(file, "field/%s/%d.jpg", irr::android::getCardImagePath(mainGame->appMain).c_str(), code); sprintf(file, "field/%s/%d.jpg", irr::android::getCardImagePath(mainGame->appMain).c_str(), code);
irr::video::ITexture* img = driver->getTexture(file); irr::video::ITexture* img = driver->getTexture(file);
// irr::video::ITexture* img = GetTextureFromFile(file, 512, 512);
if(img == NULL) { if(img == NULL) {
sprintf(file, "field/%s/%d.jpg", irr::android::getCardImagePath(mainGame->appMain).c_str(), code); sprintf(file, "field/%s/%d.jpg", irr::android::getCardImagePath(mainGame->appMain).c_str(), code);
img = driver->getTexture(file); img = driver->getTexture(file);
// img = GetTextureFromFile(file, 512, 512);
} }
if(img == NULL) { if(img == NULL) {
sprintf(file, "field/%s/%d.png", irr::android::getCardImagePath(mainGame->appMain).c_str(), code); sprintf(file, "field/%s/%d.png", irr::android::getCardImagePath(mainGame->appMain).c_str(), code);
img = driver->getTexture(file); img = driver->getTexture(file);
// img = GetTextureFromFile(file, 512, 512);
} }
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/field/%d.jpg", code); sprintf(file, "pics/field/%d.jpg", code);
img = driver->getTexture(file); img = driver->getTexture(file);
// img = GetTextureFromFile(file, 512, 512);
if(img == NULL) { if(img == NULL) {
tFields[code] = NULL; tFields[code] = NULL;
return NULL; return NULL;
......
...@@ -19,87 +19,91 @@ ...@@ -19,87 +19,91 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:scrollbars="none" /> android:scrollbars="none" />
<LinearLayout <RelativeLayout
android:id="@+id/bottombar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:orientation="horizontal" android:orientation="horizontal"
android:weightSum="1"> android:weightSum="1">
<LinearLayout
android:layout_width="286dp"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="left"
android:orientation="vertical">
<cn.garymb.ygomobile.ui.widget.ShimmerTextView
android:id="@+id/shimmer_tv"
android:layout_width="150dp"
android:layout_height="60dp"
android:background="@drawable/blue" <cn.garymb.ygomobile.ui.widget.ShimmerTextView
android:gravity="center" android:id="@+id/shimmer_tv"
android:text="@string/return_to_duel" android:layout_width="150dp"
android:textColor="@color/item_title" android:layout_height="60dp"
android:textSize="20sp" android:layout_gravity="center|left"
android:visibility="visible" /> android:layout_marginEnd="0dp"
</LinearLayout> android:background="@drawable/blue"
android:gravity="center"
android:text="@string/return_to_duel"
android:textColor="@color/item_title"
android:textSize="20sp"
android:visibility="visible" />
<LinearLayout <LinearLayout
android:layout_width="50dp" android:layout_width="125dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:layout_alignParentEnd="true"
android:orientation="horizontal">
<TextView
android:layout_width="50dp"
android:layout_height="17dp" />
<ImageView
android:id="@+id/btn_mycard"
android:layout_width="50dp"
android:layout_height="60dp"
android:gravity="bottom"
android:src="@drawable/mycard" />
<TextView <LinearLayout
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="20dp" android:layout_height="match_parent"
android:gravity="bottom|center_horizontal" android:orientation="vertical">
android:text="@string/mycard"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="75dp"
android:layout_height="match_parent"
android:orientation="vertical">
<com.nightonke.boommenu.BoomMenuButton <TextView
android:id="@+id/bmb" android:layout_width="50dp"
android:layout_width="wrap_content" android:layout_height="17dp" />
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/buttonfunction"
app:bmb_buttonEnum="textOutsideCircle"
app:bmb_buttonPlaceEnum="buttonPlace_sc_9_1"
app:bmb_dimColor="#80000000"
app:bmb_normalColor="@android:color/transparent"
app:bmb_piecePlaceEnum="piecePlace_dot_9_1">
<ImageView <ImageView
android:id="@+id/cube" android:id="@+id/btn_mycard"
android:layout_width="40dp" android:layout_width="50dp"
android:layout_height="41dp" android:layout_height="60dp"
android:layout_gravity="center" android:gravity="bottom"
app:srcCompat="@drawable/cube" /> android:src="@drawable/mycard" />
</com.nightonke.boommenu.BoomMenuButton>
<TextView <TextView
android:layout_width="50dp"
android:layout_height="20dp"
android:gravity="bottom|center_horizontal"
android:text="@string/mycard"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="75dp" android:layout_width="75dp"
android:layout_height="20dp" android:layout_height="match_parent"
android:gravity="bottom|center_horizontal" android:layout_marginEnd="0dp"
android:text="@string/Function_Menu" android:orientation="vertical">
android:textSize="10sp" />
<com.nightonke.boommenu.BoomMenuButton
android:id="@+id/bmb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/buttonfunction"
app:bmb_buttonEnum="textOutsideCircle"
app:bmb_buttonPlaceEnum="buttonPlace_sc_9_1"
app:bmb_dimColor="#80000000"
app:bmb_normalColor="@android:color/transparent"
app:bmb_piecePlaceEnum="piecePlace_dot_9_1">
<ImageView
android:id="@+id/cube"
android:layout_width="40dp"
android:layout_height="41dp"
android:layout_gravity="center"
app:srcCompat="@drawable/cube" />
</com.nightonke.boommenu.BoomMenuButton>
<TextView
android:layout_width="75dp"
android:layout_height="20dp"
android:gravity="bottom|center_horizontal"
android:text="@string/Function_Menu"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </RelativeLayout>
</FrameLayout> </FrameLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment